The structure of this project aims to structure the code based on components. Instead of repeating the name of the component in a folder of controllers or domain, each component is composed of its own entity, routes, controller, services, repository, test, among other files.
Each component has its providers file to avoid contact with the other files from the outside. Anyone who requires a file of its component should request it from the *.providers.ts file.
This project follows the DDD architecture and simulates the behavior of microservices.
The dependencies are managed by a container (IoC) to have a low or no coupling.
- 🔗 NodeJS >=12.6.0
- 🔗 ExpressJS
- 🔗 TypeScript
- 🔗 TYPEORM
- 🔗 PostgreSQL
- 🔗 Jest
This API is consumed by the Pokedex hosted in the following repository: Pokedex
- Clone
- Move to -->
cd pokedex-api
- copy
.example.env
to.env
- Run
npm install
- Be sure to create your Postgres database.
PORT
: The port used by the application to expose itself. Default -->2302
PREFIX_ROUTES
: Prefix that routes use. Default -->/api/v1
DB_HOST
: Database address. Default -->localhost
POSTGRES_USER
: Database user.POSTGRES_PASSWORD
Database pass.POSTGRES_DB
: The database name used by the application.TOKEN_EXPIRE
: When authentication tokens expire. default -->72h
SECRET
: Secret word to generate authentication tokens. default -->secret-pokedex-api
SMTP_EMAIL
: Your GMAIL email to send emails. example -->pokedex@gmail.com
SMTP_PASSWORD
: Password of your GMAIL email.AGENT_CLIENT_URI
: Base URL of your Frontend client. default -->http://localhost:3000
Run npm run watch
✔️
The first registered user is assigned the ROLE = OWNER, this will have special permissions in all its pokedex, according to the requirements.
- Update, Delete, Disable, List and view users.
- Update, Delete, Disable, List and view pokedex.
- If the OWNER deletes a user or pokedex, all data related to it is deleted.
User passwords have a small layer of additional validation to avoid the use of common or highly insecure passwords.
You can see this list of common passwords in
src/infrastructure/utils/commonPasswords.txt
You can add more passwords or delete from this file.
To contribute to this repo you must consider the following:
- 🔗 Use Conventional Commits
- Consider the use of dependencies well.
- Read about Node JS Best Practices.
- Follow the architecture that takes the project.
- 🔗 Use Git Flow
If he came this far it is because we are ready. ✔️
You can consult the Documentation at this URL: