/nodejs-typescript

Startup project of a micro-services application with user auth

Primary LanguageTypeScript

AgreeWe

This is the backend architecture of AgreeWe software.

Prerequisites

Setup for development:

  • Install node dependencies
yarn install

Test

  • Unit tests
yarn test:unit
  • Integration tests with docker
yarn test:integration
  • Integration tests outside docker

    1. start postgres and mongodb
    docker-compose -f docker-compose.test.yml up --build postgres mongodb
    1. Run db migration
    yarn postgres:migrate up
    1. copy the content of test/test.env to .env

    2. Run services

    yarn service:api
    1. Note: do not forget to clean the .env before running the unit test. To restart the integration test you need to stop everything and restart from scratch, include the database data(make a docker-compose down)

Note

All test suit can be run in docker by prefixing all npm command by docker: (eg: yarn docker:test:unit)

Run locally

  • Start all the dependencies
yarn docker:dependencies
  • Run the database migration
yarn postgres:migrate up
  • Destroy database and create from scratch
yarn postgres:create
  • Start all services (not recommended)
yarn service:main
  • Start separate services
yarn service:api

Stop

docker-compose down

Environment

You can set environment variables in the .env file, you can find examples in .env.sample