Repository containing the UI implementation of the sda-download service
  • TypeScript 88.1%
  • Shell 8.1%
  • Python 1.9%
  • SCSS 1%
  • Dockerfile 0.7%
  • Other 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Alex Aperis a4733fde81
Merge pull request #257 from NBISweden/dependabot/npm_and_yarn/frontend/zod-4.6.7
chore(deps): bump zod from 4.3.6 to 4.6.7 in /frontend
2026-11-10 20:28:26 +01:00
.github chore(deps): bump docker/metadata-action from 5 to 6 2026-10-13 16:25:07 +02:00
dev-tools dev: replace MinIO s3 backend with Garage in sda-dev stack 2026-10-15 23:26:42 +02:00
docs fix: improve help content and deployment docs. Issue #162 2026-09-07 14:15:34 +02:00
frontend chore(deps): bump zod from 4.3.6 to 4.6.7 in /frontend 2026-11-10 18:34:32 +01:00
secrets chore: add docker compose settings for session 2026-04-20 14:46:52 +02:00
.gitignore fix: ensure prod setup works locally for testing 2026-09-07 20:27:28 +02:00
compose-dev.sh fix: Make the development script use the production script 2026-04-17 11:35:43 +02:00
compose-prod.sh fix: ensure prod setup works locally for testing 2026-09-07 20:27:28 +02:00
docker-compose.dev.yml fix: ensure prod setup works locally for testing 2026-09-07 20:27:28 +02:00
docker-compose.yml fix: remove sessionSecretPath from config 2026-09-08 14:44:36 +02:00
Dockerfile Merge branch 'develop' into 170-ls-aai-login-button-not-rendered-in-prod-image 2026-08-31 14:51:06 +02:00
LICENSE Add GNU AGPL v3 license 2026-08-21 16:44:15 +02:00
README.md docs: document oidcHttpTimeoutMs 2026-11-04 15:03:55 +01:00
sdad-config.json.example docs: document oidcHttpTimeoutMs 2026-11-04 15:03:55 +01:00

sda-download-ui

Repository containing the UI implementation of the sda-download service

Development

The local development environment for the sda-download UI can be deployed using docker compose files from this repository. The environment consists of a compose file for starting a minimal sda development stack and the compose file for deploying the download UI webapp.

Documentation References

For calculating the file size we use the npm library filesize.

SDA development stack

The necessary configuration and compose files for starting the development stack for the sda backend services can be found under ./dev-tools. The stack includes the sda-download API service, OIDC services and any required dependencies. Details for the stack and instructions on how to run and test it can be found in the README file of that folder.

Download UI development stack

Initial configuration

In order to start the dev stack you will need to create a configuration file. As a starting point for your config file you can copy sdad-config.json.example to sdad-config.json.

The example config includes nextAuthSecretPath which points to the path where frontend-next-auth-secret is located. Configuring the secret involves creating the file secrets/frontend-next-auth-secret.txt. This can be done by using the following command:

openssl rand -base64 32 > secrets/frontend-next-auth-secret.txt

In the secrets folder you also need to create the files

  • frontend-oidc-client-id
  • frontend-oidc-client-secret

These can be rabdom 16-character alphanumeric strings, e.g created by the command:

openssl rand -base64 12 | tr -dc 'A-Za-z0-9' | head -c 16 > secrets/frontend-oidc-client-secret.txt

The options available in the config file can be described as follows:

Option Type Description
oidcClientSecretPath File path Path to OIDC client secret file.
oidcClientIdPath File path Path to OIDC client id file.
sdaBaseUrl HTTP url The base url to the SDA Download API.
nextAuthUrl HTTP url The url to use for authenticatin in the app.
oidcRoot HTTP url Url to the OIDC provider.
oidcExtraScopes Array of strings (Optional) Default is []. Extra OIDC scopes to request in addition to openid (which is always requested). This option allows to add extra scopes in case the SDA download backend needs them for authorization, e.g. ["ga4gh_passport_v1"], ["eduperson_entitlement"], or both.
oidcHttpTimeoutMs Integer (in ms) (Optional) Default is 3500 (the openid-client library default). Capped at 60000. Timeout for requests the app makes to the OIDC provider during sign-in.
postLogoutRedirectUri HTTP url (Optional) Default is nextAuthUrl/logout-complete. The post-logout redirect URI. This must be registered with the OIDC provider. Note that in federated setups, this redirect will usually not be honored and the user will land at the IdP's logout page instead.
allowHttp boolean (Optional) Default is false. Recommendation for development setup is true and in production this option should be false or unset.

Startup

./compose-dev.sh up --build

This mounts ./frontend into the container, installs dependencies (if needed), and runs next dev.

Open the UI at:

Notes:

  • On first run the container will run npm ci and create frontend/node_modules/ on your host (Linux recommended).

Stop and remove containers:

./compose-dev.sh down

Download UI production-like build and local run

Note: The production-like docker-compose.yml is primarily meant for local testing of the production image build. To cover any accidental situation where this is deployed "as is" in a production system, this compose file assumes that sda-download UI makes external calls to LS-AAI and the sda-download service.

For local testing, first create the file docker-compose.override.yml next to docker-compose.yml and populate it with the following:

services:
  frontend:
    extra_hosts:
      - "host.docker.internal:host-gateway"
      - "localhost:host-gateway"

Build and run the production image using the compose-prod.sh :

./compose-prod.sh up --build

Note: The script will automatically pick up docker-compose.override.yml, if it exists.

Open the UI at:

This mode is intended to be close to Kubernetes "PSA (Pod Security Admission) restricted" operation:

  • runs as a non-root UID/GID (6001:6001)
  • no-new-privileges
  • drops all Linux capabilities
  • read-only root filesystem
  • writable /tmp via tmpfs

Stop and remove containers:

./compose-prod.sh down

To build only (no run):

./compose-prod.sh build

Tests

The testing library used is Vitest and the tests can run with the commands in the package.json. Run the tests from the container with: docker compose exec frontend npm run test

Connectivity to the sda dev stack

The sda-download-UI containers can access services of the sda-stack through calls to the host gateway, e.g. fetching a token array from http://host.docker.internal:8001/tokens should work.

Routes and access control

Route Type Access Behaviour when signed out
/ Page Public Shows welcome + sign-in button.
/help Page Public Static content.
/login Page Public Sign-in page.
/logout Page Public Redirects to / if signed in.
/logout-complete Page Public Redirects to / unless reached via IdP logout flow.
/datasets Page Protected Renders sign-in prompt in place.
/datasets/[datasetId] Page Protected Renders sign-in prompt in place.
/userinfo Page Protected Renders sign-in prompt in place.
/api/auth/* API Public Managed by NextAuth.
/api/files/[fileId] API Protected 307 → /userinfo.
/api/datasets/[datasetId]/download.tar API Protected 307 → /userinfo.
/color-theme Page Dev-only 404 in production.