SubscriptionTracker-API is a secure and scalable backend service for managing user subscriptions. It offers powerful features such as JWT-based authentication, email reminders for upcoming renewals, global error handling, and bot protection via Arcjet. Designed with modular architecture and robust logging, this API is perfect for building modern SaaS subscription tracking applications.
- Node.js
- Express.js
- MongoDB
👉 Advanced Rate Limiting and Bot Protection: with Arcjet that helps you secure the whole app.
👉 Database Modeling: Models and relationships using MongoDB & Mongoose.
👉 JWT Authentication: User CRUD operations and subscription management.
👉 Global Error Handling: Input validation and middleware integration.
👉 Logging Mechanisms: For better debugging and monitoring.
👉 Email Reminders: Automating smart email reminders with workflows using Upstash.
and many more, including code architecture and reusability
Follow these steps to set up the project locally on your machine.
git clone https://github.com/ankushchhabra02/SubscriptionTracker-API.git
cd SubscriptionTracker-APIInstallation
Install the project dependencies using npm:
npm installSet Up Environment Variables
Create a new file named .env.local in the root of your project and add the following content:
# 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 devOpen http://localhost:5500 in your browser or any HTTP client to test the project.
Dummy JSON Data
{
"name": "Amazon Prime Membership",
"price": 139.0,
"currency": "USD",
"frequency": "monthly",
"category": "entertainment",
"startDate": "2025-03-10T00:00:00.000Z",
"paymentMethod": "Credit Card"
}POST /api/v1/auth/sign-up– Register a new userPOST /api/v1/auth/sign-in– Login and receive JWTPOST /api/v1/auth/sign-out– Logout user (optional implementation)
GET /api/v1/users/– Get all usersGET /api/v1/users/:id– Get a single user by IDPOST /api/v1/users/– Create new user (admin use)PUT /api/v1/users/:id– Update user detailsDELETE /api/v1/users/:id– Delete a user
POST /api/v1/subscriptions/– Create new subscriptionGET /api/v1/subscriptions/:id– Get subscription by IDPUT /api/v1/subscriptions/:id– Update subscriptionDELETE /api/v1/subscriptions/:id– Delete subscriptionPUT /api/v1/subscriptions/:id/cancel– Cancel subscriptionGET /api/v1/subscriptions/user/:id– Get all subscriptions by a userGET /api/v1/subscriptions/upcoming-renewals– Get upcoming renewals (static demo)
POST /api/v1/workflows/– Trigger reminder workflow using Upstash
This project is licensed under the MIT License.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.