{"id":31922958,"url":"https://github.com/grafbase/federation-demo","last_synced_at":"2025-10-13T23:27:57.754Z","repository":{"id":313879829,"uuid":"863376351","full_name":"grafbase/federation-demo","owner":"grafbase","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-09T08:00:38.000Z","size":112,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-09T10:53:23.543Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/grafbase.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":"2024-09-26T07:32:52.000Z","updated_at":"2025-09-09T08:00:41.000Z","dependencies_parsed_at":"2025-09-09T10:53:30.206Z","dependency_job_id":"5b2d5ffe-1932-463d-8d33-6f1a01be3990","html_url":"https://github.com/grafbase/federation-demo","commit_stats":null,"previous_names":["grafbase/federation-demo"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/grafbase/federation-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafbase%2Ffederation-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafbase%2Ffederation-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafbase%2Ffederation-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafbase%2Ffederation-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafbase","download_url":"https://codeload.github.com/grafbase/federation-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafbase%2Ffederation-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017238,"owners_count":26086015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-10-13T23:27:55.727Z","updated_at":"2025-10-13T23:27:57.747Z","avatar_url":"https://github.com/grafbase.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Grafbase Federation Demo\n\nThis demo repository showcases Grafbase extensions and how they enable easy composition and schema consistency across different types of subgraphs: GraphQL subgraphs (products), databases (PostgreSQL), message queues (NATS), and REST APIs (rest-factories).\n\n## Services Overview\n\nThis demo includes the following services:\n\n- **Products**: GraphQL subgraph for product management\n- **Inventory**: GraphQL subgraph for inventory tracking\n- **Orders**: GraphQL subgraph for order processing\n- **Orders-PG**: PostgreSQL database exposed as a GraphQL subgraph via Grafbase PostgreSQL extension\n- **Sales**: NATS message queue exposed as a GraphQL subgraph via Grafbase NATS extension\n- **REST Factories**: REST API exposed as a GraphQL subgraph via Grafbase REST extension\n- **gRPC Services**: A separate demo setup with gRPC-based subgraphs (see [grpc/README.md](grpc/README.md))\n\n## Getting Started\n\n### Prerequisites\n\nInstall the Grafbase CLI using one of the following methods:\n\n```bash\n# Using npx\nnpx grafbase\n\n# Using curl\ncurl -fsSL https://grafbase.com/downloads/gateway | bash\n\n# Or see full installation instructions\n# https://grafbase.com/docs/gateway/installation\n```\n\n### Running the Demo\n\n1. Start all services with Docker Compose:\n   ```bash\n   docker compose up\n   ```\n\n2. Run the Grafbase development server:\n   ```bash\n   grafbase dev\n   ```\n\n3. Access the `grafbase dev` UI at [http://localhost:5000](http://localhost:5000)\n\n### Example queries\n\nSimple query to the products subgraph:\n\n```graphql\nquery ListProducts {\n  products {\n    brand\n    name\n  }\n}\n```\n\nPostgres query:\n\n```graphql\nquery OrdersSortedByAmount {\n  orders(\n    first: 5\n    orderBy: [{ totalAmount: DESC }]\n  ) {\n    edges {\n      node {\n        orderId\n        orderDate\n        status\n        totalAmount\n        customer {\n          name\n          email\n        }\n        orderItems(first: 2) {\n          edges {\n            node {\n              productName\n              quantity\n              unitPrice\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nJoin from REST (factories) to GraphQL (products) to Postgres (orders):\n\n```graphql\nquery RestToGraphQLToPostgres {\n  factories {\n    lng\n    lat\n    product {\n      brand\n      color\n      latestCustomer {\n        address\n      }\n    }\n  }\n}\n```\n\nPost to NATS:\n\n```graphql\nmutation SellProduct {\n  sellProduct(input: { productId: \"converse-1\", price: 200 })\n}\n```\n\nTo subscribe to the sales NATS topic defined in the sales subgraph, use the `subscription.sh` script. It starts a Server Sent Events based GraphQL subscription against `localhost:5000/graphql` with curl. You should see the event from the mutation above when running this.\n\n## Repository Structure\n\n- `/gateway` - Gateway configuration for deployment to Fly.io (ignore this in local setups)\n- `/grpc` - Separate demo with gRPC-based subgraphs\n- `/products`, `/inventory`, `/orders` - GraphQL subgraphs\n- `/orders-pg` - PostgreSQL backed subgraph with an orders database\n- `/sales` - NATS message queue subgraph\n- `/rest-factories` - REST API service\n\n## Learn More\n\n- [Grafbase Documentation](https://grafbase.com/docs)\n- Open source extensions [marketplace](https://grafbase.com/extensions) and [repository](https://github.com/grafbase/extensions)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafbase%2Ffederation-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafbase%2Ffederation-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafbase%2Ffederation-demo/lists"}