A simple nestjs boilerplate that includes the basic and curcial features to help start your project quickly.
- Mongoose
- Config Service
- Swagger
- Authentication
- Access Control (CASL)
- Pagination Middleware
- Refresh and Access tokens
- Unit testing and E2E testing
- Seeder
- Github actions
- Docker
- K8S
To get a local copy up and running follow these steps.
-
Click on use template and click new repository.
-
Navigate to the project directory.
cd <repository_directory>
-
Create a
.env
file and populate it with the required environment variables provided in the.env.example
file. -
Install the dependencies.
npm install
To start the development server, run the following command:
npm run dev
To start unit testing, run the following command:
npm run test
and to run E2E tests:
npm run test:e2e
to run the seeder ts-node the seed.ts file and you can pass how many data to generate as a arguement:
ts-node seed.ts 50
to run the Dockerfile:
docker compose up -d
to run the K8S, navigate to k8s directory and run:
kubectl apply -f backend-config.yaml
kubectl apply -f backend-deployment.yaml
kubectl apply -f mongodb-deployment.yaml
ps: make sure you have a k8s cluster running, I use minikube.
The server should now be running at http://localhost:<port>
. You can access the endpoints using a tool like Postman or any web browser.
Author Lhon Rafaat.