Skip to content

jabardigitalservice/dedi-core-service

Repository files navigation


GitHub issues GitHub forks GitHub stars GitHub license

Desa Digital App

An integrated one-stop platform for collaborating with startups, SMEs, and other external partners in order to maximize 5,312 villages in West Java to outreach their highest potential.

Tech Stacks

Quick Start

Clone the project:

$ git clone https://github.com/jabardigitalservice/dedi-core-service
$ cd dedi-core-service
$ cp .env.example .env

Installing Dependencies

  • With npm

    # Install node packages
    $ npm install
  • With make

    # Install node packages
    $ make install

Applying Migrations

Make sure there is already a MySQL database created and the credetials are filled in the .env file

  • Locally

    • With npm

      # apply migrations to database
      $ npm run migrate
      
      # rollback migrations from database
      $ npm run rollback
    • With make

      # apply migrations to database
      $ make migrate
      
      # rollback migrations from database
      $ make rollback
  • Locally with docker

    # apply migrations to database
    $ make docker-run-dev-migrate
    
    # rollback migrations from database
    $ make docker-run-dev-rollback

How to Run

  • Run locally

    • With npm

      $ npm run dev
    • with make

      $ make dev
  • Run locally with docker:

    # start
    $ make docker-run-dev
    
    # stop
    $ make docker-run-dev-stop
  • Run on production with docker:

    # to start
    $ make docker-run
    
    # to stop
    $ make docker-stop

How to Test

Make sure there is already a MySQL test database (should differ with the dev database) created and the credentials are filled in the .env file

  • Locally

    $ npm run test
  • Locally with docker

    $ make docker-run-dev-test

Repo Structure

├── .github/          * all workflows github actions
  └── workflows/
├── docker/
├── src/
  └── config/         * config like db, aws, redis, etc.
  └── database/       * migrations, seeds, etc.
  └── emails/         * email templates.
  └── handler/        * frequently used exception handling, etc.
  └── helpers/        * helpers and utils
  └── lang/           * messages in id, en, etc.
  └── middleware/     * request's middlewares
  └── modules/        * where all the magics happen
    └── <module_name>
      └── <module_name>_access        * role base access control list
      └── <module_name>_entity        * struct, type, interfaces, etc
      └── <module_name>_handler       * request handler list
      └── <module_name>_http          * routes
      └── <module_name>_log           * logging business
      └── <module_name>_repository    * database queries
      └── <module_name>_response      * mapping for response
      └── <module_name>_rules         * model rules and restrictions
      └── <module_name>_service       * all business logic
      └── <module_name>_test          * remember to keep our code coverage high
└── ...

Code Style Guide

Ref: https://github.com/airbnb/javascript#airbnb-javascript-style-guide-