SaaS Subscription Manager is a full-stack web application for managing subscription-based products. It allows users to create accounts, browse plans, subscribe to a plan, change plans, manage payment methods, review payment history, and update their profile. It also includes an admin workspace for monitoring platform activity, creating administrators, and managing the plan catalog.
This project is split into two main applications:
client/: a React + Vite frontend for end users and administratorsserver/: an Express + TypeScript backend that exposes the REST API, business logic, and database access layer
The application was built around the requirements described in SaaS_Subscription _Manager.md.
- User authentication with signup, login, logout, and current-session lookup
- Role-aware access for standard users and administrators
- Plan catalog with monthly and yearly billing cycles
- Pending subscription selection flow before checkout
- Subscription checkout with mock payment processing
- Plan upgrade or downgrade flow for active subscriptions
- Subscription cancellation and subscription history tracking
- Saved payment methods with default-card selection
- Payment history for the authenticated user
- Profile management for updating account details
- Admin dashboard with platform statistics
- Admin plan management for creating, editing, and deactivating plans
- Admin user review tools with subscription visibility
- Swagger/OpenAPI documentation for the backend API
- React 18
- TypeScript
- Vite
- React Router
- Axios
- Node.js
- Express
- TypeScript
- Prisma ORM
- PostgreSQL
- JWT authentication
- class-validator / class-transformer
- Swagger UI / OpenAPI
- Vitest
SaaS Subscription Manager/
client/
src/
components/
features/
layouts/
pages/
services/
utils/
README.md
package.json
server/
prisma/
schema.prisma
migrations/
src/
config/
docs/
modules/
shared/
app.ts
routes.ts
server.ts
README.md
package.json
SaaS_Subscription _Manager.md
README.md
- Node.js 18+
- npm
- A PostgreSQL database
git clone <your-repository-url>
cd "SaaS Subscription Manager"Install dependencies separately for the server and client because this repository does not use a root workspace package.
cd server
npm installcd ../client
npm installCreate the following files:
server/.envclient/.env
Use the environment variable reference below.
From the server/ directory:
npm run db:pushThis applies the Prisma schema to your configured PostgreSQL database.
From the server/ directory:
npm run devThe API runs on http://localhost:5000 by default.
From the client/ directory:
npm run devThe frontend runs on http://localhost:5173 by default.
| Variable | Required | Description |
|---|---|---|
PORT |
No | Server port. Defaults to 5000. |
NODE_ENV |
No | Runtime mode: development, test, or production. |
DATABASE_URL |
Yes | Prisma connection string for the PostgreSQL database. |
DIRECT_URL |
No | Optional direct database URL for Prisma operations. |
JWT_SECRET |
Recommended | Secret used to sign and verify JWT tokens. Defaults to a development fallback if omitted. |
JWT_EXPIRES_IN |
No | JWT lifetime. Defaults to 7d. |
CORS_ORIGIN |
No | Comma-separated frontend origins loaded by the config layer for future or deployment-specific CORS control. |
Example:
PORT=5000
NODE_ENV=development
DATABASE_URL=postgresql://USER:PASSWORD@HOST:5432/saas_subscription_manager
DIRECT_URL=
JWT_SECRET=your_secure_jwt_secret
JWT_EXPIRES_IN=7d
CORS_ORIGIN=http://localhost:5173| Variable | Required | Description |
|---|---|---|
VITE_API_BASE_URL |
No | Base URL for the backend API. Defaults to http://localhost:5000/api/v1. |
Example:
VITE_API_BASE_URL=http://localhost:5000/api/v1The backend exposes a versioned REST API under:
/api/v1
Main route groups:
/authfor signup, login, logout, and current-user session lookup/usersfor profile management and admin user inspection/plansfor plan listing and admin plan management/subscriptionsfor plan selection, checkout, plan changes, cancellation, and subscription history/paymentsfor payment history/payment-methodsfor saved card management/adminfor dashboard statistics and administrator creation
Interactive documentation is available when the server is running:
- Swagger UI:
http://localhost:5000/docs - OpenAPI JSON:
http://localhost:5000/docs.json