Skip to content

Getting started

LeChatErrant edited this page Dec 22, 2021 · 7 revisions

Configuration

Application is configured through environment variables

Pre-configured environment variables are available in the .envrc file. Use it to configure your application during development

.envrc files are automatically loaded by direnv. I strongly recommand installing it, along with its shell hook, to have an isolated development environment

If, for any reason, you don't want to / you can't use direnv, simply source .envrc to load environment variables into your shell

Development

To launch the project in development mode

  1. Make sure the .envrc is loaded
  2. Install dependencies with npm install
  3. If no database is running, simply launch one locally with npm run dev:db
  4. Run npm run dev

The development mode will continuously watch your files to reload the API as you code, and will even regenerate the ORM on schema's changes!

Deployment example

Production

The whole containerized stack can be launched with docker-compose

Run docker-compose up --build to launch redis, the database and the API connected altogether, or specify which service you desire

Environment variables are forwarded in containers, so don't forget to change sensitive informations such as root credentials

Database is made persistent through a docker volume

Scaling

If you need to scale this API, have a look at ops-template

It provides a full Kubernetes infrastructure for the API-template, along with monitoring, SSL, alerting, and a lot more