Skip to content

Backend: Introduction

Tim K edited this page Sep 3, 2018 · 6 revisions

What does "backend" stand for?

In the Fizzyo system, backend is an umbrella term that refers to everything that runs on the Fizzyo server, or, generally, on Azure. Fizzyo server is our own Ubuntu 16.04 server deployed as an Azure Linux VM.

At the moment, there are 3 major components:

  1. Fizzyo database. This is a PostgreSQL 9.6 database that runs on Azure Database SaaS. The purpose of the database is to hold all of the data in the Fizzyo system.
  2. Fizzyo web API. This is a Node.js web server that runs on the Fizzyo server. The purpose of the web API is to let external clients access and modify Fizzyo database, while providing an extra security layer (API uses various permission checks which are impossible to implement using the database alone). It is recommended that developers never modify the database directly, but rather use the relevant API endpoint.
  3. Fizzyo data validator. This is a Node.js app that runs on the Fizzyo server. Its purpose is to run different scripts at fixed intervals, e.g. running a database diagnostic tool every midnight.

Check relevant pages in the sidebar for a detailed description of each component.

Production vs. staging instances

When developing a new feature, there is often a need to test something in a "toy" environment before letting real users access it. For this purpose, each of the components of Fizzyo backend exists as 2 separate instances: one in a staging environment and one in a production environment.

Staging environment is only used for development purposes, which means there's no risk of breaking any mission-critical services or accidentally deleting sensitive patient data. It is also available online (for example via https://api-staging.fizzyo-ucl.co.uk), which makes it useful when you want to showcase a new feature to medical staff or other developers. Once a feature is proven to work correctly in a staging environment, it can be promoted to the production environment.

Production environment is used by real users, such as medical staff or Fizzyo patients. Due to this, any code that ends up in the production environment must first pass all of the tests. Otherwise, there's a risk of crashing critical services or corrupting sensitive data. Ideally, you should ask someone from the Fizzyo core development team to review your code before pushing it to production.

Note: Even though both staging and production backend instances are available online via the Fizzyo server, it is still recommended that you test new features locally. This way, you can be sure that you're the only one who's making changes to the environment, which makes it much easier (and quicker) to debug. See this page for instructions on how to setup a local environment.