Reference: ../emmett/src (library) and ../emmett/samples/webApi/expressjs-with-postgresql (sample), checked 2026-11-12 at Emmett 3271b3f9.
- Node
v24.22.1in.nvmrc,"type": "module",engines.node >=24. - TypeScript 6 (
moduleResolution: bundler,target/libESNext,types: ["node"],rewriteRelativeImportExtensions, nobaseUrl). - ESLint 10 flat config without
FlatCompat:js.configs.recommended,typescriptEslint.configs['flat/recommended'],['flat/recommended-type-checked'],eslint-plugin-prettier/recommended,consistent-type-imports,--cache. - Prettier 3 for
json/mdonly (.tsformatting goes through ESLint),.prettierrc.json{ tabWidth: 2, singleQuote: true }. npm-run-all2,tsxinstead ofts-node/nodemon.- Tests: Vitest (
vitest.config.ts,testTimeout/hookTimeout,.unit/.int/.e2e.specsplit). - VS Code: extensions
dbaeumer.vscode-eslint,esbenp.prettier-vscode,vitest.explorer; settings with[typescript]format-on-save off; launch "Debug Current Test File" throughvitest.mjs; tasksbuild:ts:watch+ install recommended extensions. - CI: Node from
.nvmrc.
| Project | Specs | Node | ESLint | Test runner | Emmett | CI workflow | Status |
|---|---|---|---|---|---|---|---|
/ (root) |
– | – | – | – | – | – | todo |
samples/closingTheBooks |
15 | 20.10 | 8 legacy | Jest 29 | – | samples_closingTheBooks.yml |
migrated: tsc clean, tests green, 120 pre-existing ESLint errors |
samples/decider |
5 | 20.10 | 8 legacy | Jest 29 | – | samples_decider.yml |
migrated: tsc clean, tests green, 43 pre-existing ESLint errors |
samples/eventsVersioning |
11 | 20.10 | 8 legacy | Jest 29 | – | samples_eventsVersioning.yml |
migrated: tsc clean, tests green, ESLint clean |
samples/from_crud_to_eventsourcing |
4 | 20.10 | 8 legacy | Jest 29 | – | samples_from_crud_to_event_sourcing.yml |
migrated: tsc clean, tests green, 4 pre-existing ESLint errors |
samples/hotelManagement |
1 | 20.10 | 8 legacy | Jest 29 | – | samples_hotelManagement.yml |
migrated: tsc clean, tests green, ESLint clean |
samples/snapshots |
10 | 20.10 | 8 legacy | Jest 29 | – | samples_snapshots.yml |
migrated: tsc clean, tests green, 101 pre-existing ESLint errors |
samples/unpeelingOnion |
3 | 20.10 | 8 legacy | Jest 29 | – | samples_unpeelingOnion.yml |
migrated: tsc clean, tests green, 13 pre-existing ESLint errors |
samples/webinar |
1 | 20.10 | 8 legacy | none | – | samples_webinar.yml |
migrated: tsc clean, no tests, 16 pre-existing ESLint errors |
workshops/event_driven_architecture |
103 | 20.11 | 9 flat + FlatCompat | Jest 29 | 0.38.0 | workshops_event_driven_architecture.yml |
done: tsc + lint clean, solved 59 files / 239 tests green |
workshops/introduction_to_event_sourcing |
113 | 20.11 | 9 flat + FlatCompat | Jest 29 | 0.38.0 | workshops_introduction_to_event_sourcing.yml |
done: tsc + lint clean, solved 67 files / 118 tests green (KurrentDB, PostgreSQL, MongoDB from Testcontainers, no docker compose needed) |
Per project, the files to touch: package.json, package-lock.json, .nvmrc, tsconfig.json, eslint.config.mjs (replacing .eslintrc.json + .eslintignore), .prettierrc.json, .prettierignore, jest.config.* + jest.setup.* → vitest.config.ts, jest.setTimeout calls in specs, .vscode/*, Dockerfile (Node image), the CI workflow, README test instructions.
- Vitest 5 with explicit
import { describe, it, ... } from 'vitest', as in Emmett src. Added by the scratchpad scriptadd-vitest-imports.mjs; test helpers that callexpectget the import too. jest.setTimeout→testTimeout/hookTimeout: 30_000invitest.config.ts.- TypeScript as in Emmett src:
typescript→npm:@typescript/typescript6(used by typescript-eslint,tsc6),@typescript/native→npm:typescript@^7(tsgo, thetscbin used bybuild:ts). VS Code:TypeScriptTeam.native-preview+js/ts.experimental.useTsgo. tsconfig addsrewriteRelativeImportExtensions. - TS 6 needs explicit
rootDir; set to./srcsodist/layout stays the same.baseUrlremoved,moduleResolution: bundler. - Express 5 per emmett-expressjs peers;
express-async-errorsandhttp-problem-detailsdropped (Express 5 handles async errors, emmett-expressjs ships its own problem details, neither was imported). allowScriptsfor esbuild, protobufjs, ssh2, cpu-features, as in Emmett.- Tests in files not matching
*.test.ts(never ran under Jest) renamed to.test.ts. - Unused infrastructure packages (esdb, mongodb, postgresql, express, testcontainers) kept and bumped.
expect.arrayContaining<Message>(...): Vitest's typing needs the explicit type argument.Promise.reject(error instanceof Error ? error : new Error(String(error))):no-unnecessary-type-assertionandprefer-promise-reject-errorsconflict onerror as Error.vitest.config.tsas in Emmett'svitest.shared.ts:resolve.tsconfigPaths: true(replaces Jest'smoduleNameMapperfor#core/*) andmaxWorkers: '50%'outside CI.- ESLint 10 recommended adds
no-useless-assignmentandpreserve-caught-error: drop unread final assignments, pass{ cause: error }when rethrowing; exercise scaffolding that assigns beforethrow new Error('Not Implemented!')gets a line disable. @typescript-eslint/no-unnecessary-type-assertionmisfires on evolving arrays (const events = []); type the array (const events: StreamEvent[] = []) instead of dropping the assertion that TS needs.- emmett-testcontainers 0.43:
EventStoreDBContainermoved to@event-driven-io/emmett-testcontainers/esdb; testcontainers 12MongoDBContainer/PostgreSqlContainerneed the image (same as docker-compose). pg(+@types/pg) is an optional peer of emmett-postgresql 0.43, so projects that use PostgreSQL declare it.- Express 5:
import 'express-async-errors'removed;http-problem-detailskept where imported. - Database tests as in Emmett's
sharedEventStoreDBGlobalSetup/sharedPostgreSQLGlobalSetup/sharedMongoDBGlobalSetup: Vitest projectskurrentdb/postgresql/mongodbwith aglobalSetupstarting one container fromemmett-testcontainersandprovide-ing its connection string; PostgreSQL/MongoDB spec files get their own database (sharedPostgreSQLDatabase/sharedMongoDBDatabaseinsrc/core/testing), KurrentDB specs share the server with unique stream names; CI needs no docker compose. Containers start only when that project has files to run. This also avoids dumbo's migration race (pending migrations computed before the advisory lock), since no two files migrate the same database. - CI:
actions/checkout@v6,actions/setup-node@v6withnode-version-fileand npm cache.
- Samples moved from CommonJS to ESM (
"type": "module"), with the workshoptsconfig.json;noUncheckedIndexedAccesskept as each sample had it. Samples with a rootconfig.tsuserootDir: ./and include it. baseUrl-relative imports (from 'src/...') rewritten to relative paths.- Samples and the intro workshop's raw-client exercises (03, 05, 09, 10) use
@kurrent/kurrentdb-clientinstead of@eventstore/db-client; the workshops keep@eventstore/db-clientonly for Emmett, sinceemmett-esdbpeers on it (the Emmett exercises build theirEventStoreDBClientfromgetKurrentDBConnectionString()). API changes:EventStoreDBClient→KurrentDBClient, append optionexpectedRevision→streamState,AppendExpectedRevision→AppendStreamState,WrongExpectedVersionError.expectedVersion/actualVersion→expectedState/actualState,readStreamreturnsAsyncIterableIterator(notStreamingRead), option types come from the package root. Server image everywhere (samples and workshops, docker-compose and test containers) iskurrentplatform/kurrentdb:26.2.3(ARM:26.2.3-experimental-arm64-10.0-noble) withKURRENTDB_*settings; KurrentDB rejects the removed external TCP options (EXT_TCP_PORT,ENABLE_EXTERNAL_TCP), so those and the1113port are gone. Compose service, volumes and network are namedkurrentdb,kurrentdb-volume-*,kurrentdb_network(the threedocker-compose.esdb.ymlfiles and from_crud referenced a network they never defined; now defined). The intro workshop passes the KurrentDB image to Emmett'sEventStoreDBContainer, which still setsEVENTSTORE_*variables; KurrentDB accepts that legacy prefix. Everything this repo names uses KurrentDB: workshop exercise folders, the Vitest project, the test helpers (#core/testing/kurrentDB,#testing/kurrentDB,getKurrentDBTestClient,KurrentDBContainer), config (config.kurrentDB,KURRENTDB_CONNECTION_STRING,kurrentdb://connection strings),KurrentDBSubscription,getSubscriptionToAllWithKurrentDBCheckpointing,docker-compose.kurrentdb.yml, variables and READMEs (linking todocs.kurrent.io). Only Emmett's identifiers (emmett-esdb,getEventStoreDBEventStore,EventStoreDBEventStore, Emmett'sEventStoreDBContainer) and theEventStoreDBClientit takes keep their names. - Subscriptions are consumed with
for await (const resolvedEvent of subscription)instead offinished(subscription.on('data', ...)): no cast to Node'sReadable(the client's iterator type lacksSymbol.asyncDispose), and events are handled one at a time instead of overlapping asyncdatahandlers.KurrentDBSubscriptionuses the client'sReadableSubscription<AllStreamResolvedEvent>. - Code calling Jest's global
fail(...)in production code now calls the sample'sfailure(...)Result helper. - Express 5: optional route params use
{/:param};isNotEmptyStringis a type guard soreq.paramsnarrows tostring. - mongodb 7 / bson 7:
Long.fromBigIntrejects numbers,Long.fromValueused instead. - Samples keep their own Testcontainers setup (one container per test file); files using the shared, reused
KurrentDBContainerrun withfileParallelism: false, so one file stopping the container doesn't break another. - Dockerized samples bundle with
tsdown(build:bundle), as in the Emmett sample, since Node can't run extensionless ESM imports fromtscoutput. Images copypackage.jsonandconfig/. Node imagenode:24-alpine. - Lint scripts quote the glob (
"**/*.ts"); the unquoted glob undershonly matched one directory level, so most sample code was never linted. The errors this exposed are fixed: string throws becamethrow new Error(CODE)(the two places comparing thrown values checkerror.message),anybecameunknownwith type guards, route bodies are typed per route, async Promise executors were removed, and floating promises are awaited.