CASE FILE · SIM-03
CASE FILE · SIM-03
A package simulator is a small product-owned package that uses @x12i/api-simulator as the engine and ships its own:
simulation handlers (and optional createStore state)api.data and/or fixture JSONThe core library stays zero runtime dependencies and does not load data or metadata from disk, MongoDB, or HTTP. Your package (or an example like examples/flowstate-simulator) owns that.
CASE FILE · SIM-03
my-provider-simulator/
├─ mocks/ # optional — shared with static-memorix when used
│ ├─ data/
│ ├─ metadata/
│ └─ metadata-packs/
├─ src/
│ ├─ data/ # seeds for api.data / createStore
│ ├─ simulations/ # package-specific handlers
│ ├─ api.ts # createApiSimulator({ apis: [...] })
│ ├─ memorix.ts # optional — buildServer({ MOCKS_DIR })
│ └─ server.ts # Node/HTTP entry: core-service + tryDispatch ± forward
└─ package.json
Keep provider-specific data and simulation logic outside @x12i/api-simulator. The core remains the reusable engine.
HTTP entrypoints that bind a port use @x12i/core-service (see Adapters — HTTP process compliance). Shared helper in this repo: scripts/create-simulator-http.mjs.
CASE FILE · SIM-03
If the API is ordinary REST (no Memorix), follow examples/library-demo/TUTORIAL.md:
api.data / createStore.createApiSimulator + optional Node HTTP entry — no @x12i/static-memorix.Runnable reference: examples/library-demo/.
CASE FILE · SIM-03
For Memorix Explorer (/api/explorer/*) and Metadata (/api/metadata/*) parity without MongoDB/Redis, compose @x12i/static-memorix:
mocks/ tree (data/, metadata/, metadata-packs/).src/bridge.mjs).buildServer() / startServer() with MOCKS_DIR pointing at that tree.@x12i/core-service: tryHandleCore → tryDispatch package routes → forward misses to static-memorix (inject).| Surface | Owner |
|---|---|
/health, /_live |
@x12i/core-service (zone api-simulator) |
/api/v1/<your-product>/* |
@x12i/api-simulator endpoints in your package |
/api/explorer/*, /api/metadata/* |
@x12i/static-memorix (MOCKS_DIR → shared mocks/) |
Org scope: x-memorix-org-id may be sent for client realism; it is a no-op for isolation in this simulator (not memorix-service).
static-memorix is not a substitute for full memorix-service (pipelines, relationship materialize, abstract reverse-write, etc.).
CASE FILE · SIM-03
Full compose walkthrough: examples/flowstate-simulator/TUTORIAL.md.
node examples/flowstate-simulator/demo.mjs
node examples/flowstate-simulator/src/server.mjs # :5522