{"_id":"@codeforamerica/blueprint-mock-server","_rev":"3-ff2a9c5848a2e928c43b2ac91fcf8af3","name":"@codeforamerica/blueprint-mock-server","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@codeforamerica/blueprint-mock-server","version":"0.1.0","license":"SEE LICENSE IN LICENSE","_id":"@codeforamerica/blueprint-mock-server@0.1.0","maintainers":[{"name":"fritzjooste","email":"fritz@fritzjooste.com"},{"name":"alice-sjconsulting","email":"alice@sjconsulting.us"},{"name":"devowhippit","email":"dhirth@codeforamerica.org"},{"name":"chriscorrea","email":"ccorrea@codeforamerica.org"},{"name":"mryhmln","email":"mhamlin@codeforamerica.org"},{"name":"lkacenjar","email":"lkacenjar@codeforamerica.org"}],"homepage":"https://github.com/codeforamerica/safety-net-blueprint#readme","bugs":{"url":"https://github.com/codeforamerica/safety-net-blueprint/issues"},"bin":{"blueprint-mock":"cli/server.js","blueprint-swagger":"cli/swagger/server.js"},"dist":{"shasum":"4ec355a965a3c457f009697fea8c455d2df1782a","tarball":"https://registry.npmjs.org/@codeforamerica/blueprint-mock-server/-/blueprint-mock-server-0.1.0.tgz","fileCount":53,"integrity":"sha512-LIdCd7GKO9mM/Ty7y69V38bicaVZkqlHDJ+2AbCs04UU77PZziRyAN/KTheNY5khxEaDq3qwBFFIiU0aq4+jXQ==","signatures":[{"sig":"MEQCIBsuAUG7OzNowjcgehQH7sGfvXm0+2p7qrH9mGJZREEGAiBAJR+G1z4NpU1aI5OO2hUe5XMHHcoX90TTkk3h2reo1w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":404821},"type":"module","engines":{"node":">=22.11.0"},"exports":{".":"./cli/server.js","./test-utils":"./test-utils.js"},"gitHead":"590957218a4729cb34da2783be15dd161a110140","scripts":{"seed":"node cli/generate-mock-data.js --spec=../safety-net-contracts --out=../generated/mock-data","test":"node tests/run-tests.js --all --contracts=../generated/contracts --raw-contracts=../safety-net-contracts --stop","reset":"node cli/reset.js --spec=../safety-net-contracts","setup":"node cli/setup.js --spec=../safety-net-contracts","start":"node cli/server.js --spec=../safety-net-contracts","swagger":"node cli/swagger/server.js --spec=../safety-net-contracts","start:all":"node cli/start-all.js --spec=../safety-net-contracts","test:unit":"node tests/run-tests.js --unit --fixtures=tests/fixtures --seed=tests/fixtures","test:functional":"node tests/run-tests.js --functional","test:integration":"node tests/run-tests.js --integration --contracts=../generated/contracts --raw-contracts=../safety-net-contracts --stop","validate:mock-data":"node cli/validate-mock-data.js --spec=../safety-net-contracts"},"_npmUser":{"name":"mryhmln","email":"mhamlin@codeforamerica.org"},"repository":{"url":"git+https://github.com/codeforamerica/safety-net-blueprint.git","type":"git","directory":"packages/blueprint-mock-server"},"_npmVersion":"10.9.8","description":"Mock API server for contract-first development — auto-generates CRUD, RPC, and event endpoints from Blueprint contracts","directories":{},"_nodeVersion":"22.23.2","dependencies":{"ajv":"^8.12.0","cors":"^2.8.5","multer":"^2.1.1","express":"^5.1.0","js-yaml":"^4.1.0","ajv-formats":"^3.0.1","json-logic-js":"^2.0.5","better-sqlite3":"^11.0.0","@faker-js/faker":"^10.4.0","swagger-ui-express":"^5.0.1","@codeforamerica/blueprint-core":"^0.1.0","@apidevtools/json-schema-ref-parser":"^11.7.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","zod":"^4.0.0","axios":"^1.7.0","newman":"^6.2.1"},"_npmOperationalInternal":{"tmp":"tmp/blueprint-mock-server_0.1.0_1789144530110_0.5701287818998331","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-09-11T16:35:29.846Z","modified":"2026-09-16T22:36:19.228Z","0.1.0":"2026-09-11T16:35:30.254Z"},"bugs":{"url":"https://github.com/codeforamerica/safety-net-blueprint/issues"},"license":"SEE LICENSE IN LICENSE","homepage":"https://github.com/codeforamerica/safety-net-blueprint#readme","repository":{"url":"git+https://github.com/codeforamerica/safety-net-blueprint.git","type":"git","directory":"packages/blueprint-mock-server"},"description":"Mock API server for contract-first development — auto-generates CRUD, RPC, and event endpoints from Blueprint contracts","maintainers":[{"email":"fritz@fritzjooste.com","name":"fritzjooste"},{"email":"dhirth@codeforamerica.org","name":"devowhippit"},{"email":"rob.diciuccio@gmail.com","name":"robdiciuccio"},{"email":"ccorrea@codeforamerica.org","name":"chriscorrea"},{"email":"mhamlin@codeforamerica.org","name":"mryhmln"},{"email":"lkacenjar@codeforamerica.org","name":"lkacenjar"}],"readme":"# @codeforamerica/blueprint-mock-server\n\n> Mock API server for contract-first development — auto-generates CRUD, RPC, and event endpoints from Blueprint contracts\n\n[![npm version](https://img.shields.io/npm/v/@codeforamerica/blueprint-mock-server.svg)](https://www.npmjs.com/package/@codeforamerica/blueprint-mock-server)\n[![license](https://img.shields.io/npm/l/@codeforamerica/blueprint-mock-server.svg)](https://github.com/codeforamerica/safety-net-blueprint/blob/main/LICENSE)\n\n> **Pre-release:** This package is at `0.x`. Until `1.0.0`, minor versions may include breaking changes. Pin your version if stability matters.\n\n## Installation\n\n```bash\nnpm install @codeforamerica/blueprint-mock-server\n```\n\n## What It Does\n\nAn Express-based mock API server that reads resolved OpenAPI specs and state machine definitions and stands up a fully functional API — no backend required. Frontend teams can develop and test against real API contracts from day one.\n\n- **Auto-discovers specs** — generates all routes from `*-openapi.yaml` files at startup\n- **Database per domain** — each domain gets its own in-memory database with full CRUD support\n- **Seeding** — populates databases from example files; generates faker-based seed data when none exists\n- **State machine enforcement** — validates RPC transitions against guard conditions, actor restrictions, and current state\n- **SLA enforcement** — tracks SLA clocks and fires timer events when deadlines are reached\n- **Event streaming** — SSE endpoints emit domain events on state transitions\n- **Event and HTTP stubbing** — simulate downstream responses for testing event-driven flows\n- **Document upload** — handles file uploads and serves documents back at runtime\n- **Metrics endpoints** — computes and serves metrics from live database records\n- **Search and filtering** — full-text search, filtering, sorting, and pagination on all list endpoints\n- **Swagger UI** — browse and test all endpoints interactively at `http://localhost:3000`\n\nSee the [Mock Server guide](https://github.com/codeforamerica/safety-net-blueprint/blob/main/docs/guides/mock-server.md) for full usage.\n\n## Commands\n\n```json\n\"scripts\": {\n  \"mock\": \"blueprint-mock --spec=./resolved\",\n  \"swagger\": \"blueprint-swagger --spec=./resolved\"\n}\n```\n\n| Command | Port | Description |\n|---------|------|-------------|\n| `blueprint-mock` | 1080 | Mock API server |\n| `blueprint-swagger` | 3000 | Swagger UI |\n\n## Seeding\n\nPlace `*-mock-data.yaml` files alongside your resolved specs. The server loads them on startup and on `POST /mock/reset`.\n\n```yaml\n# intake-mock-data.yaml\napplications:\n  - id: app-001\n    status: draft\n    programsAppliedFor: [snap]\n```\n\n## Environment Variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `MOCK_SERVER_HOST` | `localhost` | Server bind address |\n| `MOCK_SERVER_PORT` | `1080` | Server port |\n\n## Simulating Events\n\nThe mock server supports event stubs for testing event-driven behavior without a real event bus. Stub an event and it will fire on the next matching subscription trigger:\n\n```\nPOST /mock/stubs/events\n{ \"name\": \"scheduler.timer.fired\", \"data\": { \"subject\": \"task-123\", \"timerType\": \"creation_deadline\" } }\n```\n\n## Programmatic Use\n\n```js\nimport { startMockServer, stopServer } from '@codeforamerica/blueprint-mock-server';\n\nawait startMockServer(['./resolved'], './seed');\n// ... run tests ...\nawait stopServer();\n```\n\n## Changelog\n\nSee [CHANGELOG.md](https://github.com/codeforamerica/safety-net-blueprint/blob/main/packages/blueprint-mock-server/CHANGELOG.md) for release history.\n\n## Documentation\n\nSee the [Mock Server guide](https://github.com/codeforamerica/safety-net-blueprint/blob/main/docs/guides/mock-server.md) for full usage.\n\n## License\n\n[PolyForm Noncommercial License 1.0.0](https://polyformproject.org/licenses/noncommercial/1.0.0/)\n","readmeFilename":"README.md"}