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:
yarn download
- Downloads latest datayarn bootstrap
- Downloads / builds all other requirementsyarn dev
- Starts the development server
These steps are described 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.
By default, the site builds using the development dataset. If you would like the
production content instead you can create a .env.local
file in packages/app
with the following content:
NEXT_PUBLIC_SANITY_DATASET=production
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
Alternatively you can run this from packages/cms
as yarn lokalize:import
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/.env.local
file:
NEXT_PUBLIC_LOCALE=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
, 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.