Hi, I hope you like this project, I wanted to show you how to implement a clean architecture for a NodeJs API using Express.
- Clone the project.
- Copy
.env.example
to.env
- Set env variables accordingly.
- Run
npm i
in the project directory. - Run
npm start:watch
to run the service in dev mode. - Run
npm run test
for running the unit tests.
GET /api/employees
Headers:
Authorzation: <JWT token>
POST /api/employees
Headers:
Authorzation: <JWT token>
Body:
{
"name": "Jose",
"email": "jose@gmail.com"
}
- Singleton
- Repository
- Decorator
- Dependency injection
- SOLID principles
I build this project from the scratch and I believe there are some improvements that I need to do.
-
Improve unit testing for other layers like data, infra, domain, etc. I just implemented unit tests for the routes just to make sure everything works as expected.
-
Add Input validations.
-
Docker implementtion for deployment.
-
Add layer for graphql compatibility
-
Add endpoints to generate JWT tokens
-
Implement Swagger for API doc.
Some lines are not covered due I didn't implement an endpoint to generate a JWT, but it's almost 100% covered.