๐ Authentication at the Speed of Light - Globally distributed, zero-latency auth built on Cloudflare's edge
Core Capabilities: JWT Authentication | OAuth 2.0 Provider | SSO Sessions | Admin Management
Serverless authentication service that runs on Cloudflare Workers - simple, secure, and globally fast
Architecture | Schema | API
Built on Cloudflare Workers, your authentication runs in 300+ cities worldwide. Users get sub-10ms response times, no matter where they are.
No complex setup. No infrastructure management. Just deploy and use.
// That's it. Authentication in 3 lines.
const token = await auth.login(email, password);
const user = await auth.verify(token);
const session = await sso.createSession(user);Built with Domain-Driven Design and clean architecture principles:
- Domain Layer: Pure business logic
- Core Layer: Technical implementation (crypto, JWT, persistence)
- Services Layer: Edge-native workers
- PBKDF2 password hashing with Web Crypto API
- HS256 JWT tokens
- Secure session management
- Built-in rate limiting (coming soon)
# Clone the repository
git clone https://github.com/Deepractice/EdgeAuth.git
cd EdgeAuth
# Install dependencies
pnpm installAutomated deployment via GitHub Actions:
- Create a
release/v0.x.xbranch - Merge to
main - Deployment happens automatically!
Required GitHub Secrets:
CLOUDFLARE_API_TOKEN # Cloudflare API token with D1 and Workers permissions
GH_PAT # GitHub Personal Access Token with repo and workflow permissions
JWT_SECRET # Secret key for JWT signing (generate with: openssl rand -base64 32)
PLUNK_API_KEY # Plunk email service API keyAll secrets are automatically configured to Workers during deployment - no manual Cloudflare secret management needed!
One-command setup:
# Set up local environment (creates local DBs, runs migrations)
pnpm setup:local
# Start a worker
cd services/account-api && wrangler dev๐ Full Deployment Guide โ
- โจ Email/Username + Password Authentication
- ๐ JWT Token Generation & Validation
- ๐ Secure Password Hashing (PBKDF2)
- ๐ Edge-Native Performance
- ๐ฆ Cloudflare D1 Persistence
- ๐ฏ Clean REST API
- ๐ Full TypeScript Support
- ๐ SSO Session Management
- ๐จโ๐ผ Admin Management API
- ๐ OAuth 2.0 Provider (complete)
- ๐ง Email Verification
- ๐ Password Reset Flow
- ๐จ Admin Dashboard (UI)
- ๐ฆ SDK Libraries (JS/TS, Python, Go)
- โก Refresh Token Support
- ๐ฆ Rate Limiting
- ๐ OAuth Providers (GitHub, Google, etc.)
EdgeAuth uses a single database architecture with Cloudflare's native migration system:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ edgeauth-db (Single Database) โ
โ โข users table โ
โ โข sso_sessions table โ
โ โข oauth_clients, tokens tables โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Admin Worker โ โ SSO Worker โ โ OAuth Worker โ
โ โข User CRUD โ โ โข Auth flow โ โ โข OAuth 2.0 โ
โ โข Binds: DB โ โ โข Binds: DB โ โ โข Binds: DB โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
edgeauth-db- All tables in one databaseusers- User accountssso_sessions- SSO sessionsoauth_clients,authorization_codes,access_tokens,refresh_tokens- OAuth
- โ Cloudflare native migrations (automatic tracking)
- โ Idempotent deployments
- โ Simplified management
- โ No cross-database complexity
๐ Read Full Architecture Docs โ
POST /auth/register
Content-Type: application/json
{
"email": "user@example.com",
"username": "username",
"password": "securepassword"
}POST /auth/login
Content-Type: application/json
{
"account": "user@example.com", // email or username
"password": "securepassword"
}Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "user_123",
"email": "user@example.com",
"username": "username"
}
}GET /auth/me
Authorization: Bearer <token># Run all tests
pnpm test
# Watch mode
pnpm test:dev
# Coverage
pnpm test:cipnpm typecheck# Format all files
pnpm format
# Check formatting
pnpm format:check| Category | Technology |
|---|---|
| Runtime | Cloudflare Workers |
| Database | Cloudflare D1 (SQLite) |
| Framework | Hono |
| Language | TypeScript 5.9+ |
| Build | tsup, Turbo |
| Test | Vitest + BDD (Cucumber) |
| Security | Web Crypto API (PBKDF2), JWT (HS256) |
| Monorepo | pnpm workspaces |
EdgeAuth/
โโโ migrations/ # Database migrations (Cloudflare native)
โโโ src/
โ โโโ core/ # Technical core (crypto, JWT, persistence)
โ โโโ domain/ # Business logic (User, OAuth, SSO)
โโโ services/
โ โโโ admin-api/ # Admin API
โ โโโ account-api/ # User registration & login
โ โโโ oauth-api/ # OAuth 2.0 Provider
โ โโโ sso-api/ # SSO authentication
โโโ .github/workflows/ # CI/CD pipelines
โโโ docs/ # Documentation
โโโ scripts/ # Development scripts
Contributions are welcome! Please read our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Proudly brought to you by Deepractice
Making AI your professional partner
๐ Official Site | ๐ง GitHub | ๐ Documentation | ๐ฌ Forum | ๐ฎ Discord
Scan to connect with Sean (Founder & CEO) on WeChat
- ๐ Documentation
- ๐ GitHub Issues
- ๐ฌ Discord Community
- ๐ Deepractice