{"id":27139352,"url":"https://github.com/sterlingwes/decap-proxy","last_synced_at":"2025-04-08T04:57:51.990Z","repository":{"id":236369509,"uuid":"792471466","full_name":"sterlingwes/decap-proxy","owner":"sterlingwes","description":"A Cloudflare Worker Github OAuth proxy for Decap CMS. Allows redirecting to the authorization flow and calling back to Decap.","archived":false,"fork":false,"pushed_at":"2025-01-15T14:00:57.000Z","size":71,"stargazers_count":32,"open_issues_count":1,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-15T15:54:53.081Z","etag":null,"topics":["cloudflare","cloudflare-workers","decap-cms","github","oauth"],"latest_commit_sha":null,"homepage":"","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/sterlingwes.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}},"created_at":"2024-04-26T18:30:05.000Z","updated_at":"2025-01-15T14:00:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"f0bc11eb-9d32-415e-8969-6c7a89b42ca2","html_url":"https://github.com/sterlingwes/decap-proxy","commit_stats":null,"previous_names":["sterlingwes/decap-proxy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterlingwes%2Fdecap-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterlingwes%2Fdecap-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterlingwes%2Fdecap-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterlingwes%2Fdecap-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sterlingwes","download_url":"https://codeload.github.com/sterlingwes/decap-proxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247779702,"owners_count":20994573,"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","decap-cms","github","oauth"],"created_at":"2025-04-08T04:57:51.593Z","updated_at":"2025-04-08T04:57:51.974Z","avatar_url":"https://github.com/sterlingwes.png","language":"TypeScript","funding_links":[],"categories":["OAuth Client"],"sub_categories":[],"readme":"# decap-proxy\n\nA Cloudflare Worker Github OAuth proxy for [Decap CMS](https://github.com/decaporg/decap-cms). This allows for deploying Decap without the Netlify Identity or Git Gateway services required to handle Github authentication so that the CMS client can make Github API calls.\n\nThis proxy is intended to be deployed on its own subdomain, separate from whatever website domain you're using Decap with.\n\n## Getting Started\n\n### Create a Github OAuth App\n\nYou'll need to [configure a Github OAuth application](https://github.com/settings/applications/new). Your `Application callback URL` must be the domain you deploy your worker to with the `/callback` path. Based on the sample configuration below, that would mean `https://decap.mydomain.com/callback`.\n\nSave the OAuth client ID and secret for later, you'll need to provide those secrets to the worker.\n\nIf your GitHub repo (where you want Decap CMS to push content to) is private, you will have to change the scope in `index.ts` to:\n```typescript\nscope: 'repo,user'\n```\nSo, your code after the change should look like:\n```typescript\nconst authorizationUri = oauth2.authorizeURL({\n  redirect_uri: `https://${url.hostname}/callback?provider=github`,\n  scope: 'repo,user',\n  state: randomBytes(4).toString('hex'),\n});\n```\n\n### Configure \u0026 Deploy the Worker\n\nClone the repo and `cp wrangler.toml.sample wrangler.toml`.\n\nConfigure / login with wrangler (`npx wrangler login`).\n\nDeploy after tweaking your wrangler.toml as needed (`npx wrangler deploy`).\n\nNote that you'll likely want to make the following change to your wrangler.toml:\n\n```diff\nname = \"decap-proxy\"\nmain = \"src/index.ts\"\ncompatibility_date = \"2024-04-19\"\ncompatibility_flags = [\"nodejs_compat\"]\n\n+workers_dev = false\n+route = { pattern = \"decap.mydomain.com\", zone_name = \"mydomain.com\", custom_domain = true }\n```\n\nWhere `zone_name` is a domain you already host on cloudflare for DNS, and `pattern` is the subdomain you've chosen (if different).\n\nDisabling `workers_dev` is how you disable the default workers.dev preview domain, if that's something you want.\n\n#### Configure OAuth Secrets\n\nUsing the OAuth application credentials you saved from the first section, you'll enter these as `GITHUB_OAUTH_ID` and `GITHUB_OAUTH_SECRET` secret values for your worker (nested under: `Compute (Workers) \u003e Workers \u0026 Pages` \u003e `Your Worker (decap-proxy)` \u003e `Settings` \u003e `Variables and Secrets` \u003e `+ Add` and change the type to **Secret**).\n\nAlternatively, you can also add secrets via Wrangler:\n\n```bash\nnpx wrangler secret put GITHUB_OAUTH_ID\nnpx wrangler secret put GITHUB_OAUTH_SECRET\n```\n\n### Point to Proxy in Decap Config\n\nAdd the `base_url` for your proxy to the backend section of Decap's `config.yml`:\n\n```diff\nsite_url: https://your-site-powered-by-decap.com\nsearch: false\nbackend:\n  name: github\n  branch: main\n  repo: \"github-user/repo\"\n+  base_url: https://decap.mydomain.com\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsterlingwes%2Fdecap-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsterlingwes%2Fdecap-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsterlingwes%2Fdecap-proxy/lists"}