Skip to content

Samples

Getestete Beispiele fuer Framework-Features. Drei Buckets:

  • recipes/ — 1 Konzept = 1 Feature-Definition + 1 Test. Bricht ein Framework-Change was, wird der Recipe-Test rot. Server-only, kein UI.
  • apps/ — Full-Stack Demos mit dev-server + Browser-Client. Zeigen UI-Layer + Auth-Wiring + WorkspaceShell.
  • showcases/ — Komplette App-Domains. Mehrere Features pro Sample, zur Zeit ohne dev-server (geplant).

Recipes — Ich will X machen → Sample

Ich will…SampleTest-Typ
Entity + Standard-Handler + Soft Delete + Optimistic Lockingrecipes/basic-entityIntegration
Eigene Handler mit Business-Logikrecipes/custom-handlersIntegration
Parent-Child Relations + Cascade/Restrictrecipes/relationsIntegration
Felder per Rolle verstecken/schuetzenrecipes/field-accessIntegration
Hooks (Validation, preSave, postSave)recipes/lifecycle-hooksIntegration
Stammdaten seeden (r.referenceData)recipes/reference-dataIntegration
Volltextsuche (searchable, searchWeight)recipes/searchIntegration
Echtzeit-Updates via SSErecipes/realtime-sseIntegration
Cross-Feature-Reaktionen (ctx.appendEvent + r.multiStreamProjection)recipes/cross-feature-eventsIntegration
Event Sourcing Vollbild (defineEvent + Upcaster + Projections + asOf + archive)recipes/event-sourcingIntegration
Request-Deduplizierung (Idempotency)recipes/idempotencyIntegration
Multi-Tenant Datentrennungrecipes/tenant-isolationIntegration
Mehrsprachigkeit (i18n)recipes/i18nUnit
Saubere Fehlerbehandlung (Kumiko-Error-Klassen, Reasons, Helper)recipes/error-contractIntegration
Default-deny Access Rules + FK-Indices via Relationsrecipes/access-controlIntegration
Features tragen Identity-Facts in den JWT ein (r.authClaims)recipes/auth-claimsIntegration
Row-level Ownership (Entity + Field, Read + Write, Straddle-safe)recipes/ownershipIntegration
Jobs auf Deploy-Lane pinnen (runIn: “api” | “worker”), event-triggered Fan-outrecipes/lane-routingIntegration
Screens + Navigation registrieren (r.screen + r.nav) mit entityList/entityEdit/custom, cross-feature Nav-Parents, typed FieldConditionrecipes/screens-navUnit
Playwright-E2E-Specs aus der Registry generieren (generateE2ESpec + generateZodFixture, 4 Test-Kinds, Feldtyp→Interaktion-Mapping; JSON-serialisierbar für externen Worker)recipes/e2e-generatorUnit

Apps — UI + dev-server

SampleWas es zeigt
apps/ui-walkthroughDefaultAppShell + LanguageSwitcher + ThemeToggle + emailPasswordClient + TenantSwitcher + Tasks-Demo. Mit Playwright-E2E.
apps/workspacesWorkspaceShell + persona-/role-gated Workspaces + Cross-Feature-Nav-Members + Server-injiziertes AppSchema.

Showcases — Komplette Domains

SampleDomaeneStatus
showcases/mietnomadeHausverwaltung SaaSGeplant
showcases/beammycarFahrzeugtransportGeplant

Tests ausfuehren

Terminal window
yarn kumiko test # Unit Tests (inkl. recipes/i18n + recipes/screens-nav)
yarn kumiko test integration # Integration Tests (alle Recipes mit DB)
yarn kumiko test e2e # Playwright E2Es (apps/ + showcases/)
yarn kumiko test all # Unit + Integration

Production-Build

yarn build im App-Workspace produziert deploybare Artefakte. Voraussetzung: "scripts": { "build": "kumiko-build" } in der package.json. Convention- driven Discovery — kumiko-build baut das, was vorhanden ist:

ConventionOutputInhalt
src/client.tsx, public/, index.html, src/styles.cssdist/Client-Bundle: hashed Assets, Tailwind, Static-Files
bin/main.tsdist-server/Server-Bundle: server.js + kumiko.js + migration-hooks.js (optional) + minimales package.json mit native externals

Workspaces ohne bin/main.ts bekommen nur den Client, Headless-Apps ohne Browser nur den Server. Beide werden parallel gebaut wenn vorhanden.

Server-Bundle: bündelt Framework + bundled-features + App-Source in eine ~1 MB JS-Datei. 7 native externals (argon2, bullmq, drizzle-kit, drizzle-orm, ioredis, postgres, temporal-polyfill) bleiben als prod-deps in einem generierten dist-server/package.json. Versionspin aus dem Repo- packages/framework/package.json. Für App-spezifische externals siehe buildServerBundle({ extraRuntimeExternals }) in @kumiko/dev-server/build.

Container-Deploy: samples/showcases/publicstatus/deploy/ ist die Reference — Multi-Stage Dockerfile baut beide Bundles, Runtime-Image kennt nur dist/, dist-server/, drizzle/. Das dist-server/-package.json wird im Runtime-Stage via bun install --production gefüllt (~30 MB node_modules + 100 MB bun-alpine-Base = ~270 MB Image). Migrate-Step im Pre-Deploy: bun /app/kumiko.js migrate apply läuft via gebundelter kumiko-CLI gegen die DB. Details + GHA-Workflow-Pattern siehe samples/showcases/publicstatus/deploy/Dockerfile und .github/workflows/deploy-publicstatus.yml.

Neues Recipe erstellen

samples/recipes/my-recipe/
package.json ← { "name": "@kumiko/sample-my-recipe", "dependencies": { "@kumiko/framework": "workspace:*" } }
src/
feature.ts ← defineFeature + Entity + Handler
__tests__/
feature.integration.ts ← Test (oder .test.ts fuer Unit Tests)

Regel: Jedes neue Framework-Feature braucht ein Recipe oder eine Anpassung an einem bestehenden.


Source path: samples/README.md