{"id":13683762,"url":"https://github.com/superfly/edge","last_synced_at":"2025-04-30T13:31:53.189Z","repository":{"id":33788437,"uuid":"141772466","full_name":"superfly/edge","owner":"superfly","description":"A set of useful libraries for Edge Apps. Run locally, write tests, and integrate it into your deployment process. Move fast and maybe don't break things? Because, gosh darnit, you're an adult.","archived":true,"fork":false,"pushed_at":"2022-12-03T02:05:32.000Z","size":1429,"stargazers_count":142,"open_issues_count":44,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-20T10:49:28.667Z","etag":null,"topics":["cdn","edge","javascript","proxies","typescript"],"latest_commit_sha":null,"homepage":"https://fly.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/superfly.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-21T01:44:31.000Z","updated_at":"2024-11-05T00:10:54.000Z","dependencies_parsed_at":"2023-01-15T02:33:00.897Z","dependency_job_id":null,"html_url":"https://github.com/superfly/edge","commit_stats":null,"previous_names":["superfly/cdn"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superfly%2Fedge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superfly%2Fedge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superfly%2Fedge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superfly%2Fedge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/superfly","download_url":"https://codeload.github.com/superfly/edge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251712897,"owners_count":21631462,"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","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":["cdn","edge","javascript","proxies","typescript"],"created_at":"2024-08-02T13:02:30.716Z","updated_at":"2025-04-30T13:31:52.620Z","avatar_url":"https://github.com/superfly.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"![Forking Edge](https://fly.io/public/images/edge-banner.png?@2x)\n\n# Fly Edge\n\n[![npm version](https://img.shields.io/npm/v/@fly/edge.svg)](https://www.npmjs.com/package/@fly/edge)\n[![isc license](https://img.shields.io/npm/l/@fly/edge.svg)](https://github.com/superfly/edge/blob/master/LICENSE) \n[![Build Status](https://dev.azure.com/flydotio/fly/_apis/build/status/fly)](https://dev.azure.com/flydotio/fly/_build/latest?definitionId=1)\n![Gitter](https://img.shields.io/gitter/room/superfly/fly.svg?colorB=red)\n\n\nThe Fly Edge project is a set of APIs for routing HTTP traffic, cache content, and add \"middleware\" (like auth) to any application. It's written in TypeScript and runs on the Fly Edge [runtime](https://github.com/superfly/fly). It's built for developers — that means runs locally, has a tests, and integrate into a CI/release pipeline.\n\nThe code targets the Service Worker API and uses the Fly runtime API where necessary. You can deploy it to fly.io hosting or run it on any platform with an Edge Service Worker implementation (with reduced features).\n\n## Getting Started\n\n### Pre-requisites\n\n* yarn (`npm install -g yarn`)\n* Node 10.x\n* node-gyp: https://github.com/nodejs/node-gyp#installation\n\n### Try the starter app\n\n```bash\ngit clone https://gist.github.com/ebc48856b74fde392a6d62a032b59a97.git forking-edge\ncd forking-edge\nyarn install\nyarn start # visit http://localhost:3000\n```\n\nOnce you have that running, try swapping in a different origin. Edit `index.ts` and and replace `backends.origin(\"https://getting-started.edgeapp.net\")` with `backends.githubPages(\"superfly/landing\")`.\n\n### Deploy to production\n\nYou can deploy edge apps to the Fly hosting service using the CLI. Sign up at fly.io, then run:\n\n```bash\nyarn fly login\nyarn fly app create \u003cname-of-your-app\u003e\nyarn fly deploy\n```\n\nYou can also run on CloudFlare or StackPath, though not all features will work.\n\n## Features\n\n### Straightforward TypeScript/ JavaScript API\n\nYou can do a lot with a single `index.ts` file. This example redirects all requests to `https` and caches content when possible:\n\n```typescript\nimport { backends, middleware, pipeline } from \"@fly/edge\";\n\n// user middleware for https redirect and caching\nconst mw = pipeline(\n  middleware.httpsUpgrader,\n  middleware.httpCache\n)\n\n// point it at the origin\nconst app = mw(\n  backends.origin(\"https://getting-started.edgeapp.net\")\n);\n\n// respond to http requests\nfly.http.respondWith(app);\n```\n\n### Backends\n\n[Backends](https://github.com/superfly/edge/tree/master/src/backends) are origin services you can route requests to. The project includes a backend type [any HTTP service](https://github.com/superfly/edge/blob/master/src/backends/origin.ts), and more specialized types for proxying to third party services.\n\n* [GitHub Pages](https://github.com/superfly/edge/blob/master/src/backends/github_pages.ts)\n* [Heroku](https://github.com/superfly/edge/blob/master/src/backends/heroku.ts)\n* [Ghost Pro](https://github.com/superfly/edge/blob/master/src/backends/ghost_pro.ts)\n* [Glitch](https://github.com/superfly/edge/blob/master/src/backends/glitch.ts)\n* [Netlify](https://github.com/superfly/edge/blob/master/src/backends/netlify.ts)\n\nWant to help out? Write a new backend type and open a [pull request](https://github.com/superfly/edge/compare?template=backend_type.md)!\n\n### Middleware\n\n[Middleware](https://github.com/superfly/edge/tree/master/src/middleware) applies logic to requests before they're sent to the backend, and responses before they're sent to users.\n\n* [HTTP -\u003e HTTPS upgrader](https://github.com/superfly/edge/blob/master/src/middleware/https-upgrader.ts)\n* [Add response headers](https://github.com/superfly/edge/blob/master/src/middleware/response-headers.ts)\n* [HTTP caching](https://github.com/superfly/edge/blob/master/src/middleware/http-cache.ts)\n\n## Development\n\nSee [CONTRIBUTING](https://github.com/superfly/edge/blob/master/CONTRIBUTING.md).\n\n## Configuration vs code\n\nThe Fly Edge can be run standalone with a yaml based configuration schema. If you prefer to run with a config file, check out the config [README](https://github.com/superfly/edge/blob/master/src/config/README.md).\n\n## Who's using it?\n\n* cars.com: HTTP routing\n* glitch.com: custom domain routing\n* fontawesome.com: CDN for paid customers\n* distractify.com: routing, caching, redirect management\n* greenmatters.com: routing, caching, redirect management\n* artstorefronts.com: custom domain routing\n* kajabi.com: custom domain routing\n* posthaven.com: custom domain routing\n\n[![](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/flydotio)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperfly%2Fedge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperfly%2Fedge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperfly%2Fedge/lists"}