Skip to content

Ubaydah/inga

Repository files navigation

Inga (Express 4.17)

This is the Inga Service

Setup

This section will guide you through the setup process required to get up and running with the application.

Requirements

  • 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)

Get Started

  1. Clone the project from your account repository.

  2. Run npm install or yarn install from the root directory of the project

  3. Create a .env file and copy the content of .env.example to it.

Generating Oauth Keys for JWT

  1. Run mkdir ./keys to create the keys folder.

  2. Run openssl genrsa -out ./keys/oauth-private.key 2048 to generate an oauth private key.

  3. Run openssl rsa -pubout -in ./keys/oauth-private.key -out ./keys/oauth-public.key to generate a corresponding oauth public key

Database Setup

  1. Create a new database in mysql

  2. Fill the .env file you created with the database credentials

  3. Run npm run db:migrate to create the tables, You can run npm run db:migrate:undo to undo the last migration or npm run db:migrate:undo:all to undo all migrations

  4. Run npm run db:seed:all to populate tables with needed data

Setting up ImgProxy Server

  1. Install docker on the machine
  2. docker pull darthsim/imgproxy:latest
  3. docker run --env IMGPROXY_KEY=xxx --env IMGPROXY_SALT=xxx -p 8001:8080 -it darthsim/imgproxy

Development

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

Logging

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.

Environment

Ensure you have eslint and prettier set up on your development environment. Ensure you follow proper linting rules as well.

Debugging

Contributing

  1. To contribute, checkout to the main branch (this is the stable branch) first and run git pull to sync changes on the repo with what you have locally.
  2. 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
  3. 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
  1. 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

  1. Once done with task, raise a pull request(PR) against the main branch and add a reviewer. DO NOT MERGE till it's reviewed
  2. After review is done and PR is approved, create another PR against the staging branch 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
  3. After QA is done and task is approved as ready for production on the staging environment, go ahead and squash merge your branch into the main branch.
  4. Open a PR from the main branch against the production branch. With the PR title in this format Deployment to Production - [YYYY-MM-DD]. eg. Deployment to production - 2022-01-30.
  5. Inform the dev-ops team to deploy! Hurray you've deployed your task

Architecture, Code Standard and Directory Structure

  1. Link to information about the directory structure here
  2. Link to information about the code standard here
  3. Link to a guide on the architecture here
  4. Link to database diagram here

Code style

We're using Prettier and ESLint to keep code clean. In order to reformat/check code run:

npm run lint
npm run prettier

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors