{"id":29054226,"url":"https://github.com/specmatic/specmatic-order-bff-nodejs","last_synced_at":"2026-04-25T08:36:20.558Z","repository":{"id":166173312,"uuid":"636163338","full_name":"specmatic/specmatic-order-bff-nodejs","owner":"specmatic","description":"Specmatic project to demonstrate in nodejs how to stub http APIs with their OpenAPI specifications and mock Kafka broker with AsyncAPI specification","archived":false,"fork":false,"pushed_at":"2026-04-18T00:36:42.000Z","size":1983,"stargazers_count":1,"open_issues_count":22,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-04-18T02:38:36.696Z","etag":null,"topics":["node","nodejs","sample-project","service-virtualization","specmatic","stub","stubbing","stubbing-framework"],"latest_commit_sha":null,"homepage":"http://specmatic.in","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/specmatic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-05-04T08:55:43.000Z","updated_at":"2026-02-19T18:07:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"ce14631f-2caa-4347-abf0-657ebd2db14b","html_url":"https://github.com/specmatic/specmatic-order-bff-nodejs","commit_stats":null,"previous_names":["specmatic/specmatic-order-bff-nodejs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/specmatic/specmatic-order-bff-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specmatic%2Fspecmatic-order-bff-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specmatic%2Fspecmatic-order-bff-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specmatic%2Fspecmatic-order-bff-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specmatic%2Fspecmatic-order-bff-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/specmatic","download_url":"https://codeload.github.com/specmatic/specmatic-order-bff-nodejs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specmatic%2Fspecmatic-order-bff-nodejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32255749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T04:23:17.126Z","status":"ssl_error","status_checked_at":"2026-04-25T04:21:53.360Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node","nodejs","sample-project","service-virtualization","specmatic","stub","stubbing","stubbing-framework"],"created_at":"2025-06-27T02:07:07.429Z","updated_at":"2026-04-25T08:36:20.553Z","avatar_url":"https://github.com/specmatic.png","language":"JavaScript","readme":"# Specmatic Sample: NodeJS BFF calling Domain API\n![tests](https://github.com/specmatic/specmatic-order-bff-nodejs/actions/workflows/ci.yml/badge.svg)\n\n\u003c!-- TOC --\u003e\n- [Background](#background)\n- [Tech](#tech)\n- [Run Contract Tests](#run-contract-tests)\n  - [Using npm](#using-npm)\n- [For More Info](#for-more-info)\n\u003c!-- /TOC --\u003e\n\n## Background\nThis sample demonstrates contract-driven development for a Node.js backend-for-frontend (BFF) that orchestrates product search by delegating to the Specmatic Order Domain API and publishing Kafka messages. Specmatic virtualizes both downstream dependencies during testing so the BFF can be tested in isolation.\n\nThe specifications consumed by `specmatic.yaml` are maintained in the [specmatic-order-contracts](https://github.com/specmatic/specmatic-order-contracts) repository:\n- [Domain API OpenAPI specification](https://github.com/specmatic/specmatic-order-contracts/blob/main/io/specmatic/examples/store/openapi/api_order_v3.yaml)\n- [Kafka AsyncAPI specification](https://github.com/specmatic/specmatic-order-contracts/blob/main/io/specmatic/examples/store/asyncapi/kafka.yaml)\n\n![HTML client talks to client API which talks to backend API and Kafka](assets/specmatic-kafka-mocking-architecture.gif)\n\n## Tech\n1. NodeJS + Express\n2. JRE 17+\n3. Specmatic\n4. Jest \u0026 SuperTest\n5. Docker\n\n## Run Contract Tests\nContract tests configure Specmatic using `specmatic.yaml` to fetch the shared specifications, start an HTTP stub for the Domain API, and mock Kafka. Ensure Docker Desktop is running because the Kafka mock runs in a container.\n\n### Using npm\n```shell\nnpm install\nnpm test\n```\n`npm test` launches the BFF, spins up Specmatic HTTP and Kafka mocks, and executes the Jest contract suite with API coverage reporting. Review the generated report at `reports/specmatic/html/index.html`.\n\n## Troubleshooting\n1. Specmatic contract tests don't show up in VSCode Test Explorer\n\n   Specmatic is tested with projects using Jest framework. If you are using any other framework then let us know and we will revert with a solution. In case of jest, if contract tests don't show up, then try restarting the jest runners\n   ![VS Code - Jest Commands](assets/vscode-jest-commands.png)\n\n2. Specmatic contract tests don't run in Jetbrain's PhpStorm\n\n   Jetbrain's PhpStorm does not read `test` script in package.json to determine the command to run tests. It instead uses its own interface to configure all the options. You can configure the same options in the test script in package.json, in PhpStorm's test run configuration as below\n    - `test` script in package.json\n    ```json\n    {\n        ...\n        \"test\" : \"cross-env SPECMATIC_GENERATIVE_TESTS=true NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 node ./node_modules/jest/bin/jest.js --collectCoverage --detectOpenHandles\"\n        ...\n    }\n    ```\n    - Above configured in PhpStorm\n      ![PhpStorm Run Configuration](assets/phpstorm-run-configuration.jpg) \u003cbr\u003e\n\n## For More Info\n- [Specmatic Website](https://specmatic.io)\n- [Specmatic Documentation](https://docs.specmatic.io)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspecmatic%2Fspecmatic-order-bff-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspecmatic%2Fspecmatic-order-bff-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspecmatic%2Fspecmatic-order-bff-nodejs/lists"}