- Finance Tracker API
A comprehensive API designed to manage and track personal finances. This API includes features for user authentication, transaction management, budget tracking, goal setting, and real-time notifications. It is built with Node.js, Express, MongoDB, and Redis.
Important
The Docker Production Image is available for use at: GitHub Container Registry.
For detailed deployment instructions, please refer to the Production Deployment section.
- User Management: Register, authenticate, and manage user data.
- Transaction Tracking: Log and track financial transactions.
- Budget Management: Create and manage financial budgets.
- Goal Tracking: Set and monitor progress toward financial goals.
- Notifications: Notifications about spending patterns, deadlines, and goals.
- Automate Jobs
- Data Caching (Redis)
- Email Handling
- Express - Minimalist web framework for Node.js.
- Mongoose - ODM for MongoDB.
- Bcryptjs - Library to hash passwords.
- Axios,Axios-Retry - Promise-based HTTP client.
- JWT - Library for generating JSON Web Tokens.
- Pino, Pino-Http, Pino-Pretty - JSON logger.
- Http-Status-Codes - HTTP status code constants.
- Ioredis - Redis client for Node.js.
- Nodemailer + MailTrap - Email Handling.
- Croner - Job Scheduling.
Note
The production Docker image uses Chainguard Images, a secure, minimal container image for better security and a lower attack surface.
Trivy Vulnerability Scanning is integrated into the GitHub Actions to scan for vulnerabilities in the Docker image before deployment.
- Authentication & Authorization β Uses JWT for secure authentication and bcryptjs for password hashing.
- Input Validation & Sanitization β Implements express-mongo-sanitize to prevent NoSQL injections and helmet for security headers.
- Rate Limiting & Logging β Uses express-rate-limit to prevent abuse and Pino for high-performance logging.
- Testing & Mocking β Includes Chai, Mocha, and Nock for API testing.
Tip
The full API documentation can be found here π documenter.getpostman.com/view/33227780/2sAYdoF7xS
- Health Check:
/api/{API_VERSION}/health- Check server status - User Routes:
/api/{API_VERSION}/user- User registration and authentication - Transaction Routes:
/api/{API_VERSION}/transaction- Manage transactions - Budget Routes:
/api/{API_VERSION}/budget- Budget management - Goal Routes:
/api/{API_VERSION}/goal- Set and track financial goals - Notification Routes:
/api/{API_VERSION}/notification- Real-time notifications - Analytics & Reports routes:
/api/{API_VERSION}/analytics- Reports
- Node.js
- Docker
git clone https://github.com/nmdra/Finance-Tracker-API.git
cd Finance-Tracker-APICreate a .env file in the root directory based on .env.example
DB_USERNAME=yourMongoDBUsername
DB_PASSWORD=yourMongoDBPassword
API_VERSION=v1Get Exchange-API Key : https://www.exchangerate-api.com/
To start the application in development mode:
docker-compose upThis will start the API Service, MongoDB, Redis, and the MongoDB Dashboard.
- app: Node.js application container
- db: MongoDB database container
- db-dashboard: MongoDB Express dashboard for managing the database
- redis: Redis cache for the application
Run following command after running docker compose up:
docker compose exec app npm testThe production-ready Docker image for Finance Tracker API is available on GitHub Packages:
π¦ Docker Image: GitHub Container Registry
A production-ready Docker Compose file is available:
π File: ./docker-compose-prod.yml
docker-compose -f docker-compose-prod.yml up -ddocker-compose -f docker-compose-prod.yml downVerify that the API is running by checking the health check endpoint:
curl http://localhost:5000/api/v1/healthExpected Response:
{
"service": "Finance API",
"status": "healthy",
"timestamp": "2025-03-10T05:05:11.017Z"
}To check the logs of your running container:
docker logs -f finance-apiFor debugging a running container:
docker exec -it finance-api sh