Skip to content

Sumit-531/Subscription-Tracker

Repository files navigation

🔄 A Subscription Management System API

Node.js Express MongoDB

A modern Node.js + Express + MongoDB application for managing subscriptions, users, and subscription plans — the backend API powering a subscription-based platform.

  1. 📘 Introduction
  2. ⚙️ Tech Stack
  3. Features
  4. 🚀 Quick Start
  5. 💻 Snippets (Code to Copy)
  6. 📸 Demo
  7. 🔗 Links

A Subscription Management System API built with Node.js, Express, and MongoDB. It provides secure user authentication, subscription handling, and structured data modeling with Mongoose. The system includes production-grade features such as rate limiting, bot protection, centralized error handling, logging, and automated email workflows.

  • Node.js
  • Express.js
  • MongoDB

🔐 Advanced Security Controls: Arcjet integration provides bot protection and rate-limiting capabilities throughout the system.

📨 Automated Email Notifications: Upstash Workflows enable scheduled and event-driven reminder emails.

🗃️ Database Modeling: MongoDB and Mongoose are used to define structured models and establish clear relationships.

🎫 JWT-Based Authentication: Secure token-based workflows support user management and subscription operations.

⚠️ Centralized Error Handling: Unified validation, structured error responses, and middleware-driven processing ensure consistent behavior across the API.

🔧 Modular Architecture: The codebase is organized for scalability, maintainability, and reusability across different parts of the application.

Prerequisites

  • Git
  • Node.js
  • npm
  • MongoDB

Clone the repository

git clone https://github.com/Sumit-531/Subscription-Tracker.git
cd Subscription-Tracker

Installation

Install the project dependencies using npm:

npm install

Set Up Environment Variables

Create a file named .env.local in the root directory of the project and add the required environment variables as shown below:

# PORT
PORT=5500
SERVER_URL="http://localhost:5500"

# ENVIRONMENT
NODE_ENV=development

# DATABASE
DB_URI=

# JWT AUTH
JWT_SECRET=
JWT_EXPIRES_IN="1d"

# ARCJET
ARCJET_KEY=
ARCJET_ENV="development"

# UPSTASH
QSTASH_URL=http://127.0.0.1:8080
QSTASH_TOKEN=

# NODEMAILER
EMAIL_PASSWORD=

Running the Project

npm run dev

Test the API

After starting the server, the API will be accessible at: http://localhost:5500 Requests can be made through a web browser or any HTTP client (e.g., Insomnia, Postman) to verify the endpoints.

Dummy JSON Data
{
  "name": "Sports Pro",
  "price": 200,
  "currency": "BDT",
  "frequency": "weekly",
  "category": "sports",
  "startDate": "2025-11-15T00:00:00.000Z",
  "paymentMethod": "Credit Card"
}

User Account Creation Example

Sing UP API Response Example Example response returned by the API when creating a new user account.

User Sign-in Example

Sign In API Response Example Example response returned by the API when signing in an existing user.

Rate Limit Enforcement Example

Rate Limit Trigger Example showing Arcjet enforcing rate limits when too many API requests are made.

Automated Subscription Reminder Email Example

Automated Email Sent
Automated subscription reminder email example sent to users.

About

Subscription Tracker API with JWT auth, rate limiting, and automated emails.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published