This is the Inga Service
This section will guide you through the setup process required to get up and running with the application.
-
Node (Version >= 18.16.1)
-
NPM (optional yarn) (Version >= 8.3.0)
-
Redis
-
Mysql (Version >= 8.0)
-
TypeScript (
npm install -g typescript||yarn global add typescript)
-
Clone the project from your account repository.
-
Run
npm installoryarn installfrom the root directory of the project -
Create a
.envfile and copy the content of.env.exampleto it.
-
Run
mkdir ./keysto create the keys folder. -
Run
openssl genrsa -out ./keys/oauth-private.key 2048to generate an oauth private key. -
Run
openssl rsa -pubout -in ./keys/oauth-private.key -out ./keys/oauth-public.keyto generate a corresponding oauth public key
-
Create a new database in mysql
-
Fill the
.envfile you created with the database credentials -
Run
npm run db:migrateto create the tables, You can runnpm run db:migrate:undoto undo the last migration ornpm run db:migrate:undo:allto undo all migrations -
Run
npm run db:seed:allto populate tables with needed data
- Install docker on the machine
- docker pull darthsim/imgproxy:latest
- docker run --env IMGPROXY_KEY=xxx --env IMGPROXY_SALT=xxx -p 8001:8080 -it darthsim/imgproxy
To run the application, use the command: npm run start:dev
It is important to set up environment variables for the system to function properly
Sometimes, it's necessary to send logs to the stdout or store them, to do this, make use of the exported logger
You can log errors based on their levels:
-
error
-
warn
-
info
-
verbose
-
debug
-
silly
Example: logger.error('You just committed a crime!')
Ensure you avoid using console.log statements anywhere in the code.
Ensure you have eslint and prettier set up on your development environment. Ensure you follow proper linting rules as well.
- To contribute, checkout to the
mainbranch (this is the stable branch) first and rungit pullto sync changes on the repo with what you have locally. - Checkout to your work branch. Your work branch should prefix either
feat_,fix_,refactor_along with not more than 6 words description of the task. eg.feat_update-user-login-response. Your task should be implemented on this branch - Your commits should concisely and accurately state what you worked on. examples are:
- feat: add user organization to login response
- fix: fix bug for login email notification
- chore: Update npm dependency for express
- Link to information about the git workflow here
NOTE: Push to the remote repository as frequent as possible at least before calling it a day to avoid possible issues of losing what has been worked on
- Once done with task, raise a pull request(PR) against the main branch and add a reviewer. DO NOT MERGE till it's reviewed
- After review is done and PR is approved, create another PR against the
stagingbranch and merge that. The PR against the main branch should still be open at this point. The essence of merging to the staging branch is for QA before the task goes to production - After QA is done and task is approved as ready for production on the staging environment, go ahead and
squash mergeyour branch into themainbranch. - Open a PR from the
mainbranch against theproductionbranch. With the PR title in this formatDeployment to Production - [YYYY-MM-DD]. eg.Deployment to production - 2022-01-30. - Inform the dev-ops team to deploy! Hurray you've deployed your task
- Link to information about the directory structure here
- Link to information about the code standard here
- Link to a guide on the architecture here
- Link to database diagram here
We're using Prettier and ESLint to keep code clean. In order to reformat/check code run:
npm run lint
npm run prettier