Book 6
Engineering Handbook
Internal playbook for the OPSQAI engineering team. Public copy so integrators and auditors know how the sausage is made.
1. Conventions
- TypeScript strict everywhere. No
any, no@ts-ignorewithout a linked issue. - Server logic in
createServerFn; public HTTP undersrc/routes/api/public/. - Design tokens only — no hard-coded colours in components.
- Every new
publictable ships withGRANTs,ENABLE RLS, and policies in the same migration.
2. Release process
- Merge to
main→ CI builds and signsopsqai-web,opsqai-worker,postgres-pgvectorimages with cosign. - Tagging
vX.Y.Zpromotes the images and publishesopsqai-stack.tgztodl.opsqai.de/selfhost/X.Y.Z/. - Release notes generated from Conventional Commits; CVEs linked explicitly.
- Managed Cloud rolls forward within 24h; self-host customers pull on their own schedule.
3. Adding a module
- Add a feature flag key to
src/lib/license/features.ts. - Create routes under
src/routes/_authenticated/app.<module>.*.tsx. - Register the module in the Portal sidebar behind
hasFeature('module'). - Ship migrations with GRANT + RLS.
- Update the Product and Technical books.
4. Issuing a license
# In the Management Center
mc license issue \
--customer "Acme GmbH" \
--modules chat,knowledge,tickets \
--seats 25 \
--expires 2027-01-01 \
--out acme.opsqai.licenseThe MC signs the JSON payload with the release Ed25519 key and stores the issuance in the audit trail.
5. Adding an AI adapter
- Implement
AiAdapterundersrc/lib/ai/<name>.ts. - Register in
src/lib/ai/registry.ts. - Add a wizard step field set + Doctor probe.
- Document env vars in the Administrator Guide.
6. Publishing container images
Images are pushed to ghcr.io/opsqai/*, signed with cosign keyless via OIDC in CI. SBOMs (CycloneDX) are attached to every image and mirrored to dl.opsqai.de/sbom/.
7. Migrations
SQL migrations live under supabase/migrations/. Rules: one logical change per migration, always backwards-compatible for one minor version, never destructive without a two-step deprecation window. Every new public table needs GRANT + RLS in the same file.
8. Pre-release checklist
- Migrations reviewed for RLS + GRANT coverage.
- Doctor probes green on a fresh install and on the upgrade path.
- Backup + restore rehearsed against the release image.
- SBOM published; cosign signatures verified.
- Release notes + upgrade notes drafted.