Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tech-warriors-corporation/harvtech-platform-api
The API to manage communication between other services in HarvTech.
https://github.com/tech-warriors-corporation/harvtech-platform-api
api commitlint cors eslint husky jest koajs nodejs postgresql prettier typescript
Last synced: 2 months ago
JSON representation
The API to manage communication between other services in HarvTech.
- Host: GitHub
- URL: https://github.com/tech-warriors-corporation/harvtech-platform-api
- Owner: tech-warriors-corporation
- License: cc0-1.0
- Created: 2024-04-29T22:40:47.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-09-12T23:20:23.000Z (3 months ago)
- Last Synced: 2024-10-02T06:05:22.274Z (3 months ago)
- Topics: api, commitlint, cors, eslint, husky, jest, koajs, nodejs, postgresql, prettier, typescript
- Language: TypeScript
- Homepage: https://harvtech-platform-api.onrender.com
- Size: 838 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
HarvTech (API platform)
The API to manage communication between other services in HarvTech.
## Install prerequisites
1. [NodeJS and NPM](https://nodejs.org/en/download).
2. [Yarn](https://classic.yarnpkg.com/lang/en/docs/install).## Setup project
Follow all commands bellow.### Environment
Create **.env** file in **root** folder with content.
```
WEB_URL=
AI_URL=
JWT_SECRET=
JWT_EXPIRES=
AZURE_ACCOUNT_NAME=
AZURE_ACCOUNT_KEY=
AZURE_STORAGE_CONTAINER_URL=
DB_HOST=
DB_DOCKER_PORT=
DB_PORT=
DB_NAME=
DB_USERNAME=
DB_PASSWORD=
CRYPTO_ALGORITHM=
CRYPTO_KEY=
CRYPTO_IV=
PORT=
MODE=
```### Install packages
```
yarn
```### Active Husky hooks (if not automatically configured)
```
yarn prepare
```### Database in Docker
```
yarn db
```### Development
```
yarn dev
```### Production
```
yarn prod:build && yarn prod:start
```### Tests
Our tests are made with [Jest](https://jestjs.io). Use `*.test.ts` for integration tests and `*.spec.ts` for unit tests. Run the commands below.#### Default
```
yarn test
```#### Watch
```
yarn test:watch
```#### Quiet
```
yarn test:quiet
```#### Coverage
```
yarn test:coverage
```### Migrations (TypeORM):
In this project we use [TypeORM](https://typeorm.io) for migrations. Run the commands below.#### Run
```
yarn migration:run
```#### Generate
```
yarn migration:generate src/migrations/
```#### Synchronize
```
yarn schema:sync
```## Setup JetBrains (IDE)
### Configure Lint
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](https://www.jetbrains.com/help/webstorm/eslint.html).### Configure Prettier
Go to `File > Settings > Languages & Frameworks > JavaScript > Prettier`, check **On 'Reformat Code' action** and check **On save**, or read the [Prettier documentation for WebStorm](https://www.jetbrains.com/help/webstorm/prettier.html).## Lint
Run commands:### Check
```
yarn lint
```### Fix
```
yarn lint:fix
```## Prettier
Run commands:### Check
```
yarn prettier
```### Fix
```
yarn prettier:fix
```## Format code
```
yarn format
```## File patterns
You should be very specific in file names.## Roadmap
- [X] Add [Axios](https://axios-http.com).
- [X] Add [Jest](https://jestjs.io).
- [X] Study about [Azure SDK for JS](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob/samples/v12/typescript).
- [X] Review code in `review` directory.
- [X] Config project.
- [X] Add coverage code.
- [X] Review project.
- [X] Storage in Danilo's Azure.
- [X] Add [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) and test it.
- [X] Add [PostgreSQL](https://www.postgresql.org).
- [X] Use [Crypto](https://www.w3schools.com/nodejs/ref_crypto.asp) from NodeJS with algorithm AES-256-CTR.
- [X] Add [JWT](https://jwt.io) to authenticate requests.
- [X] Use an ORM for PostgreSQL.
- [ ] Add a logger.
- [X] Protect passwords with a pattern with numbers, chars and symbols, use minlength too.
- [X] Add test in CI/CD.
- [X] Add environment variables in Cloud.
- [X] Protect routes with token.
- [X] UUID to avoid sequential ids.
- [X] Render or Neon for PostgreSQL.
- [ ] Remove TODO comments.
- [ ] Coverage badge in this `README.md`.
- [X] Study about [TypeORM](https://typeorm.io).
- [ ] Add header with secret key for validate request to AI.
- [ ] Make the code more agnostic of framework, library and other tools.
- [X] Validate our requests with access token.
- [ ] Protect routes with account types.
- [X] Create `SanitizeHelper` for entries.
- [X] Maybe use Bcrypt.
- [X] Add health check.
- [ ] Verify user quantities and cultive quantities by account plan.
- [X] Run OWASP ZAP test.## Thanks for read
Product made by **[Tech Warriors](https://github.com/tech-warriors-corporation)**.