chain-rdeveloper portal
build

Running the Frontend Standalone (no Docker)

Prototype and debug fe-core and fe-public without the full Docker stack. Two modes are available:

ModeBackend needed?Use it for
LiveYes (proxied)Working against real data with a backend already running

Ports: fe-core → 5173, fe-public → 5174 (so both can run at once).

Prerequisites

make install          # or: cd modules/fe && npm install
make rebuild-shared   # build chainr-frontend-shared (consumed from dist/)

Re-run make rebuild-shared after editing anything under modules/fe/shared.

No backend, no nginx, no /etc/hosts. Auth is bypassed with a mock user via VITE_STANDALONE=true (see src/util/standalone.ts), so the entire authenticated UI renders immediately.

make local-fe          # fe-core   → http://localhost:5173
make local-fe-public   # fe-public → http://localhost:5174

Or directly:

cd modules/fe/core   && npm run dev:standalone
cd modules/fe/public && npm run dev:standalone

Config lives in each app's .env.standalone. Data-driven pages will be empty (no API), which is expected — this mode is for layout, components, and theming.

Live mode (against a running backend)

Start the backend stack (e.g. make be) so nginx is up on :8000, then run a dev server that proxies /api and /auth to it. The Vite proxy injects the correct virtual-host Host headers, so no browser host entries are needed.

make local-fe-core-live      # proxies to http://localhost:8000 by default
make local-fe-public-live

Point at a different backend with VITE_PROXY_TARGET. By default the proxy injects *.local.datachainr.com Host headers, matching the local Docker stack's nginx virtual hosts. To proxy against a live deployment instead (e.g. the dev environment), also set VITE_PROXY_DOMAIN to match its virtual-host domain:

# Local Docker stack (default)
VITE_PROXY_TARGET=http://localhost:8000 make local-fe-core-live

# Live dev deployment
VITE_PROXY_TARGET=https://dev.datachainr.com VITE_PROXY_DOMAIN=dev.datachainr.com make local-fe-core-live

Debugging in VSCode

Open the fe folder/workspace and pick a launch config (Run and Debug panel):

  • Debug fe-core (standalone) — starts the dev server and a Chrome session with breakpoints wired to your source.

  • Debug fe-public (standalone) — same for the public app.

Set breakpoints in .tsx files and they'll bind via source maps.

Testing

Unit tests run with Vitest, no servers required:

cd modules/fe/core   && npm test       # or: npm run test:watch
cd modules/fe/public && npm test
cd modules/fe/shared && npm test

How the auth bypass works

VITE_STANDALONE=true makes useAuth (both apps) return a mock user with no network call, and core's AuthContext skip the svc-core provisioning request and use a mock CoreUser. Everything is guarded by the flag, so dev/build and production behaviour are unchanged.