Cloudflare Workers
Deploy stubIdP as a Cloudflare Worker for a globally distributed, zero-maintenance OIDC server backed by D1 persistent storage.
Deployment
Section titled “Deployment”Click the button below. Cloudflare will fork the repository, create a D1 database, and deploy the Worker automatically.
After deployment, override the default client credentials in the Cloudflare dashboard under Workers & Pages → stubidp → Settings → Variables:
| Variable | Description |
|---|---|
STUBIDP_CLIENT_ID | OAuth 2.0 client ID |
STUBIDP_CLIENT_SECRET | OAuth 2.0 client secret |
STUBIDP_REDIRECT_URI | Allowed redirect URI |
STUBIDP_ISSUER | (Optional) Override the issuer URL — auto-detected from the request URL if omitted |
Fork the repository and add the following secrets and variables under Settings → Secrets and variables → Actions:
| Name | Type | Description |
|---|---|---|
CLOUDFLARE_API_TOKEN | Secret | API token with Workers Scripts: Edit and D1: Edit permissions |
CLOUDFLARE_ACCOUNT_ID | Secret | Your Cloudflare account ID |
STUBIDP_ISSUER | Variable | (Optional) Issuer URL override |
Every push to main (or a manual trigger) will:
- Create the
stubidp-dbD1 database if it does not exist yet. - Apply any pending migrations.
- Deploy the Worker.
-
Create the D1 database and note the returned
database_id:Terminal window npx wrangler d1 create stubidp-db -
Update
wrangler.jsonwith the realdatabase_id, then apply migrations:Terminal window npx wrangler d1 migrations apply stubidp-db --remote -
Deploy the Worker:
Terminal window npm run worker:deploy
Local development
Section titled “Local development”cp .dev.vars .dev.vars.local # optional: override vars locallynpm run worker:migrate:localnpm run worker:dev # runs at http://localhost:8787Discovery URL during local dev: http://localhost:8787/.well-known/openid-configuration