The application is containerized using Docker, with services orchestrated via Docker Compose. This ensures consistent deployment across different environments.
⚠️ Security Note: This approach should be used only in development mode. For production, please use the implementation in the master-prod branch.
- RESTful API service built with Express.js
- MongoDB integration for data persistence
- Prometheus metrics instrumentation
- Structured logging with Winston
- User interface built with React
- Axios for API communication
- Served via Nginx
- NoSQL database for storing application data
- Initial data seeding through init script
- Prometheus: Metrics collection and storage
- Grafana: Visualization and dashboarding
- Loki: Log aggregation and storage
- Promtail: Log collection agent
- cAdvisor: Container metrics collection
- Node Exporter: Host system metrics collection
- Docker and Docker Compose
- Git
- Clone the repository
git clone https://github.com/TheArtifulProgrammer/nodejs-monitoring-grafana-prometheus
cd nodejs-monitoring-grafana-prometheus
- Install dependencies
npm install
- Run with Docker Compose
docker-compose up -d
- Node.js API: http://localhost:3000
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3001
The application includes:
- Custom metrics endpoints
- Default Node.js metrics
- HTTP request metrics
- System resource metrics
Configuration files can be found in:
/config
- Application configuration/prometheus
- Prometheus configuration/grafana
- Grafana dashboards
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
- Add more custom metrics
- Implement alert rules
- Add more detailed dashboards
- Include logging integration
- Add trace sampling
Munashe Chinake https://theartfulprogrammer.com/
This project is licensed under the MIT License
- Prometheus team
- Grafana team
- Node.js community