A comprehensive full-stack application for managing licenses, subscriptions, and customers. Built with React (TypeScript + Vite) frontend and Node.js/Express backend with PostgreSQL database.
- Dashboard: System overview with metrics and recent activities
- Customer Management: CRUD operations for customer accounts
- Subscription Pack Management: Create and manage subscription plans
- Subscription Management: Approve/reject requests, assign/unassign subscriptions
- JWT Authentication: Secure admin authentication
- Registration & Login: Account creation and authentication
- Dashboard: Personal subscription overview
- Subscription Management: Request new subscriptions, view current plan
- Profile Management: View and manage account information
- Subscription History: Track past subscriptions
- API Key Authentication: Separate authentication for mobile/desktop SDKs
- Subscription Operations: Get current subscription, request new, deactivate
- History Access: Retrieve subscription history with pagination
- Frontend: React 18, TypeScript, Vite, TailwindCSS, React Query, React Router
- Backend: Node.js, Express.js, TypeScript, Sequelize ORM
- Database: PostgreSQL
- Authentication: JWT for frontend, API Keys for SDK
- Development: Docker, Docker Compose
├── backend/ # Express.js API server
│ ├── src/
│ │ ├── config/ # Database and logger configuration
│ │ ├── models/ # Sequelize models
│ │ ├── routes/ # API route handlers
│ │ ├── middleware/ # Authentication and validation middleware
│ │ ├── scripts/ # Database seeding scripts
│ │ └── server.ts # Main server file
│ ├── Dockerfile
│ ├── docker-compose.yml
│ └── package.json
├── frontend/ # React application
│ ├── src/
│ │ ├── components/ # Reusable components
│ │ ├── pages/ # Page components
│ │ ├── contexts/ # React contexts
│ │ ├── api/ # API client functions
│ │ ├── lib/ # Utilities and helpers
│ │ └── types/ # TypeScript type definitions
│ ├── package.json
│ └── vite.config.ts
└── PROJECT_README.md # This file
- Node.js 18+ and npm
- PostgreSQL 15+
- Docker and Docker Compose (optional)
-
Clone the repository
git clone <repository-url> cd license-management-system
-
Start with Docker Compose
cd backend docker-compose up -d -
Seed the database
docker-compose exec api npm run seed -
Setup frontend
cd ../frontend npm install cp env.example .env npm run dev
The application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
- Health Check: http://localhost:8080/health
-
Install dependencies
cd backend npm install -
Setup PostgreSQL database
# Create database createdb license_management -
Configure environment
cp env.example .env # Edit .env with your database credentials -
Build and start server
npm run build npm start # For development with auto-reload npm run dev -
Seed database with sample data
npm run seed
-
Install dependencies
cd frontend npm install -
Configure environment
cp env.example .env # Edit .env with your API URL -
Start development server
npm run dev
After running the seed script, you can use these credentials:
- Email: admin@example.com
- Password: admin123
- Email: john@example.com / Password: customer123
- Email: jane@example.com / Password: customer123
- Email: bob@example.com / Password: customer123
-
Customer Registration/Login
- Navigate to http://localhost:3000/signup (new users) or http://localhost:3000/login
- Use customer credentials from above
- JWT token stored securely for session management
-
Dashboard Overview
- View current subscription status
- See account statistics
- Quick access to subscription management
-
Profile Management
- View personal information
- Account activity statistics
- Edit profile (placeholder)
-
Subscription Request Flow
- Browse available subscription plans
- Select desired plan
- Submit subscription request
- Request sent to admin for approval
-
Subscription Management
- View current active subscription
- Deactivate subscription if needed
- Access subscription history
The API follows the OpenAPI 3.0 specification provided in openapi.yaml. Key endpoints include:
POST /api/admin/login- Admin authenticationPOST /api/customer/login- Customer authenticationPOST /api/customer/signup- Customer registrationGET /api/v1/admin/dashboard- Admin dashboard dataGET /api/v1/customer/subscription- Customer's current subscription
POST /sdk/auth/login- SDK authentication (returns API key)GET /sdk/v1/subscription- Current subscription via SDKPOST /sdk/v1/subscription- Request subscription via SDKDELETE /sdk/v1/subscription- Deactivate subscription via SDK
cd backend
npm testcd frontend
npm test- Build the application:
npm run build - Set production environment variables
- Deploy using Docker or process manager (PM2)
- Configure reverse proxy (nginx)
- Setup SSL certificates
- Build for production:
npm run build - Deploy static files to CDN or web server
- Configure environment variables for production API
- ✅ JWT authentication for frontend APIs
- ✅ API key authentication for SDK APIs
- ✅ Role-based access control (Admin/Customer)
- ✅ Route guards and protected routes
- ✅ Password hashing with bcrypt
- ✅ Input validation and sanitization
- ✅ Single active subscription per customer rule
- ✅ Subscription lifecycle management (requested → approved → active → inactive/expired)
- ✅ Soft delete for customers and subscription packs
- ✅ Automatic subscription expiry calculation
- ✅ Responsive design with TailwindCSS
- ✅ Toast notifications for user feedback
- ✅ Loading states and error handling
- ✅ Intuitive navigation and routing
- ✅ Form validation with helpful error messages
- ✅ Axios interceptors for token management
- ✅ React Query for efficient data fetching and caching
- ✅ Consistent error handling across the application
- ✅ Pagination support for list endpoints
While this implementation provides a solid foundation, consider these enhancements for production:
-
Enhanced Security
- Rate limiting per user
- CSRF protection
- Input sanitization
- API versioning
-
Advanced Features
- Email notifications
- Payment integration
- Advanced analytics
- Audit logging
-
Monitoring & DevOps
- Application monitoring
- Log aggregation
- Performance metrics
- CI/CD pipeline
-
Scalability
- Database optimization
- Caching layer (Redis)
- Load balancing
- Microservices architecture
-
Database Connection Error
- Ensure PostgreSQL is running
- Check database credentials in .env file
- Verify database exists
-
Frontend API Calls Failing
- Check backend server is running on port 8080
- Verify CORS configuration
- Check network proxy settings
-
Authentication Issues
- Clear browser localStorage
- Check JWT_SECRET in backend .env
- Verify token expiration settings
- Backend logs:
backend/logs/ - Browser console for frontend errors
- Docker logs:
docker-compose logs api
For questions or issues, please refer to:
- API documentation in
openapi.yaml - System design in
README.md - Code comments and TypeScript types
License Management System - A modern, scalable solution for subscription and license management.