A RESTful API for managing user subscriptions with automated renewal reminders, built with Node.js and Express.
- Sign up, sign in, and sign out functionality
- JWT-based authentication
- Password encryption using bcrypt
- Create, read, update, and delete subscriptions
- Support for different subscription frequencies (daily, weekly, monthly, yearly)
- Multiple currency support (KSH, USD, EUR)
- Automatic renewal date calculation
- Category-based organization
- Email notifications for subscription renewals
- Customizable reminder schedules (10, 5, 2, 1 days before renewal)
- Test reminder functionality
- Rate limiting with Arcjet
- Bot protection
- Input validation
- Error handling middleware
- Backend: Node.js & Express
- Database: MongoDB with Mongoose
- Authentication: JWT
- Email Notifications: Nodemailer
- Scheduled Tasks: Upstash Workflow
- Security: Arcjet
✅ Advanced Rate Limiting and Bot Protection - Secure the app with Arcjet.
✅ Database Modeling - Define models and relationships using MongoDB & Mongoose.
✅ JWT Authentication - Manage users and subscriptions securely.
✅ Global Error Handling - Ensure smooth error management with middleware.
✅ Logging Mechanisms - Improve debugging and monitoring.
✅ Email Reminders - Automate smart email reminders using Upstash.
✅ Code Architecture & Reusability - Maintain clean and scalable code.
POST /api/v1/auth/sign-up- Register a new userPOST /api/v1/auth/sign-in- Log in a userPOST /api/v1/auth/sign-out- Log out a user
GET /api/v1/users- Get all users (admin only)GET /api/v1/users/:id- Get a user by IDPUT /api/v1/users/:id- Update a userDELETE /api/v1/users/:id- Delete a userDELETE /api/v1/users- Delete all users (admin only)
POST /api/v1/subscriptions- Create a subscriptionGET /api/v1/subscriptions- Get all subscriptions (admin only)GET /api/v1/subscriptions/:id- Get a subscription by IDPUT /api/v1/subscriptions/:id- Update a subscriptionDELETE /api/v1/subscriptions/:id- Delete a subscriptionDELETE /api/v1/subscriptions- Delete all subscriptions (admin only)GET /api/v1/subscriptions/user/:id- Get a user's subscriptions
git clone https://github.com/Dennis-DW/Subscription-Management-API.git
cd submanagenpm installCreate .env.development.local and .env.production.local with the following:
NODE_ENV='production'
QSTASH_URL=''
QSTASH_TOKEN=''
QSTASH_CURRENT_SIGNING_KEY=''
QSTASH_NEXT_SIGNING_KEY=''
# Server
PORT=5500
SERVER_URL=''
NODE_ENV=development
# MongoDB Connection
DB_URI=''
# JWT Authentication
JWT_SECRET=''
JWT_EXPIRES_IN=''
# Arcjet Security
ARCJET_KEY=''
ARCJET_ENV='development'
# Upstash
QSTASH_URL='http://127.0.0.1:8080'
QSTASH_TOKEN=''
# Email Configuration
EMAIL_PASSWORD=''
# Admin Credentials
ADMIN_USERNAME=''
ADMIN_PASSWORD=''
ADMIN_KEY=''npm run devnpx @upstash/qstash-cli dev The Upstash QStash development server will run at:
http://127.0.0.1:8080
- Arcjet - Launch Arcjet
- Upstash - Upstash
- Hostinger - Hostinger
- WebStorm - Get WebStorm Free