{"id":15715717,"url":"https://github.com/syumai/workers","last_synced_at":"2025-05-15T00:07:44.484Z","repository":{"id":38236812,"uuid":"493301590","full_name":"syumai/workers","owner":"syumai","description":"Go package to run an HTTP server on Cloudflare Workers.","archived":false,"fork":false,"pushed_at":"2025-05-03T01:47:10.000Z","size":451,"stargazers_count":817,"open_issues_count":23,"forks_count":51,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-03T02:55:22.724Z","etag":null,"topics":["cloudflare","cloudflare-workers","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"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/syumai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2022-05-17T15:06:31.000Z","updated_at":"2025-05-03T01:57:11.000Z","dependencies_parsed_at":"2023-11-07T14:29:59.129Z","dependency_job_id":"dbfbd90e-a2dc-4859-955d-bedc3e2868d5","html_url":"https://github.com/syumai/workers","commit_stats":{"total_commits":342,"total_committers":17,"mean_commits":20.11764705882353,"dds":"0.22807017543859653","last_synced_commit":"a7fb285264f92236ee8eb56e6146878fac1b33b9"},"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syumai%2Fworkers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syumai%2Fworkers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syumai%2Fworkers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syumai%2Fworkers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syumai","download_url":"https://codeload.github.com/syumai/workers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249197,"owners_count":22039029,"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":["cloudflare","cloudflare-workers","go","golang"],"created_at":"2024-10-03T21:42:33.558Z","updated_at":"2025-05-15T00:07:39.473Z","avatar_url":"https://github.com/syumai.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# workers\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/syumai/workers.svg)](https://pkg.go.dev/github.com/syumai/workers)\n[![Discord Server](https://img.shields.io/discord/1095344956421447741?logo=discord\u0026style=social)](https://discord.gg/tYhtatRqGs)\n\n* `workers` is a package to run an HTTP server written in Go on [Cloudflare Workers](https://workers.cloudflare.com/).\n* This package can easily serve *http.Handler* on Cloudflare Workers.\n* Caution: This is an experimental project.\n\n## Features\n\n* [x] serve http.Handler\n* [ ] R2\n  - [x] Head\n  - [x] Get\n  - [x] Put\n  - [x] Delete\n  - [x] List\n  - [ ] Options for R2 methods\n* [ ] KV\n  - [x] Get\n  - [x] List\n  - [x] Put\n  - [x] Delete\n  - [ ] Options for KV methods\n* [x] Cache API\n* [ ] Durable Objects\n  - [x] Calling stubs\n* [x] D1 (alpha)\n* [x] Environment variables\n* [x] FetchEvent\n* [x] Cron Triggers\n* [x] TCP Sockets\n* [x] Queues\n  - [x] Producer\n  - [x] Consumer\n\n## Installation\n\n```\ngo get github.com/syumai/workers\n```\n\n## Usage\n\nimplement your http.Handler and give it to `workers.Serve()`.\n\n```go\nfunc main() {\n\tvar handler http.HandlerFunc = func (w http.ResponseWriter, req *http.Request) { ... }\n\tworkers.Serve(handler)\n}\n```\n\nor just call `http.Handle` and `http.HandleFunc`, then invoke `workers.Serve()` with nil.\n\n```go\nfunc main() {\n\thttp.HandleFunc(\"/hello\", func (w http.ResponseWriter, req *http.Request) { ... })\n\tworkers.Serve(nil) // if nil is given, http.DefaultServeMux is used.\n}\n```\n\nFor concrete examples, see `_examples` directory.\n\n## Quick Start\n\n* You can easily create and deploy a project from `Deploy to Cloudflare` button.\n\n[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https%3A%2F%2Fgithub.com%2Fsyumai%2Fworker-go-deploy)\n\n* If you want to create a project manually, please follow the guide below.\n\n### Requirements\n\n* Node.js (and npm)\n* Go 1.24.0 or later\n\n### Create a new Worker project\n\nRun the following command:\n\n```console\nnpm create cloudflare@latest -- --template github.com/syumai/workers/_templates/cloudflare/worker-go\n```\n\n### Initialize the project\n\n1. Navigate to your new project directory:\n\n```console\ncd my-app\n```\n\n2. Initialize Go modules:\n\n```console\ngo mod init\ngo mod tidy\n```\n\n3. Start the development server:\n\n```console\nnpm start\n```\n\n4. Verify the worker is running:\n\n```console\ncurl http://localhost:8787/hello\n```\n\nYou will see **\"Hello!\"** as the response.\n\nIf you want a more detailed description, please refer to the README.md file in the generated directory.\n\n## FAQ\n\n### How do I deploy a worker implemented in this package?\n\nTo deploy a Worker, the following steps are required.\n\n* Create a worker project using [wrangler](https://developers.cloudflare.com/workers/wrangler/).\n* Build a Wasm binary.\n* Upload a Wasm binary with a JavaScript code to load and instantiate Wasm (for entry point).\n\nThe [worker-go template](https://github.com/syumai/workers/tree/main/_templates/cloudflare/worker-go) contains all the required files, so I recommend using this template.\n\nBut Go (not TinyGo) with many dependencies may exceed the size limit of the Worker (3MB for free plan, 10MB for paid plan). In that case, you can use the [TinyGo template](https://github.com/syumai/workers/tree/main/_templates/cloudflare/worker-tinygo) instead.\n\n### Where can I have discussions about contributions, or ask questions about how to use the library?\n\nYou can do both through GitHub Issues. If you want to have a more casual conversation, please use the [Discord server](https://discord.gg/tYhtatRqGs).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyumai%2Fworkers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyumai%2Fworkers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyumai%2Fworkers/lists"}