SubTrack is a robust backend system built with Express.js to manage and track subscriptions. The project features a "Smart Notification Engine" powered by Upstash Workflow, which handles renewal monitoring and automated email alerts to users.
- Server: Express.js (Node.js)
- Database: PostgreSQL (via Neon DB)
- ORM: Prisma
- Workflow & Automation: Upstash Workflow
- Validation: Zod
- Security: Arcjet (Bot detection, Rate limiting, Shield)
- Emailing: Nodemailer
- Date Handling: Day.js
- Environment Management: Dotenv
- ✅ Subscription Management API: Full CRUD operations for managing user subscriptions.
- ⏳ Automated Workflows: Intelligent notification system that triggers emails 7, 5, 2, and 1 day(s) before renewal using background workflows.
- 🛡️ Security-First Approach: Integrated Arcjet middleware to protect routes from malicious bots and implement sophisticated rate limiting.
- 🔍 Schema Validation: Comprehensive use of Zod to validate request bodies and ensure data integrity across the API.
- 📧 Professional Reminders: Dynamically generated HTML emails via Nodemailer to notify users about upcoming charges.
- 🔄 Event-Driven Architecture: Leverages Upstash Workflow to manage long-running processes (waiting for dates) without blocking the main event loop.
The API is designed with a clear separation of concerns:
- Middleware Layer: Handles security (Arcjet), authentication, and logging.
- Validation Layer: Uses Zod schemas to intercept and validate payloads before they reach the controllers.
- Controller Layer: Manages business logic and interacts with the database via Prisma.
- Workflow Layer: Integrated Upstash Workflow to handle the asynchronous "wait-and-trigger" logic for notifications.
Follow these steps to set up and run the server locally:
git clone [https://github.com/HussamMAhmad/subscription-tracker-api.git](https://github.com/HussamMAhmad/subscription-tracker-api.git)
cd subscription-tracker-api