A comprehensive subscription management and monitoring service built with Node.js and Express, featuring advanced multi-window email reminders and intelligent tracking.
- π User authentication with JWT
- π³ Subscription management (CRUD operations)
- Subscription statistics and analytics
- π Secure password hashing with bcrypt
- ποΈ MongoDB database integration
- π¨ Professional static frontend with clean, minimalist design
- π§ Multi-window reminders - 4 reminder emails per subscription (7d, 3d, 1d, 0d)
- π¨ Color-coded urgency - Visual indicators based on renewal proximity
- π Reminder history tracking - Prevents duplicate emails, maintains audit trail
- π° Cost projections - Monthly and yearly cost forecasts in emails
- π± Responsive email templates - Beautiful designs optimized for all devices
- β‘ Batch processing - Intelligent rate limiting for scalability
- π Email analytics - Track delivery rates and success metrics
- β° 3 automated cron jobs:
- Daily reminders (9:00 AM)
- Overdue checks (10:00 AM)
- Weekly log cleanup (Sunday 2:00 AM)
- π Clean URLs - No
.htmlextensions (e.g.,/dashboardinstead of/dashboard.html) - π Fast navigation - Automatic redirects with proper status codes
Backend:
- Framework: Node.js, Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT (JSON Web Tokens)
- Security: bcrypt for password hashing
- Email: Nodemailer with Gmail
- Scheduling: node-cron
- Environment: dotenv
Frontend:
- HTML5 - Semantic markup
- CSS3 - Modern styling with CSS variables
- Vanilla JavaScript - No frameworks, pure ES6+
- Responsive Design - Mobile, tablet, desktop support
subsentry/
βββ src/
β βββ controllers/ # Request handlers
β β βββ authController.js
β β βββ subscriptionController.js
β βββ models/ # Database models
β β βββ User.js
β β βββ Subscription.js
β β βββ ReminderLog.js # NEW: Email tracking
β βββ routes/ # API routes
β β βββ authRoutes.js
β β βββ subscriptionRoutes.js
β βββ middleware/ # Custom middleware
β β βββ auth.js
β β βββ errorHandler.js
β β βββ logger.js
β βββ utils/ # Utility functions
β β βββ database.js
β β βββ emailService.js
β β βββ validators.js
β βββ cron/ # Scheduled jobs
β β βββ index.js # NEW: Job scheduler
β β βββ reminderJob.js # ENHANCED: Advanced reminders
β βββ index.js # Application entry point (+ Clean URL middleware)
βββ public/ # Static frontend
β βββ index.html # Login/Register page
β βββ dashboard.html # Main dashboard
β βββ subscription-form.html # Add/Edit form
β βββ styles.css # Global styles
β βββ main.js # Frontend JavaScript (Clean URLs)
β βββ README.md # Frontend documentation
βββ docs/ # Documentation
β βββ MONGODB_SETUP.md
β βββ API_TESTING.md
β βββ MIGRATION_SUMMARY.md
β βββ CRON_JOBS.md
β βββ ADVANCED_FEATURES.md # NEW: v2.0 features
β βββ UPGRADE_SUMMARY.md # NEW: v2.0 changes
β βββ TESTING_CRON_JOB.md
βββ database/ # Database scripts (deprecated)
β βββ schema.sql
β βββ seed.sql
βββ .env.example # Environment variables template
βββ .gitignore
βββ package.json
βββ README.md
-
Clone the repository
git clone <repository-url> cd SubSentry
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env
Then edit
.envwith your configuration:MONGODB_URI: Your MongoDB connection string (e.g.,mongodb://localhost:27017/subsentry)JWT_SECRET: A secure random string for JWT signingGMAIL: Your Gmail addressAPP_PASS: Your Gmail app-specific password
-
Set up MongoDB
See docs/MONGODB_SETUP.md for detailed instructions.
Quick Start (Local MongoDB):
# Install MongoDB (if not already installed) # See MONGODB_SETUP.md for OS-specific instructions # Start MongoDB service # Linux/macOS: sudo systemctl start mongod # Windows: net start MongoDB # Docker: docker run -d -p 27017:27017 --name subsentry-mongodb mongo
The database and collections will be created automatically when you start the application.
-
Start the server
# Development mode with auto-restart npm run dev # Production mode npm start
-
Access the application
Frontend: http://localhost:3000 Dashboard: http://localhost:3000/dashboard (Clean URL - no .html) API: http://localhost:3000/api Health Check: http://localhost:3000/health
Subscriptions now trigger 4 reminder emails at strategic intervals:
- π 7 days before - Early warning (Blue)
- π 3 days before - Get ready (Orange)
- β° 1 day before - Last chance (Yellow)
β οΈ Same day - Urgent action (Red)
- β Duplicate prevention - Won't send same reminder twice
- β Batch processing - Handles thousands of subscriptions efficiently
- β Cost projections - Shows monthly/yearly costs in emails
- β Reminder tracking - Complete audit trail of all sent emails
- β
Clean URLs - Professional paths without
.htmlextensions
- Overdue Check (10:00 AM daily) - Flags past-due subscriptions
- Log Cleanup (2:00 AM Sundays) - Removes logs older than 90 days
See ADVANCED_FEATURES.md for complete details.
- Open
http://localhost:3000in your browser - Click "Sign Up" to create an account
- Log in with your credentials
- Add your first subscription
- View statistics and manage subscriptions
- Clean Dashboard - View all subscriptions at a glance
- Statistics Cards - See total cost, average, and next renewal
- Add/Edit Subscriptions - Simple forms for managing data
- Responsive Design - Works on mobile, tablet, and desktop
- Professional UI - Enterprise-grade design inspired by Microsoft and Webflow
For detailed frontend documentation, see public/README.md
POST /api/auth/register- Register a new userPOST /api/auth/login- Login userGET /api/auth/profile- Get user profile (protected)PUT /api/auth/profile- Update user profile (protected)POST /api/auth/logout- Logout user (protected)
POST /api/subscriptions- Create a new subscription (protected)GET /api/subscriptions- Get all user subscriptions (protected)GET /api/subscriptions/:id- Get subscription by ID (protected)PUT /api/subscriptions/:id- Update subscription (protected)DELETE /api/subscriptions/:id- Delete subscription (protected)GET /api/subscriptions/stats/summary- Get subscription statistics (protected)
GET /health- Check API status
To use Gmail for sending emails:
- Enable 2-Factor Authentication on your Google Account
- Generate an App Password:
- Go to Google Account β Security β 2-Step Verification β App passwords
- Create a new app password for "Mail"
- Use this password in your
APP_PASSenvironment variable
The application includes automated cron jobs for email reminders:
- Subscription Reminders (9:00 AM daily): Sends email reminders for subscriptions based on their
reminder_offset_dayssetting
Features:
- Queries subscriptions using MongoDB with
renewal_datewithin reminder window - Sends beautiful HTML emails via nodemailer
- Per-subscription error handling (one failure doesn't stop others)
- Configurable schedule and timezone
- Detailed logging for monitoring
Configuration:
- Set
CRON_ENABLED=truein.envto enable - Set
CRON_ENABLED=falseto disable all cron jobs - Configure Gmail settings (
EMAIL_USER,EMAIL_PASS, etc.)
Documentation: See docs/CRON_JOBS.md for detailed implementation guide, customization options, and troubleshooting.
# Install development dependencies
npm install --save-dev nodemon
# Run in development mode with auto-reload
npm run dev- Always use HTTPS in production
- Keep JWT_SECRET secure and never commit it to version control
- Use strong passwords and enable rate limiting
- Regularly update dependencies
- Use environment variables for sensitive data
- Implement proper input validation and sanitization
ISC
Contributions are welcome! Please feel free to submit a Pull Request.