Skip to content

Recker4244/Oneboard-Backend

Repository files navigation

OneBoard BE

Pre-requisites

How to run the backend server locally -

In the project directory, perform the following steps:

Install packages

npm install

Environment Variable configuration

Add the following envs:

GITHUB_APP_INSTALLATION_ID
GITHUB_APP_IDENTIFIER
PRIVATE_KEY
CLIENT_ID
GITHUB_CLIENT_SECRET
ORG_NAME
jwtPrivateKey
DB_PORT
DB_NAME
DB_USER
DB_PASSWORD
DB_HOST

Setup Database

  1. Install PostgresSQL server locally by following the instructions here.
  2. Start the local PostgreSQL server using the following command
      pg_ctl -D /usr/local/var/postgres start
    
  3. Create the database using the following command
      createdb <DATABASE_NAME>
    
  4. As mentioned in the Environment Variable configuration section, update the environment variables values with relevant database user, password, and username.
  5. Run the migrations using the following command
    $ npm migrate:up

Start the backend server

# development
$ npm start

# watch mode
$ npm start:dev

Additional Commands

Migration Commands

  1. Create a new migration

    $ npm --name <migration_name>
  2. Run the migrations

    $ npm migrate:up
  3. Revert the last executed migration

    $ npm migrate:down

Seeding Commands

  1. Create a new seeder

    $ npm seed:create --name <migration_name>
  2. Seed the data

    $ npm seed:up
  3. Revert the most recent seed

    $ npm seed:down

Test

# unit tests
$ npm test

# test coverage
$ npm test:coverage

Modules

Feature Package
Package Manager npm
NodeJs 19.5.x
PostgreSQL 13
Linting Eslint-Recommended
Unit Test Jest
Code Analysis SonarQube
ORM Sequelize

Coding conventions

  1. Singular form for naming tables and columns.
  2. snake_case for table names.
  3. Lowercase for database table and column names and camelCase for model/entity name.
  4. camelCase for naming keys in response.
  5. joi schema for requests with payloads.
  6. API/Swagger specification and description for every route.
  7. ./.env.sample to be updated when adding new environment variables.
  8. fk*table_name__<key1>*<key2> template to create foreign keys
  9. pk*table_name__<key1>*<key2> template to create compound primary keys

Technologies used

  1. NodeJS (v19.5.x)
  2. PostgresSQL (v13.x), a open-source relational database management system.
  3. Sequelize

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published