This website uses Astro for static site generation and React for dynamic components.
In order to run the website locally you will need to install nodejs. You can do this with Node Version Manager.
- Set up your
.envfile, e.g. by copying.env.examplewithcp .env.example .env - Install packages:
npm ci(cias opposed toinstallmakes sure to install the exact versions specified inpackage-lock.json) - Generate config files for local testing (requires Helm installed):
../generate_local_test_config.sh. If you are not running the backend locally, run../generate_local_test_config.sh --from-liveto point to the backend from the live server (preview of themainbranch) or../generate_local_test_config.sh --from-live --live-host main.loculus.orgto specify a particular host which can also be a preview. - Run
npm run startto start a local development server with hot reloading. - Run
npm run format-fastto format the code.
Run npm run test to execute the unit tests.
Run npm run start-server to build and run the application with the Astro dev server.
The website is configured via environment variables. They are most conveniently set in the .env file.
Note that Astro requires the environment variables already at build time.
See .env.docker for the required variables.
Furthermore, the website requires config files that need to be present at runtime in the directory
specified in the CONFIG_DIR environment variable:
website_config.json: Contains configuration on the underlying organism. It's similar to the database config file that LAPIS uses.reference_genomes.json: Defines names for segments of the genome and amino acids. It's equal to the file that LAPIS uses.runtime_config.json: Contains configuration that specific for a deployed instance of the website.
Check our tests and examples for working config files.
The website writes logs to stdout.
If the environment variable LOG_DIR is set, it will also store them in LOG_DIR/website.log.
- Install node version from
.nvmrcwithnvm install
- Available scripts can be browsed in
package.jsonor by runningnpm run - For VS code, use the ESlint extension which must be configured with
"eslint.workingDirectories": ["./website"],in the settings.json - Tips & Tricks for using icons from MUI https://mui.com/material-ui/guides/minimizing-bundle-size/
Inspiration for writing codemods can be found in codemods/AGENTS.md.