A production-oriented REST API for invoice management built with Node.js, Express, MongoDB, Docker and Swagger.
Invoice API is a backend service that demonstrates modern REST API development practices.
The application provides full CRUD functionality for invoice management and includes features commonly used in real-world backend systems such as:
- REST API architecture
- MongoDB & Mongoose integration
- Swagger / OpenAPI documentation
- Automated testing with Jest & Supertest
- Docker containerization
- Request logging
- Rate limiting
- Monitoring endpoints
- Centralized error handling
- MVC architecture
The project was built as a portfolio project to showcase backend engineering skills and production-ready API design.
Swagger UI is available after starting the application:
http://localhost:3000/docs| Feature | Description |
|---|---|
| CRUD API | Create, Read, Update and Delete invoices |
| MongoDB | Persistent invoice storage |
| Swagger | Interactive API documentation |
| Docker | Containerized deployment |
| Logging | Centralized request logging |
| Rate Limiting | Basic API protection |
| Monitoring | Health and metrics endpoints |
| Validation | Request validation support |
| Automated Tests | Jest & Supertest integration |
- Node.js
- Express.js
- MongoDB
- Mongoose
- Docker
- Jest
- Supertest
- Swagger / OpenAPI
| Method | Endpoint | Description |
|---|---|---|
| GET | /invoices | Get all invoices |
| GET | /invoices/:id | Get invoice by ID |
| POST | /invoices | Create invoice |
| PUT | /invoices/:id | Update invoice |
| DELETE | /invoices/:id | Delete invoice |
invoice-api/
│
├── controllers/
├── docs/
├── middleware/
├── models/
├── routes/
├── services/
├── swagger/
├── tests/
├── utils/
│
├── Dockerfile
├── package.json
├── index.js
└── README.md
Create a .env file:
PORT=3000
MONGODB_URI=mongodb://127.0.0.1:27017/invoice-api
API_KEY=your_api_key_hereThe repository contains a dedicated .env.test configuration that uses local test values only:
MONGODB_URI=mongodb://localhost:27017/invoice-api-test
PORT=3001
API_KEY=test-api-keyNo production credentials are stored in the repository.
Clone the repository:
git clone https://github.com/tabari86/invoice-api.git
cd invoice-apiInstall dependencies:
npm installDevelopment mode:
npm startApplication runs on:
http://localhost:3000npm testAll API tests are executed using Jest and Supertest.
Build image:
docker build -t invoice-api .Run container:
docker run -p 3000:3000 invoice-apiHealth endpoint:
GET /monitor/healthMetrics endpoint:
GET /monitor/metrics- Rate Limiting
- Centralized Error Handling
- Input Validation
- Request Logging
- API Monitoring
Mojtaba Tabari
Website : https://mtintelligence.ai
LinkedIn : https://www.linkedin.com/in/moj-tabari-04a400227/
