To this project the database used is PostgreSQL in Docker container.
yarn format
ornpm run format
: run Prettier to format all code (using settings defined in.prettierrc
file);yarn dev
ornpm run dev
: run the localhost server;yarn lint
ornpm run lint
: to run the ESLint in your terminal;yarn lint:fix
ornpm run lint:fix
: to run the ESLint and fix the issues;yarn typeorm
ornpm run typeorm
: to run the TypeORM to run or create migrations (for example).
I have some changes in my project, like:
- I use Joi to validation fields in requests (body, params or query), and create 3 middlewares:
- to validate fields in body (
req.body
); - to validate params (
req.params
); - to validate query params (
req.query
).
- to validate fields in body (
- Create most of the interfaces in
src/interfaces
folder, and start all files withI
(to represent the interface); - Use
.env
file to storage environment variables; - Create the
src/config/environment.ts
file to export objects with.env
variables; - Create class
JoiError
to format the errors from Joi validation; - Create enum (in
src/enums/
and starts withE
to represent the enum) to storage the most strings texts to Joi validations; - Create middlewares to Joi Validation (
shared/middlewares/joiValidation.ts
); - I don't create configs to AWS S3;
- Use
rimraf
package to deletedist/
folder before Babel create build; - I don't create the JEST tests, I leave that to ToDo work.
-
To run production mode (
yarn start
- files indist/
folder) you need change theormconfig.json
to:{ "type": "postgres", "host": "localhost", "port": "5432", "username": "user", "password": "password", "database": "database", "synchronize": true, "entities": ["dist/modules/**/typeorm/entities/*.js"], "migrations": ["dist/shared/typeorm/migrations/*.js"], "cli": { "entitiesDir": "dist/modules /**/typeorm/entities", "migrationsDir": "./dist/shared/typeorm/migrations" } }
- Swagger Documentation
- Wiki in GitHub
- Use JEST tests
- Email Template (I use to create the forgot password email);