Ping Pilot Server is a backend application designed to support a health check and monitoring system. It allows users to monitor the performance, uptime, and load time of specific endpoints. Built with NestJS, it provides a scalable and maintainable architecture for managing monitoring tasks.
- Endpoint Monitoring: Collects and monitors user-defined endpoints for performance, uptime, and load time.
- User Management: Supports roles and users for managing access and monitoring configurations.
- Database Integration: Uses PostgreSQL for storing monitoring data.
- Queue Management: Integrates BullMQ for scheduling and processing monitoring tasks.
- Docker Support: Includes Docker Compose for easy setup of dependencies like PostgreSQL and Redis.
- Extensive Testing: Includes unit and end-to-end tests for ensuring code quality.
- Interactive API Documentation: Swagger UI is available for exploring and testing API endpoints.
- NestJS: A progressive Node.js framework for building efficient and scalable server-side applications.
- TypeORM: An ORM for managing database interactions.
- PostgreSQL: A powerful, open-source relational database.
- Redis: A fast, in-memory data structure store used for queue management.
- BullMQ: A Node.js library for handling job queues.
- Docker: For containerizing services and dependencies.
- Husky & lint-staged: For enforcing code quality with Git hooks.
Before you begin, ensure you have the following installed on your machine:
- Node.js (LTS version recommended)
- npm (comes with Node.js)
- Docker Desktop (for running
docker-compose)
-
Clone the repository:
git clone <repository-url> cd ping-pilot-server
-
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.envfile in the root directory. - Add the necessary environment variables (e.g., database connection details, Redis configuration). Refer to
configuration/for hints.
- Create a
-
Install Husky for Git hooks:
npx husky install
-
Start Docker services:
docker-compose up -d
-
Run database seeders:
npm run seed
-
Start the server in development mode:
npm run start:dev
-
Access the server at
http://<process.env.HOST>:<process.env.PORT>.
To ensure everything is working as expected, run the tests:
-
Unit tests:
npm run test -
End-to-end tests:
npm run test:e2e
Swagger UI is available for exploring and testing API endpoints. After starting the server, access the documentation at:
http://<process.env.HOST>:<process.env.PORT>/api-docs
ping-pilot-server/
├── src/
│ ├── app.controller.ts # Main application controller
│ ├── app.service.ts # Main application service
│ ├── app.module.ts # Root module
│ ├── main.ts # Application entry point
│ ├── configuration/ # Configuration files
│ ├── database/ # Seeders and factories
│ ├── model/ # Database models
│ └── test/ # Test files
├── docker-compose.yml # Docker Compose configuration
├── package.json # Project metadata and dependencies
├── README.md # Project documentation
└── tsconfig.json # TypeScript configuration
Ensure you are using the latest versions of Node.js and npm to avoid compatibility issues. You can update them using the following commands:
# Update Node.js to the latest version (requires nvm)
nvm install node
# Use the recently installed version of node
nvm use <versionThatYouJustInstalled>
# Update npm to the latest version
npm install -g npm@latest
Make sure to create a .env file in the root directory of the project. The following variables are required:
HOST
PORTYou can refer to the .env.example file for additional configuration hints.
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature/your-feature). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.