The API to manage communication between other services in HarvTech.
Follow all commands bellow.
Create .env file in root folder with content.
WEB_URL=<set Web URL 🔑>
AI_URL=<set AI URL 🔑>
JWT_SECRET=<set JWT secret 🔑>
JWT_EXPIRES=<set JWT expires 🔑>
AZURE_ACCOUNT_NAME=<set Azure account name 🔑>
AZURE_ACCOUNT_KEY=<set Azure account key 🔑>
AZURE_STORAGE_CONTAINER_URL=<set storage container URL 🔑>
DB_HOST=<set database host 🔑>
DB_DOCKER_PORT=<set Docker database port 🔑>
DB_PORT=<set database port 🔑>
DB_NAME=<set database name 🔑>
DB_USERNAME=<set database username 🔑>
DB_PASSWORD=<set database password 🔑>
CRYPTO_ALGORITHM=<set crypto algorithm 🔑>
CRYPTO_KEY=<set crypto key 🔑>
CRYPTO_IV=<set crypto IV 🔑>
PORT=<set port 🔑>
MODE=<set mode 🔑>
yarn
yarn prepare
yarn db
yarn dev
yarn prod:build && yarn prod:start
Our tests are made with Jest. Use *.test.ts
for integration tests and *.spec.ts
for unit tests. Run the commands below.
yarn test
yarn test:watch
yarn test:quiet
yarn test:coverage
In this project we use TypeORM for migrations. Run the commands below.
yarn migration:run
yarn migration:generate src/migrations/<name>
yarn schema:sync
Go to File > Settings > Languages & Frameworks > JavaScript > Code Quality Tools > ESLint
, select Automatic ESLint configuration and check Run eslint --fix on save, or read the ESLint documentation for WebStorm.
Go to File > Settings > Languages & Frameworks > JavaScript > Prettier
, check On 'Reformat Code' action and check On save, or read the Prettier documentation for WebStorm.
Run commands:
yarn lint
yarn lint:fix
Run commands:
yarn prettier
yarn prettier:fix
yarn format
You should be very specific in file names.
- Add Axios.
- Add Jest.
- Study about Azure SDK for JS.
- Review code in
review
directory. - Config project.
- Add coverage code.
- Review project.
- Storage in Danilo's Azure.
- Add CORS and test it.
- Add PostgreSQL.
- Use Crypto from NodeJS with algorithm AES-256-CTR.
- Add JWT to authenticate requests.
- Use an ORM for PostgreSQL.
- Add a logger.
- Protect passwords with a pattern with numbers, chars and symbols, use minlength too.
- Add test in CI/CD.
- Add environment variables in Cloud.
- Protect routes with token.
- UUID to avoid sequential ids.
- Render or Neon for PostgreSQL.
- Remove TODO comments.
- Coverage badge in this
README.md
. - Study about TypeORM.
- Add header with secret key for validate request to AI.
- Make the code more agnostic of framework, library and other tools.
- Validate our requests with access token.
- Protect routes with account types.
- Create
SanitizeHelper
for entries. - Maybe use Bcrypt.
- Add health check.
- Verify user quantities and cultive quantities by account plan.
Product made by Tech Warriors.