Implementation details
Concrete map of routes, services, seed data, and tests.
Run locally
./dev.sh # Postgres, migrate, seed, next dev
./dev.sh --reset # wipe DB then seed
./dev.sh --no-seed # skip seed
App: http://localhost:3000. Docs:
http://localhost:3000/docs/.
Work only inside src/web for npm scripts.
Primary routes
| Path | Purpose | Capability |
|---|---|---|
/ | Role dashboard | — |
/templates | Grouped catalogue | — |
/templates/new, /templates/[id]/edit | Author / edit draft | template:create / ownership |
/templates/[id] | Detail + lifecycle actions | view; mutate gated |
/matcher | Free-text match (non-project roles) | — |
/projects, /projects/[id], .../new | Project-first flow | project:link |
/steward/review-queue | Review queue | template:review |
/steward/model, /steward/model/rules, /steward/model/sections/[key], /steward/fields/[key] | Assay definition model | field:manage |
/steward/vocabulary, suggestions, changes | Vocabulary governance | vocabulary:manage |
/docs/ | Static documentation | public |
/health, /api/readiness | Health / readiness | public |
/forbidden | Capability denial | — |
Key server modules
| Module | Responsibility |
|---|---|
template-service.ts | Create/update drafts, status transitions, field values |
review-service.ts | Queue + Metadata Quality Score inputs |
vocabulary-service.ts | Terms, suggestions approval |
field-service.ts | Metadata field definitions |
section-service.ts | Metadata sections |
rule-service.ts | Conditional metadata rules |
matcher-service.ts | Extract → recommend → rule-gap insights |
project-link-service.ts | ProjectAssayLink CRUD |
wizard-service.ts | Wizard payload / edit hydration |
catalogue-service.ts | Grouped catalogue |
integrations/marlay.ts | Project master-data client (mock) |
Template lifecycle
Statuses and legal transitions live in domain/status.ts
(DRAFT, SUBMITTED, IN_REVIEW,
CHANGES_REQUESTED, APPROVED, PUBLISHED,
REJECTED, …). Editable when
isTemplateEditable is true (draft / changes requested).
Seed data
- Sources:
src/web/data/seed-sources/*.json(examples, not the schema). -
PK In Vitro Stability.jsonis seeded as a Draft needing review (CIA-style block despite the filename) — source preserved verbatim. - Field definitions, sections, rules and vocabularies:
prisma/seed/data/. - Seeded CYP induction rule requires Target, Cell System, Species, Detection Type and restricts Expected Readout to Fold Induction, Emax, NOEL.
- Users: owner, steward, project member with stable ids for demos.
Testing
| Level | Command / location |
|---|---|
| Unit | tests/unit/* — matching, scoring, validation, rule evaluation, quality score, diagram layout, … |
| Integration | tests/integration/* — needs docker-compose Postgres |
| E2E | npm run test:e2e — Playwright core flows |
CI: .github/workflows/ci.yml — lint, typecheck, unit tests, build.
This documentation pack
-
Location:
src/web/public/docs/(served as/docs/index.html; bare/docsredirects there vianext.config.ts). - Export: zip/copy the folder; relative CSS/images work offline.
-
Single-file export:
assaylink-docs.html— every page plus base64 screenshots in one ~7 MB file, rebuilt withnpm run docs:bundle(scripts/build-docs-bundle.mjs). It re-assembles the per-page HTML, so prose is never duplicated. -
Refresh screenshots (app up + seeded):
npm run docs:screenshots→scripts/capture-docs-screenshots.mjs. Rundocs:bundleafterwards so the download matches.