Skip to content

Mono-repo for the Tupaia project, mapping health data across the Pacific

License

Notifications You must be signed in to change notification settings

beyondessential/tupaia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

5dc9d05 Β· Nov 6, 2023
Oct 30, 2023
Oct 27, 2020
Jul 6, 2022
Nov 6, 2023
Oct 30, 2023
May 18, 2023
Jul 10, 2023
Jun 15, 2023
Jul 24, 2023
Jul 28, 2023
Dec 30, 2019
Jul 18, 2023
Apr 13, 2021
Sep 14, 2020
Oct 9, 2020
Jul 6, 2022
Nov 6, 2023
Jul 29, 2020
Apr 4, 2023
Sep 25, 2020
Jul 6, 2022
Aug 8, 2023
Nov 6, 2020
Sep 12, 2023
Oct 6, 2021
Dec 31, 2019
Oct 3, 2022
Mar 24, 2022
Jun 8, 2023
Oct 3, 2021
Aug 8, 2023
Nov 6, 2023
Apr 6, 2021
Mar 15, 2022
Oct 30, 2023
Oct 12, 2023
Nov 6, 2023

Repository files navigation

Tupaia

Codeship Status for beyondessential/tupaia#dev

Open Source Info

Open Source Mission statement

By engaging and collaborating with our community we can deliver a more robust product that bridges cultural differences and empowers decision making within health systems worldwide.

Code of Conduct

For contributor's code of conduct - see the code-of-conduct.md published in the repo.

Packages

This is a mono-repo

It is set up using yarn workspaces, meaning any command you would normally run inside a package can be run from the root directory using yarn workspace @tupaia/package-name command, e.g. yarn workspace @tupaia/central-server start-dev

The easiest way to open the packages in vscode is to double click 'tupaia-packages.code-workspace'. This opens all packages as roots in the workspace, and means linting etc. will work correctly.

Package structure

The Tupaia mono-repo is comprised for 3 types of packages:

  • Platform interfaces (Frontend React applications that the user interacts with)
  • Servers
    • Orchestration servers (dedicated backend applications for each platform interface)
    • Micro servers (applications which are used by the orchestration servers to perform common system functions)
  • Libraries (various utility and common libraries that are used throughout the mono-repo)

While each package type has their own structure, there are a few common standards:

  • <package>/package.json - package definition
  • <package>/src/ - contains source code
  • <package>/.env.example - file showing what environment variables are required by the package
  • <package>/.env - environment variables used by package (ignored in git)
  • <package>/src/__tests__/ - contains unit tests

Platform interfaces

Servers

Orchestration servers

Micro servers

Server packages can be built by running yarn workspace @tupaia/package-name build. Server packages can then be started by running yarn workspace @tupaia/package-name start.

All servers are NodeJS express applications, and the packages follow the same basic structure:

  • <package>/examples.http - example queries showing the server interface
  • <package>/src/index.ts - server entrypoint
  • <package>/src/app/createApp.ts - express router definition
  • <package>/src/routes/ - route definitions

Libraries

Getting started

Secrets

Most packages will require a .env file. .env.example files indicate the required variables per package.

πŸ”‘ BES internal: Adding .env files

Local database

πŸ”‘ BES internal: Tupaia monorepo setup - steps 4 and 5

Dependencies

We use yarn workspaces to manage our packages, which allows us to run yarn once at the project root, and it will install dependencies everywhere.

CI/CD

We use codeship for the CI/CD

πŸ”‘ BES internal: CI/CD using Codeship

Tests

Most of the packages support the following scripts for testing:


yarn test
yarn test:coverage # also displays code coverage

Style Guide

We use a combination of ESlint configs to detect quality and formatting issues in code:

The config for this repository is defined in .eslintrc under the root folder. Additional rules/overrides per package are specified in this file.

⚠️ Please do not use individual eslint configs, but update the main configuration file instead.

Auto-formatting in Visual Studio Code

In order to automatically format code in VSCode according to our style guide:

  1. Install Prettier for VSCode
  2. Enable the Editor: Format on Save setting
  3. Your files will now be formatted automatically when you save them