{"id":35240871,"url":"https://github.com/fastly/compute-starter-kit-rust-fanout","last_synced_at":"2026-04-02T02:17:56.687Z","repository":{"id":66166734,"uuid":"500643428","full_name":"fastly/compute-starter-kit-rust-fanout","owner":"fastly","description":"Fanout package template for Rust based Fastly Compute projects.","archived":false,"fork":false,"pushed_at":"2025-11-04T11:27:36.000Z","size":59,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-11-10T11:28:23.112Z","etag":null,"topics":["compute-starter","fastly-oss-tier1"],"latest_commit_sha":null,"homepage":"https://developer.fastly.com/solutions/starters/","language":"Rust","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fastly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","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":"2022-06-07T01:07:00.000Z","updated_at":"2025-11-04T11:18:27.000Z","dependencies_parsed_at":"2023-03-30T21:02:19.470Z","dependency_job_id":"ac72b43e-7f2b-45fd-a3c6-b95c4d137d2a","html_url":"https://github.com/fastly/compute-starter-kit-rust-fanout","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/fastly/compute-starter-kit-rust-fanout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastly%2Fcompute-starter-kit-rust-fanout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastly%2Fcompute-starter-kit-rust-fanout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastly%2Fcompute-starter-kit-rust-fanout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastly%2Fcompute-starter-kit-rust-fanout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fastly","download_url":"https://codeload.github.com/fastly/compute-starter-kit-rust-fanout/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastly%2Fcompute-starter-kit-rust-fanout/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283853026,"owners_count":26905913,"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-11-11T02:00:06.610Z","response_time":65,"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":["compute-starter","fastly-oss-tier1"],"created_at":"2025-12-30T05:01:02.848Z","updated_at":"2025-12-30T05:02:14.210Z","avatar_url":"https://github.com/fastly.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fanout Starter Kit for Rust\n\n[![Deploy to Fastly](https://deploy.edgecompute.app/button)](https://deploy.edgecompute.app/deploy)\n\nInstall this starter kit to use [Fanout](https://www.fastly.com/documentation/guides/concepts/real-time-messaging/fanout/), the real-time message broker operating at Fastly's edge. This starter kit routes incoming requests through the Fanout GRIP proxy and on to an origin. It also provides some endpoints for testing real-time messages without needing an origin.\n\n**For more details about this and other starter kits for Compute, see the [Fastly Documentation Hub](https://www.fastly.com/documentation/solutions/starters/)**.\n\nFor the basic case, this starter kit may be used as-is to forward all traffic through Fanout to an origin.\n\nIf you would like to implement Fanout logic at the edge, this starter kit is also a good starting point for that, and you can modify it to fit your needs. See the test endpoints for inspiration.\n\n## How it works\n\nFor test requests (Paths under `/test/`), the app is actually invoked twice.\n\n1. Initially, a client request arrives at the app without having been routed through the Fanout proxy yet. The app checks for this via the presence of a `Grip-Sig` header. If that header is not present, the app calls `createFanoutHandoff(request, 'self')` and exits. This tells the subsystem that the connection should be routed through Fanout, and is used for HTTP requests controlled by GRIP.\n\n2. Since `self` refers to the same app, a second request is made to the same app, this time coming through Fanout. The app checks for this, and then handles the request accordingly (in `handleTest()`).\n\nNon-test requests are simply forwarded through the Fanout proxy and on to the origin.\n\n\u003e [!IMPORTANT]\n\u003e The starter kit forwards all non-test traffic through Fanout to the origin. In a production environment, be selective about the requests you send through Fanout. See [What to hand off to Fanout](https://www.fastly.com/documentation/guides/concepts/real-time-messaging/fanout/#what-to-hand-off-to-fanout) for a discussion on this topic.\n\n## Setup\n\nThe app expects a configured backend named `\"origin\"`. It forwards all non-test requests through Fanout to this backend.\n\nAdditionally, for the test endpoints to work, the app expects a configured backend named `\"self\"` that points back to app itself. For example, if the service has a domain `foo.edgecompute.app`, then you'll need to create a backend on the service named `\"self\"` with the destination host set to `foo.edgecompute.app` and port 443. Also set \"Override Host\" to the same host value.\n\nYou'll also need to [enable Fanout](https://www.fastly.com/documentation/guides/concepts/real-time-messaging/fanout/#enable-fanout) on your Fastly service to run this application. To enable Fanout on your service, type:\n\n```shell\nfastly products --enable=fanout\n```\n\n## Local testing\n\nTo test Fanout features in the local testing environment, first obtain [Pushpin](https://pushpin.org), the open-source GRIP proxy server that Fastly Fanout is based upon, and make sure it is available on the system path.\n\nCreate a Fastly Compute project based on this starter kit.\n\n```term\nmkdir my-fanout-project\ncd my-fanout-project\nfastly compute init --from=https://github.com/fastly/compute-starter-kit-rust-fanout\n```\n\nThe `fastly.toml` file included in this starter kit includes a `local_server.pushpin` section:\n```toml\n[local_server.pushpin]\nenable = true\n```\n\nRun the starter kit:\n```term\nfastly compute serve\n```\n\nThe Fastly CLI starts Pushpin and then starts the starter kit app at http://localhost:7676/.  \n\n## Test Endpoints\n\nThe app handles requests to the following endpoints at the edge:\n\n* `/test/stream`: HTTP streaming of `text/plain`\n* `/test/sse`: SSE (streaming of `text/event-stream`)\n* `/test/long-poll`: Long-polling\n* `/test/websocket`: bidirectional WebSocket\n  * In the example, the WebSocket endpoint is set up to echo back any messages it receives from the client.\n\nConnecting to any of these endpoints subscribes the connection to channel `\"test\"`.\n\nOn the local testing environment, data can be sent to the connections via the GRIP publish endpoint at `http://localhost:5561/publish/`. For example, here's a curl command to send a WebSocket message:\n\n```sh\ncurl \\\n  -d '{\"items\":[{\"channel\":\"test\",\"formats\":{\"ws-message\":{\"content\":\"hello\"}}}]}' \\\n  http://localhost:5561/publish/\n```\n\nOnce deployed to your Fastly service, the GRIP publish endpoint is at `https://api.fastly.com/service/{service-id}/publish/`. Here's the same example on Fastly service:\n\n```sh\ncurl \\\n  -H \"Authorization: Bearer {fastly-api-token}\" \\\n  -d '{\"items\":[{\"channel\":\"test\",\"formats\":{\"ws-message\":{\"content\":\"hello\"}}}]}' \\\n  https://api.fastly.com/service/{service-id}/publish/\n```\n\n## How it works\n\nNon-test requests are simply forwarded through the Fanout proxy and on to the origin.\n\nFor test requests, the app is actually invoked twice.\n\n1. Initially, a client request arrives at the app without having been routed through the Fanout proxy yet. The app checks for this via the presence of a `Grip-Sig` header. If that header is not present, the app calls `req.handoff_fanout(\"self\")` and exits. This tells the subsystem that the connection should be routed through Fanout, and is used for HTTP requests controlled by GRIP.\n\n2. Since `self` refers to the same app, a second request is made to the same app, this time coming through Fanout. The app checks for this, and then handles the request accordingly (in `handle_test()`).\n\n## Note\n\nThis app is not currently supported in Fastly's [local development server](https://www.fastly.com/documentation/guides/compute/testing/#running-a-local-testing-server), as the development server does not support Fanout features. To experiment with Fanout, you will need to publish this project to your Fastly Compute service. using the `fastly compute publish` command.\n\n## Security issues\n\nPlease see [SECURITY.md](SECURITY.md) for guidance on reporting security-related issues.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastly%2Fcompute-starter-kit-rust-fanout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffastly%2Fcompute-starter-kit-rust-fanout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastly%2Fcompute-starter-kit-rust-fanout/lists"}