Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Source setup

These instructions describe running the example from its source code. They do not connect it to live CE-RISE services. Use disposable data and an isolated evaluation environment: the companion API does not verify bearer tokens.

Prerequisites

  • Node.js 22.13 or newer within the 22.x series, and npm 10 or newer, matching the requirements in the package lockfiles.
  • A Keycloak instance and a public browser client configured for the origin used to access the interface.
  • Network access to the package registry for installation and to the published CE-RISE RE definitions when seeding the database.

The SQLite dependency uses a native addon. Systems without a matching prebuilt binary also need the toolchain required to build it.

Configure Keycloak

The application reads these Vite settings from client/.env.local:

SettingValue to supply
VITE_KEYCLOAK_URLYour Keycloak server’s base URL
VITE_KEYCLOAK_REALMThe realm containing your browser client and users
VITE_KEYCLOAK_CLIENT_IDThe public browser client’s identifier

Configure the client’s allowed redirect URIs and web origins to match the address used in the browser. localhost, 127.0.0.1, and a LAN address are different origins. This repository does not supply NILU’s realm, client configuration, or accounts.

Vite settings are incorporated into the frontend build. Changing environment variables after building does not reconfigure an already-built frontend. These browser settings must not contain a client secret or other credentials. Refer to the Keycloak JavaScript adapter and Vite environment documentation for their configuration rules.

The copied authentication guard preserves the requested path but not its query parameters during login. Retaining a product/tab deep link across sign-in requires the matching route-handling adjustment.

Install dependencies

From the repository root:

npm --prefix client ci
npm --prefix api ci
npm --prefix db-seed ci

Generate the example database

npm --prefix db-seed run seed

The seeder writes api/data/products.db, loads the supplied field definitions and environmental references, retrieves the RE definitions, and generates synthetic products. It does not retrieve product records from NILU or another live passport system.

Seeding replaces the database tables and their contents. Stop the example API before reseeding, and do not run the seeder against data that must be retained.

Start the source processes

Restrict access to API port 5000 before starting the example. Keycloak login in the browser does not secure the API, and the supplied API does not restrict its listener to loopback.

In one terminal, from the repository root:

npm --prefix api run dev

In another terminal:

npm --prefix client run dev -- --host 127.0.0.1

Use the local URL reported by Vite, normally http://127.0.0.1:5173/. This frontend binding is not reachable through a LAN address. Network access requires deliberate listener, origin, proxy, and API access-control configuration; it is not enabled by these instructions.

Build and check the source

The build commands are:

npm --prefix api run build
npm --prefix client run build

The existing checks can be run from the repository root after installation and seeding:

node client/src/views/products/tabs/widgets/selfcheck.js
node client/src/views/products/tabs/see/selfcheck.js
node api/src/lib/selfcheck.js

They exercise chart aggregation, environmental dataset calculations and exchange, product operations, and reference-data access. The API checks use and modify the example database, so run them only with disposable data. These checks do not establish equivalence with the released calculation services or validate a live deployment.

The Codeberg Source checks workflow runs these same checks on pushes and pull requests, and can also be triggered manually. It uses a codeberg-small runner with Node.js 22, installs only the API and seeder dependencies, and creates a fresh synthetic database in the job workspace. Seeding reads the published RE definitions; the checks do not start the application or contact a running passport or calculation service.