{"id":14006931,"url":"https://github.com/Erisa/multi-render","last_synced_at":"2025-07-24T00:32:39.290Z","repository":{"id":166127473,"uuid":"641575264","full_name":"Erisa/multi-render","owner":"Erisa","description":"Serve multiple R2 buckets from the same Worker, with different settings","archived":false,"fork":false,"pushed_at":"2024-05-04T19:59:45.000Z","size":76,"stargazers_count":24,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-04T20:43:34.185Z","etag":null,"topics":["cloudflare","cloudflare-r2","cloudflare-worker","cloudflare-workers","r2","workers"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Erisa.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-16T19:00:49.000Z","updated_at":"2024-05-04T19:59:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"34277999-235c-40d9-9b74-a6997b3d1af6","html_url":"https://github.com/Erisa/multi-render","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erisa%2Fmulti-render","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erisa%2Fmulti-render/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erisa%2Fmulti-render/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erisa%2Fmulti-render/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Erisa","download_url":"https://codeload.github.com/Erisa/multi-render/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":214780403,"owners_count":15783765,"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-r2","cloudflare-worker","cloudflare-workers","r2","workers"],"created_at":"2024-08-10T10:01:43.201Z","updated_at":"2024-08-10T10:03:28.350Z","avatar_url":"https://github.com/Erisa.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# multi-render\n\nA Cloudflare Workers project showcasing how to have multiple [kotx/render](https://github.com/kotx/render) instances in a single Worker, allowing R2 buckets and settings to vary by domain within the same Worker.\n\n## Setup\n\n1. Clone the repository.\n2. Install dependencies: `npm install`\n3. Edit `wrangler.toml` to change default settings and specify domains and buckets. This repository is setup for my usage so remove my buckets you won't use.\n4. Open `index.ts`, add the buckets to the `Env` type following the example, and add `config` for them below.\n\nE.g. \n\n`wrangler.toml`\n```toml\nroutes = [\n  { pattern = \"mybucket.example.com\", custom_domain = true },\n]\n\n[[r2_buckets]]\nbinding = \"MY_BUCKET\"\nbucket_name = \"mybucket\"\npreview_bucket_name = \"mybucket\"\n```\n\n`index.ts`\n```ts\ninterface Env {\n\tR2_BUCKET: R2Bucket,\n\tALLOWED_ORIGINS?: string,\n\tCACHE_CONTROL?: string,\n\tPATH_PREFIX?: string\n\tINDEX_FILE?: string\n\tNOTFOUND_FILE?: string\n\tDIRECTORY_LISTING?: boolean\n\tHIDE_HIDDEN_FILES?: boolean\n\tDIRECTORY_CACHE_CONTROL?: string\n\n\t// put extra buckets here\n\tMY_BUCKET: R2Bucket\n}\n```\n\n```ts\n\t\tconst config: { [id: string]: RenderEnv; } = {\n\t\t\t\"mybucket.example.com\": {\n\t\t\t\tR2_BUCKET: env.MY_BUCKET,\n\t\t\t\tDIRECTORY_LISTING: true,\n\t\t\t\tINDEX_FILE: 'index_alt.html',\n\t\t\t\tALLOWED_ORIGINS: \"my-other-cool-site.example.com\"\n\t\t\t},\n```\n\nOnce done, `npm run deploy` and enjoy.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FErisa%2Fmulti-render","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FErisa%2Fmulti-render","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FErisa%2Fmulti-render/lists"}