Node.js / TypeScript Event-Sourced Service
An event-sourced backend scaffolded by @eventmodelers/cli.
It uses Emmett over Postgres for the event store,
Express for the HTTP layer, and Flyway for schema migrations.
Features are built as vertical slices under src/slices/, generated from the slices on your
Eventmodelers board by the agent in .build-kit/.
Prerequisites
- Node.js 20 or later (the dev/start scripts use
node --env-file) - Docker and Docker Compose (for local Postgres)
- Flyway CLI on your
PATH(fornpm run flyway:migrate) - Claude Code if you want to run the build agent
Getting started
Start Postgres:
docker compose up -dCreate your
.env:cp .env.example .envOr run
./setup-env.shto be prompted for host, port, database, user and password.Activate the baseline migration and apply it:
mv migrations/V1__schema.sql.example migrations/V1__schema.sql npm install npm run flyway:migrateV1__schema.sqlcreates the processor dead-letter queue table the runtime expects. Add your ownV2__*.sql,V3__*.sqland so on as slices introduce projections.Run the server:
npm run build # slice routes and processors are loaded from dist/ npm run dev
The API is on http://localhost:3000, with Swagger UI at http://localhost:3000/api-docs and the raw OpenAPI document at http://localhost:3000/swagger.json.
Scripts
| Script | What it does |
|---|---|
npm run dev |
Start the server locally with .env loaded |
npm run build |
Compile TypeScript to dist/ |
npm start |
Start in production mode |
npm test |
Run src/**/*.test.ts via tsx --test |
npm run flyway:migrate |
Apply pending migrations from migrations/ |
Learn more
License
Licensed under Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) — see LICENSE.