This project is a REST API template built using NestJS. It utilizes MongoDB for the database, Redis for caching, and HashiCorp Vault for secure secrets management. The project is containerized using Docker and orchestrated with Docker Compose to ensure easy setup and consistent running environments.
Before you begin, ensure you have the following installed:
- Docker
- Docker Compose
-
Start the Services: Run the following command to start all components (MongoDB, Redis, HashiCorp Vault) locally:
docker-compose up -d
-
Access HashiCorp Vault:
- Once
docker-compose
has completed, open your browser and navigate tohttp://localhost:8200
. - Log in using the token defined in the
docker-compose.yml
file, which in our case it myroot.
- Once
- Add a New Secret:
After setting up the Vault, you can start the NestJS application by running:
npm run start:dev
In order to start working with the API, you need to add the following environment variables to your .env
file:
VAULT_TOKEN=myroot
VAULT_ADDRESS=http://localhost:8200
VAULT_PREFIX_PATH=secret/data/demo_api
In case of changing values, you may also need to update the docker-compose.yml file.
- Add support for Redis with fallback to in-memory cache.
- Base schema with mini repository pattern.
- Add support for Swagger.
- Add support for unit testing.
- Add support for integration testing.
- Add support for global exception handling.
- Add support for custom exceptions.
- Add support for logging.
- Add support for DTOs to entities mapping.
- Pulling core to a separate package, such as the Redis module, Database access, etc.
- Add support for Docker.
- Add eslint rules.
- Add prettier rules.
- Add support for Git Husky.