PlanTopia is a full-stack subscription management web application built with Next.js, MongoDB, and TypeScript. It allows users to create accounts, browse available subscription plans, manage their subscriptions, and access a personalized dashboard.
The application also includes role-based access control, providing separate functionality for regular users and administrators.
- User registration and login
- Secure password hashing using bcrypt
- JWT-based authentication
- Browse available subscription plans
- Subscribe to plans
- View and manage active subscriptions
- Personalized user dashboard
- Responsive user interface
- Role-based administrator access
- Dedicated admin dashboard
- Manage subscription plans
- View application data through administrative functionality
PlanTopia implements authentication using:
- bcrypt for password hashing and verification
- JSON Web Tokens (JWT) for authentication
- Environment variables for sensitive configuration
- Role information stored with user accounts
- MongoDB for persistent user data
Sensitive values such as the MongoDB connection URI and JWT secret are stored in environment variables and are not committed to the repository.
- Next.js
- React
- TypeScript
- CSS
- Next.js API Routes
- Node.js
- MongoDB
- Mongoose
- JSON Web Tokens (JWT)
- bcryptjs
subscription-system/
├── app/
│ ├── admin/
│ │ └── page.tsx
│ ├── api/
│ │ ├── login/
│ │ ├── plans/
│ │ ├── register/
│ │ └── subscriptions/
│ ├── auth/
│ │ ├── login/
│ │ └── register/
│ ├── dashboard/
│ │ └── page.tsx
│ ├── globals.css
│ ├── layout.tsx
│ └── page.tsx
├── data/
│ ├── plans.json
│ └── users.json
├── lib/
│ └── mongodb.ts
├── models/
│ ├── Plan.ts
│ ├── Subscription.ts
│ └── User.ts
├── public/
├── .gitignore
├── next.config.ts
├── package.json
├── package-lock.json
├── tsconfig.json
└── README.md
Create a .env.local file in the project root:
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secretDo not commit .env.local or other environment files to version control.
git clone https://github.com/parnika0110/subscription-management-system.git
cd subscription-management-systemnpm installCreate .env.local in the project root and add:
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secretnpm run devVisit:
http://localhost:3000
The application uses MongoDB through Mongoose.
The database connection is configured through:
MONGODB_URI
The application uses the database name:
subscriptionDB
The main data models are:
- User — stores user account and role information
- Plan — stores subscription plan information
- Subscription — stores user subscription information
User
↓
Register / Login
↓
Authentication
↓
Dashboard
↓
Browse Plans
↓
Manage Subscriptions
Administrative users can access separate admin functionality based on their stored role.
The application contains API routes for:
| Route | Purpose |
|---|---|
/api/register |
Register a new user |
/api/login |
Authenticate a user |
/api/plans |
Handle subscription plan data |
/api/subscriptions |
Handle user subscriptions |
- Environment files are excluded through
.gitignore. - MongoDB credentials are not hardcoded in the source code.
- JWT secrets are loaded through environment variables.
- Passwords are hashed using bcrypt before storage.
- Authentication verifies hashed passwords using bcrypt.
- Generated Next.js files and
node_modulesare excluded from Git.
- Email notifications for subscription renewals
- Subscription expiry reminders
- Payment gateway integration
- Advanced admin analytics
- Subscription usage statistics
- Improved authentication and session management
- Password reset functionality
- Additional subscription categories
PlanTopia was developed as a full-stack project to explore subscription management, authentication, role-based access control, REST-style API development, MongoDB integration, and modern web application development using Next.js.