Architecture / Decision records / ADR-HIS-042
ADR-HIS-042 Layout of the staff web application: shell, design system and screen folders¶
| Status | Accepted |
| Decided | 2026-11-24 by session FN-S06 |
| Record | Drafted 2026-11-24; approved 2026-11-24 by the Enterprise Architecture Board |
| Where the rule lives | CLAUDE.md sections 2 and 3; web/shell/README.md, web/design-system/README.md and the README of each domain workspace |
Context¶
Architecture section 11 and the application shell ask for one staff application shell with domain workspaces that are built and maintained independently, a design system of shadcn components over React Aria (technology stack, row 26), and the shared safety components built once (CUX-57). PRS 8.3 allows microfrontends but does not require them, and forbids loading code from a third-party registry at runtime.
The session plan cuts screen work by screen, and runs screen sessions side by side (session rule 10). ADR-HIS-039 gives every web folder its own manifest and lockfile and no build at the root, and leaves it to FN-S06 to settle how a workspace uses the shell and the design system without a root workspace. The card of FN-S06 requires that adding a screen changes no file outside its folder.
Options considered¶
- Screens composed at run time (microfrontends): each workspace builds its own bundle and manifest, and the shell loads them through an import map from the hospital's own servers.
- Screens composed at build time: the shell finds every screen's registration file and bundles them; each workspace is still a package of its own, type-checked and tested on its own.
- A central route table in the shell, edited for each screen.
Option 3 fails the card: every screen session would change the same file. Option 1 meets the deployment wording of architecture section 11 most closely, but needs a shared-module scheme (React and the design system loaded once, through an import map or module federation), its own dev server and versioned workspace releases. None of that is needed to build the first slices, and all of it can be added later without changing a screen folder.
Decision¶
Option 2, build-time composition, with a registration contract that a later run-time loader can use unchanged.
| Folder | Package | Holds |
|---|---|---|
web/design-system/ |
@his/design-system |
Tokens (src/tokens.css, the block of DESIGN 9, checked against it by a test), the Tailwind CSS v4 theme bound to them (src/theme.css), base components on react-aria-components written shadcn style (open code, cn(), variants as maps), the shared safety components of CUX-57 (state label, status badge, freshness indicator, system banner, action bar, patient context zone), the glossary labels in English and Bahasa Indonesia, and the date, time, age and staleness formats of DESIGN 7 |
web/shell/ |
@his/shell |
The frame with the seven regions of Shell 2, routing, the screen registry, the standard screen states of Shell 13, and the SDK @his/shell-sdk (src/sdk/) that screens import. workspace-kit/ and tsconfig.shared-deps.json hold the build and test settings every workspace reuses |
web/domains/<domain>/ |
@his/workspace-<domain> |
The ten domain workspaces. Each holds one folder per screen and nothing else of its own beyond package.json, pnpm-lock.yaml, tsconfig.json, vitest.config.ts and the README |
web/domains/<domain>/<SCREEN-ID>/ |
(inside the workspace) | One screen: screen.ts, its views, its tests, and any component it needs that the design system lacks |
Screen registration. A screen folder is named by its screen identifier (UI-ADM-001) and holds screen.ts, whose default export is defineScreen({ title, workspace, context, nav, component }) from @his/shell-sdk. The folder is the only source of the screen's identity. The identifier is the folder name, the domain is the workspace folder, and the route is /<domain>/<screen-id in lower case>. The screen owns every path below its route. workspace names the shell workspace (W01 to W19 of Shell 3) whose navigation lists the screen. context is patient, item or none, and a patient-level view opens only with a patient in context and the patient context zone shown. component loads the view lazily, so each screen is its own chunk. The shell finds every web/domains/*/*/screen.ts with one build-time glob. A folder that is not a screen identifier, a screen in another domain's workspace, or a default export not made by defineScreen fails the build instead of being skipped.
Shared packages. A screen may import react, react-dom, react-aria-components, clsx, @his/design-system and @his/shell-sdk, and nothing else without a further decision. The shell and each workspace declare the shared packages themselves, at the shell's exact versions. They resolve them, also for the design-system and SDK sources they compile, from their own node_modules (Vite resolve.dedupe and aliases in workspace-kit/resolve.mjs; TypeScript paths with ${configDir} in tsconfig.shared-deps.json). There is therefore one copy of React in the bundle and in every test. @his/design-system and @his/shell-sdk are consumed as source through aliases, not as installed packages, so no lockfile names another folder. scripts/check-shared-versions.mjs in the shell fails when a web package declares a shared or tooling package at another version. The shell, and only the shell, uses react-router. Screens navigate with React Aria links, which the shell routes.
Styling. Tailwind CSS v4, run by the shell's build over the design system and every workspace. The theme removes Tailwind's default palette, radii, shadows, fonts and type sizes and defines only the tokens, so a utility for a hue outside the colour table of CUX-14 does not exist.
Tests. Vitest with jsdom, Testing Library and axe-core with the WCAG 2.0 to 2.2 A and AA rules. jsdom cannot compute colour contrast, so contrast is tested on the token pairs of DESIGN 2. A workspace tests its screens with renderScreen and expectNoAxeViolations from @his/shell-sdk/testing. Each package builds with pnpm build (type check; for the shell also the bundle) and tests with pnpm test. The shell's tests include the screen discovery check, which adds a screen folder, requires it to appear and open in the shell, and removes it. The workflow .github/workflows/web.yml runs every web package on every change under web/, through web/shell/scripts/ci.sh (ADR-HIS-038).
Example screen. web/domains/adm/UI-ADM-000/ is the worked example and the target of the end-to-end harness (FN-S07). UI-ADM-000 is reserved for it and is not in the screen inventory. Its registration is marked example, and production builds do not register it.
Patient portal. The portal (W20, UR-82 and UR-83) has a shell of its own (Shell 2, variants), so it is not a workspace of the staff shell. The staff screens of Domain 7 (UI-PEX-013 to UI-PEX-016) go in web/domains/pex/. Where the portal application lives is decided by the first portal screen session.
Rationale¶
Build-time composition gives each screen session a folder of its own and a package with its own lockfile, tests and type check, which is what the session plan needs. The shell stays a single, signed artifact served from the hospital's own servers (PRS 8.3, DEP-006). Deriving the identifier and route from the folder removes the one thing two screen sessions could otherwise both edit. Keeping the shared packages at one version, checked by a script, prevents a screen from being tested against a React or design system that does not ship.
Consequences¶
- A screen session creates
web/domains/<domain>/<SCREEN-ID>/and changes nothing else. A component it needs and the design system lacks is built in its folder and listed as a follow-up for the design system (session rule 10). - Workspaces are maintained and tested independently, but they are not yet deployed independently: a change to any screen produces a new shell bundle. Architecture section 11 says workspaces "deploy independently inside the shell". This record defers that to a run-time loader of the same
screen.tscontract (option 1), to be taken when release cadence across domains requires it. Until then the shell is released with every merged screen. This is the one point where the build differs from section 11; the Board confirmed it when it approved this record on 2026-11-24. - Upgrading React, React Aria, Tailwind or the test tooling changes the shell and every web package in one pull request by a foundation or fix session. The version check enforces this.
- The example screen's chunk is still emitted in a production bundle but never registered or reachable. A later pipeline step may drop it.
- Sign-on (UI-ESS-001), patient search and scan, tasks and notifications (UI-ESS-010), Break-the-Glass (UI-ESS-004), the keyboard shortcuts of Shell 3, the label catalogue for shell chrome, authorization of navigation through the policy decision point, and telemetry from the shell come from later cards. The SDK's
useShell()is where they will appear to screens.