A comprehensive subscription management application built with Next.js 14, TypeScript, Tailwind CSS, and Hasura GraphQL.
- 📊 Dashboard: Overview of all subscriptions with statistics and upcoming renewals
- 💳 Subscription Management: Add, edit, delete, and organize subscriptions
- 🎨 Modern UI: Beautiful, responsive design with dark mode support
- 📱 Mobile-First: Fully responsive design that works on all devices
- 🔍 Search & Filter: Find subscriptions quickly with powerful search and filtering
- 📈 Analytics: Track spending patterns and subscription trends
- 🔔 Notifications: Get reminded before renewals
- 🌐 GraphQL API: Powered by Hasura for real-time data
- 🧪 Testing: Comprehensive unit and E2E testing with Jest and Playwright
- 🚀 Performance: Optimized for speed with Next.js 14 features
- Frontend: Next.js 14, React 18, TypeScript
- Styling: Tailwind CSS, CSS Variables for theming
- Database: PostgreSQL with Hasura GraphQL
- State Management: Apollo Client, React Context
- Forms: React Hook Form with Zod validation
- Testing: Jest, React Testing Library, Playwright
- Deployment: Vercel
- Icons: Lucide React
- Node.js 18+ and npm
- PostgreSQL database
- Hasura Cloud account (or local Hasura instance)
git clone <repository-url>
cd subscription-manager
npm installCopy the environment file and update with your values:
cp .env.example .env.localUpdate .env.local with your configuration:
# Hasura Configuration
NEXT_PUBLIC_HASURA_GRAPHQL_URL=https://your-hasura-project.hasura.app/v1/graphql
HASURA_GRAPHQL_ADMIN_SECRET=your-admin-secret-here
# Database Configuration
DATABASE_URL=postgresql://username:password@localhost:5432/subscription_db
# App Configuration
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-nextauth-secret-here- Create a PostgreSQL database
- Run the schema from
database/schema.sql:
psql -d your_database -f database/schema.sql- Create a new project at Hasura Cloud
- Connect your PostgreSQL database
- Import the database schema
- Set up permissions for the tables
- Copy your GraphQL endpoint and admin secret to
.env.local
npm run devOpen http://localhost:3000 to see the application.
├── app/ # Next.js 14 app directory
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Dashboard page
├── components/ # React components
│ ├── dashboard/ # Dashboard-specific components
│ ├── layout/ # Layout components
│ ├── subscriptions/ # Subscription components
│ ├── test/ # Test utilities
│ └── ui/ # Reusable UI components
├── context/ # React contexts
├── database/ # Database schema and migrations
├── hooks/ # Custom React hooks
├── lib/ # Utilities and configurations
│ ├── graphql/ # GraphQL queries and mutations
│ ├── apollo-client.ts # Apollo Client setup
│ ├── utils.ts # Utility functions
│ └── validations.ts # Zod schemas
├── tests/ # Test files
│ └── e2e/ # Playwright E2E tests
├── types/ # TypeScript type definitions
└── __tests__/ # Jest unit tests
# Development
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
# Code Quality
npm run lint # Run ESLint
npm run lint:fix # Fix ESLint errors
npm run type-check # Run TypeScript checks
# Testing
npm run test # Run Jest tests
npm run test:watch # Run Jest in watch mode
npm run test:coverage # Run tests with coverage
npm run test:e2e # Run Playwright E2E tests
npm run test:e2e:ui # Run E2E tests with UI- StatsCards: Display key metrics (total subscriptions, monthly cost, etc.)
- UpcomingRenewals: Show subscriptions due for renewal
- QuickActions: Quick access to common actions
- RecentActivity: Timeline of recent changes
- SubscriptionCard: Individual subscription display with actions
- SubscriptionForm: Add/edit subscription form with validation
- DataTable: Tabular view with sorting and filtering
- DashboardLayout: Main application layout with sidebar and header
- Header: Top navigation with search, theme toggle, and user menu
- Sidebar: Navigation menu with responsive mobile support
The application uses the following main entities:
- users: User accounts
- subscriptions: Subscription records with cost, renewal dates, etc.
- categories: Subscription categories for organization
- payment_history: Track payment records
See database/schema.sql for the complete schema.
The app supports light/dark themes using CSS variables. Customize colors in:
app/globals.css- CSS variablestailwind.config.js- Tailwind theme configuration
Default categories are defined in the database schema. Add custom categories through the UI or directly in the database.
Supported currencies: USD, EUR, GBP, INR, JPY. Add more in lib/utils.ts and components/subscriptions/SubscriptionForm.tsx.
npm run testTests are located in __tests__/ and cover:
- Utility functions
- Component rendering and interactions
- Form validation
- Custom hooks
npm run test:e2eE2E tests cover:
- Dashboard functionality
- Subscription CRUD operations
- Navigation and responsive design
- Theme switching
- Push your code to GitHub
- Connect your repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push
npm run build
npm run start- Code Splitting: Automatic with Next.js 14
- Image Optimization: Next.js Image component
- Bundle Analysis: Run
npm run analyzeto analyze bundle size - Caching: Apollo Client caching for GraphQL data
- Lazy Loading: Components loaded on demand
- Input Validation: Zod schemas for all forms
- XSS Protection: Sanitized user input
- CORS: Configured for API routes
- Environment Variables: Sensitive data in environment variables
- Authentication: Ready for NextAuth.js integration
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Make changes and add tests
- Run tests:
npm run test && npm run test:e2e - Commit changes:
git commit -m 'Add new feature' - Push to branch:
git push origin feature/new-feature - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue on GitHub or contact the development team.
- User authentication and multi-user support
- Email notifications for renewals
- Subscription sharing and family plans
- Advanced analytics and reporting
- Mobile app (React Native)
- Integration with banking APIs
- Subscription recommendations
- Bulk import/export features