A RESTful API for managing subscription services and tracking renewal dates.
- User authentication and authorization
- CRUD operations for subscriptions
- Subscription status tracking (active, cancelled, expired)
- Upcoming renewal notifications
- Multiple currency support (USD, EUR, GBP)
- Subscription categorization
- Automatic renewal date calculations
- Node.js
- Express.js
- MongoDB with Mongoose
- JWT Authentication
- Node.js (v16 or higher)
- MongoDB
- npm or yarn
- Clone the repository:
git clone https://github.com/yourusername/subscription-tracker-api.git
cd subscription-tracker-api- Install dependencies:
npm install- Create a
.envfile in the root directory:
PORT=3000
MONGODB_URI=mongodb://localhost:27017/subscription-tracker
JWT_SECRET=your_jwt_secret- Start the server:
npm startPOST /api/auth/register- Register a new userPOST /api/auth/login- Login user
GET /api/users- Get all usersGET /api/users/:id- Get user by IDPUT /api/users/:id- Update userDELETE /api/users/:id- Delete user
GET /api/subscriptions- Get all subscriptionsGET /api/subscriptions/:id- Get subscription by IDPOST /api/subscriptions- Create new subscriptionPUT /api/subscriptions/:id- Update subscriptionDELETE /api/subscriptions/:id- Delete subscriptionPUT /api/subscriptions/:id/cancel- Cancel subscriptionGET /api/subscriptions/upcoming-renewals- Get upcoming renewals
{
name: String,
email: String,
password: String
}{
name: String,
price: Number,
currency: String,
frequency: String,
category: String,
paymentMethod: String,
status: String,
startDate: Date,
renewalDate: Date,
user: ObjectId
}Run the test suite:
npm test- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.