NodeJs api template made using some important principles of clean architecture. This template also has some pre-configured features:
- Docker.
- Prisma (PostgreSQL by default).
- Routing with Fastify.
- Testing with Vitest (Unit and E2E).
- JWT authentication with role-based verification.
- GitHub workflows to run unit tests on pushes and e2e tests on pull requests.
-
Clone the repository:
git clone https://github.com/SamuelB7/nodejs-clean-architecture-api.git cd nodejs-clean-architecture-api
-
Copy the
.env.example
to.env
and configure your environment variables:cp .env.example .env
-
Install dependencies:
npm install
-
Make sure to have Docker Compose installed on your machine.
-
Start the Docker containers:
sudo docker compose up
-
Run database migrations:
npm run prisma:migrate:deploy
To start the server in development mode, without docker run:
npm run start:dev
The server will be running at http://localhost:3000
After starting the application, go to http://localhost:3000/documentation to check the documentation of the api endpoints
This project is licensed under the MIT License
For any inquiries, please contact [email protected]