As of 02-04-2024, the Coronadashboard has been brought offline, so this file is no longer relevant.
The main application that contains the front-end part of the dashboard. This React application uses Next.js as its framework.
First run yarn install
or simply yarn
at the root of the repository if you
haven't already. This installs all the dependencies for all of the packages.
Make sure you have an .env.local
file in packages/app
with correct environment variables. To
get started, you can copy .env.local.example
:
cp packages/app/.env.local.example packages/app/.env.local
Then from the repository root you can run:
The latest production protos have been added to the repository. The user is not required to download them.yarn download
- Downloads latest datayarn bootstrap
- Downloads / builds all other requirementsyarn dev
- Starts the development server
By default, the archived application is configured to run with the latest production data and lokalize-keys. The steps described above are outlined in more detail below.
Run yarn download
to download & install the JSON data files from production in packages/app/public/json
The calculations for the data can be found in nl-covid19-data-backend-processing.
JSON data files represent a collection of archived and non-archived "protos" files that contain the key-value pairs for the entire website. The protos are split into 3 categories and can be found in the packages/app/public/json
folder:
- NL & Archived NL: A collection of data that is used by
/landelijk/*
- GM_COLLECTION & Archived GM_COLLECTION: A collection of data that is only used by the
choropleths
- GM & Archived GM: A collection of data that is used by municipality pages. The GM code is directly linked between the
GMXXX.json
file andgemeente/GMXXX/*
page.
By default, the site builds using the production dataset. If you would like the
development content instead you can create a .env.local
file in packages/app
with the following content:
NEXT_PUBLIC_SANITY_DATASET=development
The "Lokalize" part of Sanity is exported and consumed by the app as JSON. You will need to run this script regularly as an outdated JSON file will result in compile or build-time errors.
yarn cms:lokalize-import:prd
To learn more about the rationale behind Lokalize and how it works read the documentation.
By default, the site builds the Dutch version. If you would like to build the English
version instead, update the following variable in your packages/app/next.config.js
file:
defaultLocale: 'en'
In order to build and serve the site as if it were a production environment, you
need to have a .env.local
file in packages/app
with the following content:
NEXT_PUBLIC_COMMIT_ID=__commit_id_placeholder
The value doesn't actually matter, so it can be anything.
To build a production version you can run yarn build:app
, and after that yarn start
to
serve the built files.
There are several scripts available via yarn [scriptName]
.
dev
Runs the app in the development mode. Open http://localhost:3000 to view it in the browser.build
Builds the app for production to theout
folder.download
This downloads the latest data files from the production server and places the data in thepublic/json
folder.test
Runs the unit tests.