Skip to content

Realm project layout

A realm with TS handlers is a real TypeScript project. The framework provides scaffolding (embabel-realm new, in flight), but the shape is small:

realm-name/
├── realm.yml # existing
├── apis/ # existing — raw OpenAPI surface
│ └── openapi.json
├── package.json # devDeps: @embabel/runtime-types, typescript, vitest
├── tsconfig.json # strict; output mode for runtime is CJS
├── tsconfig.build.json # outDir: dist; module: CommonJS
├── vitest.config.ts
├── src/
│ ├── api/
│ │ └── docs-editor.ts # one TS file per namespace; filename → namespace
│ ├── lib/ # internal helpers (not exposed)
│ └── types/ # shared TS types
├── tests/
│ └── docs-editor.test.ts # Vitest, runs in pure Node against mockGateway
├── .embabel/
│ └── gateway.d.ts # GENERATED: typed view of the host's gateway
└── dist/ # GENERATED: compiled JS + manifest.json

@embabel/runtime-types provides mockGateway<T>(impl) for tests and the embabel-build-manifest CLI used by npm run build. It’s pulled in as a git dependency (no npm-registry hosting required).