This project is a Charging Station API built using NestJS.
- Docker and Docker Compose installed on your machine.
- Redis installed on your machine (for running locally without Docker Redis instance on docker also works).
- Node.js and npm (for running locally without Docker).
The application relies on the following environment variables:
As this is a test, the environment variables are hardcoded in the docker-compose.yml file. In a real-world scenario, these should be stored in a .env file.
MONGODB_CONNECTION_STRING: Connection string for MongoDB.
MONGODB_DATABASE: MongoDB database name.
REDIS_URL: Redis connection URL.
-
Clone the repository:
git clone https://github.com/pietro-rutzen/charging-station-api cd charging-station-api -
Build and start the services
docker-compose up --build -
Access the API
The API will be running at
http://localhost:3000for usage.You can access the Swagger documentation at
http://localhost:3000/docsto know more about the endpoints. -
Running tests
To run the tests, please run this:
npm run test -
Running load tests
Load tests are powered by Artillery and can be run using the following command:
npm run load:testYou can fine tune the duration and intensity of the load tests by modifying the
load-test.ymlfile. Bear in mind that we are using a real world MongoDB instance for the load tests, so please be mindful of the number of requests you are making.