{"id":50021350,"url":"https://github.com/forage409/authcore","last_synced_at":"2026-05-20T08:01:42.583Z","repository":{"id":358883183,"uuid":"1243118319","full_name":"Forage409/authcore","owner":"Forage409","description":"NEXUS / AuthCore — Auth-as-a-Service on Cloudflare Workers","archived":false,"fork":false,"pushed_at":"2026-05-19T13:46:19.000Z","size":165,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-19T15:12:41.182Z","etag":null,"topics":["authentication","cloudflare-workers","identity-provider","oidc","openid-connect","sso"],"latest_commit_sha":null,"homepage":"https://auth.miaogou.site","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/Forage409.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-19T04:12:37.000Z","updated_at":"2026-05-19T13:50:24.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Forage409/authcore","commit_stats":null,"previous_names":["forage409/authcore"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Forage409/authcore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Forage409%2Fauthcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Forage409%2Fauthcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Forage409%2Fauthcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Forage409%2Fauthcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Forage409","download_url":"https://codeload.github.com/Forage409/authcore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Forage409%2Fauthcore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33251252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-20T04:48:54.280Z","status":"ssl_error","status_checked_at":"2026-05-20T04:48:10.851Z","response_time":356,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["authentication","cloudflare-workers","identity-provider","oidc","openid-connect","sso"],"created_at":"2026-05-20T08:00:48.571Z","updated_at":"2026-05-20T08:01:42.577Z","avatar_url":"https://github.com/Forage409.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# AuthCore\n\n**Open-source Auth-as-a-Service on Cloudflare Workers**\nPassword auth · OpenID Connect SSO · JWT + refresh tokens · User moderation · Deploy in 5 minutes\n\n[![npm version](https://img.shields.io/npm/v/nexus-auth-sdk.svg?color=1a1a1a)](https://www.npmjs.com/package/nexus-auth-sdk)\n[![npm downloads](https://img.shields.io/npm/dm/nexus-auth-sdk.svg?color=1a1a1a)](https://www.npmjs.com/package/nexus-auth-sdk)\n[![License](https://img.shields.io/github/license/Forage409/authcore.svg?color=1a1a1a)](LICENSE)\n[![Stars](https://img.shields.io/github/stars/Forage409/authcore.svg?style=social)](https://github.com/Forage409/authcore/stargazers)\n\n[**Live Playground**](https://playground.miaogou.site) · [**Dashboard**](https://auth.miaogou.site) · [**npm**](https://www.npmjs.com/package/nexus-auth-sdk) · [**Scaffolding CLI**](https://www.npmjs.com/package/create-nexus-auth)\n\nNo sign-up needed — [**try it now**](https://playground.miaogou.site): Register → Login → OIDC SSO → Ban demo\n\n[**中文文档 / Chinese Docs**](README.zh-CN.md)\n\n\u003c/div\u003e\n\n---\n\n## 30-Second Setup\n\n```bash\nnpx create-nexus-auth my-app    # scaffold a full auth app in one command\ncd my-app \u0026\u0026 npm install \u0026\u0026 npm run dev\n```\n\nOr use the SDK directly:\n\n```ts\nimport { AuthCore, AccountBannedError } from 'nexus-auth-sdk';\n\nconst auth = new AuthCore({ apiKey: 'nx_xxx' });\n\n// Register (handles email verification / captcha automatically)\nawait auth.register({ email, password });\n\n// Login returns JWT + Refresh Token\nconst { token, refreshToken, user } = await auth.login({ email, password });\n\n// Verify any token (password login + OIDC auto-detected)\nconst { valid, source } = await auth.verifyAny(token);  // source: 'jwt' | 'oidc'\n\n// Named error classes — no hardcoded error strings\ntry { await auth.login({ email, password }); }\ncatch (e) {\n  if (e instanceof AccountBannedError) showBannedUI(e.reason);\n  else throw e;\n}\n```\n\n## How It Works\n\n```\n   Your App (Browser)                                    AuthCore Gateway\n   ──────────────────                                   ─────────────────\n        │                                                       │\n        │  1. POST /auth/register { email, password }           │\n        │ ─────────────────────────────────────────────────►    │\n        │                                                       │\n        │                                  PBKDF2 100k + salt   │\n        │                                  Store in D1 (users)  │\n        │                                  Issue JWT + Refresh  │\n        │                                                       │\n        │ ◄─────────────────────────────────────────────────    │\n        │     { token, refreshToken, user }                     │\n        │                                                       │\n        │  2. GET /auth/verify  Bearer \u003ctoken\u003e                  │\n        │ ─────────────────────────────────────────────────►    │\n        │                         If account is banned →        │\n        │                         instant 403 response          │\n        │ ◄─────────────────────────────────────────────────    │\n        │                                                       │\n        │  3. JWT expires (1h), auto-refresh (SDK handles it)   │\n        │ ─────────────────────────────────────────────────►    │\n        │ ◄─────────────────────────────────────────────────    │\n        │     { token (new), refreshToken (rotated) }           │\n```\n\n```\n   OIDC SSO Client                                       AuthCore Gateway\n   ────────────────                                     ─────────────────\n        │                                                       │\n        │  /oauth/authorize ?response_type=code \u0026PKCE \u0026state    │\n        │ ─────────────────────────────────────────────────►    │\n        │                                                       │\n        │       User confirms on AuthCore consent page          │\n        │                                                       │\n        │ ◄── 302 redirect_uri ?code=xxx \u0026state=yyy ──────     │\n        │                                                       │\n        │  POST /oauth/token { code, code_verifier }            │\n        │ ─────────────────────────────────────────────────►    │\n        │ ◄── { access_token, refresh_token, id_token (RS256) } │\n        │                                                       │\n        │  GET /oauth/userinfo  Bearer \u003caccess_token\u003e           │\n        │ ─────────────────────────────────────────────────►    │\n        │ ◄── { sub, email, name, picture, email_verified } ──  │\n```\n\n## Why AuthCore?\n\n|  | AuthCore | Auth0 | Clerk | DIY |\n|---|---|---|---|---|\n| Deploy | CF Workers, 5 min | Closed SaaS | Closed SaaS | Weeks to months |\n| Price | **Free** (self-host) | From $25/mo | From $25/mo | Engineering cost |\n| OIDC SSO | ✓ | ✓ | ✓ | Build it yourself |\n| User ban / moderation | ✓ | Partial | Partial | Build it yourself |\n| 14-day account deletion | ✓ | Partial | Partial | Build it yourself |\n| Source code | MIT, fully open | ✗ | ✗ | Your code |\n\n## Features\n\n**Authentication \u0026 Authorization**\n- Email + password registration with PBKDF2 (100k iterations + random salt)\n- JWT (1h) + Refresh Token (30d sliding window)\n- Full OpenID Connect Provider (RS256 + JWKS + PKCE + state/nonce validation)\n- 6 OIDC endpoints + Google-style consent page\n\n**Security**\n- Brute-force protection (5 attempts / 15 min lockout)\n- API key IP allowlist, SSRF protection, security headers\n- Full account ban system (4 identity tables + permanent audit log)\n- Named error classes (`AccountBannedError` / `ApiKeyBannedError` / `AppBannedError`)\n\n**Compliance**\n- Self-service 14-day account deletion + cron hard-delete\n- Public abuse report endpoint `/api/abuse/report` (rate-limited)\n- Banned content retained 90 days for legal response\n\n**Developer Experience**\n- Webhooks with `app_id` field for multi-key routing\n- 4 granular 403 error codes propagated end-to-end through the SDK\n- React hooks: `useAuth()`, `useOIDC()`\n\n## Repository Structure\n\n| Directory | Description |\n|-----------|-------------|\n| [`workers/nexus-gateway/`](workers/nexus-gateway) | Auth gateway Worker (Hono + D1 + R2), entry: [`index.ts`](workers/nexus-gateway/index.ts) |\n| [`workers/nexus-gateway/sdk/`](workers/nexus-gateway/sdk) | npm package `nexus-auth-sdk` source |\n| [`workers/migrations/`](workers/migrations) | D1 database migration scripts |\n| [`create-authcore-app/`](create-authcore-app) | npm package `create-nexus-auth` — scaffolding CLI |\n\n## Self-Hosting\n\n### 1. Create Cloudflare Resources\n\n```bash\nnpx wrangler d1 create nexus-db\nnpx wrangler r2 bucket create nexus-avatars\n```\n\nAdd the `database_id` to [`workers/nexus-gateway/wrangler.toml`](workers/nexus-gateway/wrangler.toml).\n\n### 2. Run Migrations\n\n```bash\ncd workers/nexus-gateway\nnpx wrangler d1 execute nexus-db --file=../migrations/0004_api_keys.sql --remote\nnpx wrangler d1 execute nexus-db --file=../migrations/0005_oauth_codes.sql --remote\n# ... run gateway-related SQL files in order\n```\n\n### 3. Set Secrets\n\n```bash\ncd workers/nexus-gateway\nnpx wrangler secret put JWT_SECRET           # random 32+ char string\nnpx wrangler secret put RESEND_API_KEY       # Resend email API key\nnpx wrangler secret put PLATFORM_OWNERS      # admin emails, comma-separated\n```\n\n### 4. Deploy\n\n```bash\ncd workers/nexus-gateway \u0026\u0026 npx wrangler deploy\n```\n\n## npm Packages\n\n```bash\nnpm install nexus-auth-sdk        # SDK\nnpx create-nexus-auth my-app      # scaffolding CLI\n```\n\n- [`nexus-auth-sdk`](https://www.npmjs.com/package/nexus-auth-sdk) — 4 entry points: `/` (core), `/react`, `/oidc`, `/oidc-react`\n- [`create-nexus-auth`](https://www.npmjs.com/package/create-nexus-auth) — 3 templates: full (frontend + backend), oidc-only (SPA), backend-only\n\n## Tech Stack\n\n- **Runtime**: Cloudflare Workers + Hono + TypeScript\n- **Database**: D1 (SQLite) + R2 (avatars)\n- **Email**: Resend\n- **CAPTCHA**: Alibaba Cloud ESA Edge CAPTCHA\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforage409%2Fauthcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforage409%2Fauthcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforage409%2Fauthcore/lists"}