Skip to content

About

SaaS Subscription Manager

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

23 Commits

Folders and files

Repository files navigation

SaaS Subscription Manager

Description

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 administrators
  • server/: 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.

Features

  • 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

Tech Stack

Frontend

  • React 18
  • TypeScript
  • Vite
  • React Router
  • Axios

Backend

  • Node.js
  • Express
  • TypeScript
  • Prisma ORM
  • PostgreSQL
  • JWT authentication
  • class-validator / class-transformer
  • Swagger UI / OpenAPI
  • Vitest

Project Structure

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

Installation

Prerequisites

  • Node.js 18+
  • npm
  • A PostgreSQL database

1. Clone the repository

git clone <your-repository-url>
cd "SaaS Subscription Manager"

2. Install dependencies

Install dependencies separately for the server and client because this repository does not use a root workspace package.

cd server
npm install
cd ../client
npm install

3. Configure environment variables

Create the following files:

  • server/.env
  • client/.env

Use the environment variable reference below.

4. Prepare the database

From the server/ directory:

npm run db:push

This applies the Prisma schema to your configured PostgreSQL database.

5. Start the backend

From the server/ directory:

npm run dev

The API runs on http://localhost:5000 by default.

6. Start the frontend

From the client/ directory:

npm run dev

The frontend runs on http://localhost:5173 by default.

Environment Variables

Server (server/.env)

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

Client (client/.env)

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/v1

API Overview

The backend exposes a versioned REST API under:

/api/v1

Main route groups:

  • /auth for signup, login, logout, and current-user session lookup
  • /users for profile management and admin user inspection
  • /plans for plan listing and admin plan management
  • /subscriptions for plan selection, checkout, plan changes, cancellation, and subscription history
  • /payments for payment history
  • /payment-methods for saved card management
  • /admin for 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

About

SaaS Subscription Manager

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages