A scalable and secure backend service for managing recurring subscriptions. This RESTful API allows users to authenticate, manage subscription plans, receive email reminders, and store data reliably using a MongoDB database.
- 📌 Introduction
- 🎯 Features
- 🛠️ Tech Stack
- ⚙️ Setup Instructions
- 🔐 Environment Variables
- 📄 License
Build a production-ready Subscription Management System API that handles real users, real money, and real business logic.
Authenticate users using JWTs, connect a database, create models and schemas, and integrate it with ORMs. Structure the architecture of your API to ensure scalability and seamless communication with the frontend.
- 🔐 JWT Authentication – Secure login and registration flow.
- 🧠 Smart Subscription Management – Track services, renewal dates, categories, and payment methods.
- 📬 Automated Email Reminders – Scheduled email notifications using Upstash QStash.
- 🌐 RESTful Architecture – Clean and consistent routing design.
- 🧱 MongoDB + Mongoose – Schema-based data modeling.
- ⚙️ Global Error Handling – Centralized middleware for clean debugging.
- 🛡️ Rate Limiting – Protection against brute force and bot traffic.
Technology | Description |
---|---|
Node.js | Runtime environment for executing JavaScript |
Express.js | Backend web application framework |
MongoDB | NoSQL database for flexible document storage |
Mongoose | ODM for MongoDB |
JWT | Secure user authentication |
Upstash QStash | Serverless queue to manage background jobs |
Nodemailer | Sends transactional emails |
Follow these steps to set up the project locally on your machine.
Prerequisites
Make sure you have the following installed on your machine:
Clone the Repository
git clone https://github.com/SrjAdhikari/Subscription-Tracker-Backend.git
cd Subscription-Tracker-Backend
Installation
Install the project dependencies using npm:
npm install
Run the Project
npm run dev
Open http://localhost:5500 in your browser or Postman to test the project.
Set Up Environment Variables
Create a .env.local
file in the root of your project and add the following variables:
# PORT
PORT=5500
SERVER_URL="http://localhost:5500"
# ENVIRONMENT
NODE_ENV=development
# DATABASE (Get MongoDB URI from your MongoDB Atlas or local MongoDB setup)
DB_URI=
# JWT AUTH (Generate a secure random string for JWT_SECRET)
JWT_SECRET=
JWT_EXPIRES_IN="1d"
# ARCJET (Get your Arcjet key from https://arcjet.com)
ARCJET_KEY=
ARCJET_ENV="development"
# UPSTASH (Get your QStash URL and token from https://upstash.com)
QSTASH_URL=http://127.0.0.1:8080
QSTASH_TOKEN=
# NODEMAILER (Use your email service provider's SMTP password)
EMAIL_PASSWORD=
This project is licensed under the MIT License. See the LICENSE file for details.
Made with ❤️ by Suraj Adhikari