Skip to content

Get started

This section briefly describes how to configure, build and start the Intake24 components.

Repository

Clone the repository

sh
git clone https://github.com/MRC-Epid-it24/intake24

Repository is set as mono-repository with workspaces.

Shared components are in packages folder. Applications are in apps folder.

Install pnpm using corepack (see pnpm docs for further options).

sh
corepack enable

corepack install

Install project dependencies

sh
pnpm install

Set up .env file for each application you want to build, see below.

sh
cd apps/{app}

cp .env-template .env

nano .env

Build all applications

  • run command either from top-level to build all applications (api, cli, admin, portal and survey).
  • run command from apps/{app} folder to build specific application
sh
pnpm build

Environment variables

Code is using .env environment files. Each project contains a template file (.env-template). If you're setting up fresh project, you can run CLI command, which generates all the files and couple of required specific keys. Follow the CLI instructions and how to run generate-env.

Some of the environment variables are either bundled in or used to configure build of SPA applications. Make sure you set up those .env file before running build for SPAs.

API Server

Navigate to apps/api directory.

sh
cd apps/api

Copy template of configuration file and edit it as required. Please see Configuration section for detailed description of configuration options.

sh
cp .env-template .env

Build the application

sh
pnpm build

Start the application

sh
pnpm start

For production, consider

  1. Deploying as dedicated service. Refer to your OS environment how to set that up.
  2. User process manager, e.g. PM2
  3. Deploy behind proper http server, e.g. Nginx, Apache etc.

Deployment section / ansible scripts provide examples how to use dedicated service on Ubuntu and run it behind Nginx reverse proxy.

Database

  • project is using sequelize-cli
  • database layer is located in packages/db
  • config / migration files (per database) are store in respective packages/db/sequelize/{database} folders

Set up .env file if running independently of API server so it can load connection details

sh
cp .env-template .env

Migrations can be executed from root-level or package level with following commands

sh
# both databases
pnpm db:migrate

# or each database

# foods
pnpm db:migrate:foods

# system
pnpm db:migrate:system

Admin client

Navigate to apps/admin directory.

sh
cd apps/admin

Copy template of configuration file and edit it as required. Please see Configuration section for detailed description of configuration options.

sh
cp .env-template .env

Build the application

sh
pnpm build

Start the application

sh
pnpm start

TIP

This should only be used if you host the client on separate domain. It will start separate http server to serve the application.

Serve the application locally in development mode with hot-reload

sh
pnpm dev

Survey client

Navigate to apps/survey directory.

sh
cd apps/survey

Copy template of configuration file and edit it as required. Please see Configuration section for detailed description of configuration options.

sh
cp .env-template .env

Build the application

sh
pnpm build

Start the application

sh
pnpm start

TIP

This should only be used if you host the client on separate domain. It will start separate http server to serve the application.

Serve the application locally in development mode with hot-reload

sh
pnpm dev

Documentation

Documentation is built with vitepress.

Serve the application locally in development mode with hot-reload

sh
pnpm docs:dev

TIP

Documentation is automatically built and deployed to github pages whenever source code is updated.