Skip to content

rafaelkallis/neutral-api

Repository files navigation

Covee 2.0 Logo

Covee Network 2.0

Build Status

Usage

# prepare app
$ npm install
$ docker-compose up

# use for development (also watches for changes!)
$ npm run dev

# use for production
$ npm run build
$ npm run start

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

OpenApi Spec

Start the app and visit /docs if you are a human , or /docs-json if you are a machine.

App Structure

The app follows the principals of domain-driven design, i.e., placing the project's primary focus on the core domain and domain logic.

The app is divided into logical units, so called modules, each of which represents a bounded context. You will find the following modules:

  • project
  • user
  • notification
  • app (no domain)
  • shared (no domain, seedwork)
    • cache
    • config
    • email
    • event
    • object-mapper
    • object-storage
    • serialization
    • session
    • telemetry
    • token
    • typeorm
    • utility

Each module follows a 3 tier architecture:

Dependencies between layers in DDD

Figure from a dotnet DDD microservice article.

FAQs

1. How do I run all external dependencies?

You can use the supplied docker compose file. Just run:

$ docker-compose up --detach

2. When I run npm run dev, I get the following error:

Error: The postgres extension "pg_trgm" is not installed. An administrator should install the extension: "CREATE EXTENSION pg_trgm;"

Connect to your local postgres intance (psql postgres://covee-saas:password@localhost:5432/covee-saas) and run CREATE EXTENSION pg_trgm;.

3. How do I override environment variables?

Create an .env file and specify your custom environment variables. The .env file is ignored and will not be commited.

4. Setup email environment outside of mailslurper

Any smtp server works for this. Mailjet offers 200 emails/day for free. Go ahead and create a new account with them.

Set the following variables in your .env file:

SMTP_URL="smtps://<mj-smtp-api-key>:<mj-smtp-secret>@in-v3.mailjet.com"
EMAIL_SENDER="Covee Network <[email protected]>"

The EMAIL_SENDER should be the email address you used to register on mailjet.