A modern, lightweight, self-hosted auth server built with Cloudflare, Nuxt, and OpenAuth.js.
Nuxflare Auth lets you add authentication to your apps without the headache. It's a monorepo that bundles everything you need:
- A slick auth UI built with Nuxt 3 and @nuxt/ui
- Backend auth magic running on Cloudflare Workers
- A ready-to-use example so you can see how it all fits together
- 🔒 Complete authentication UI including:
- Code-based login
- Password-based login
- Forgot password flow
- User registration
- 🔑 OAuth2 authentication with GitHub and Google (easily add more providers)
- ✉️ Emails using Resend (or use any other provider)
- ⚡ Lightning-fast, powered by Cloudflare's edge network
packages/
├── auth-frontend/ # auth UI components
├── emails/ # react email templates
├── example-client/ # example nuxt client
└── functions/ # cloudflare workers
Before getting started, you'll need:
- pnpm
- A Cloudflare account
- OAuth credentials from Google and GitHub
- A Resend API key for sending emails
-
Clone the repository and install dependencies:
git clone https://github.com/nuxflare/auth nuxflare-auth cd nuxflare-auth pnpm install -
Create and Configure API Token:
a. Create a Cloudflare API token with the required permissions using this link.
b. Set theCLOUDFLARE_API_TOKENenvironment variable:export CLOUDFLARE_API_TOKEN=GahXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -
Configure your secrets:
# OAuth stuff pnpm sst secret set GoogleClientID your_client_id pnpm sst secret set GoogleClientSecret your_client_secret pnpm sst secret set GithubClientID your_client_id pnpm sst secret set GithubClientSecret your_client_secret # For emails pnpm sst secret set ResendApiKey your_resend_api_key
-
Configure your
fromEmailinsst.config.ts:async run() { const fromEmail = "hi@nuxflare.com"; // ... }
-
Start local development:
pnpm dev
-
Deploy to production:
pnpm sst deploy --stage production
Login, signup, sign in with code, and forgot password flows built with Nuxt and Nuxt UI.
The backend consists of two main components:
auth.ts: Core authentication logic handleremails.tsx: Sending emails with Resend
Everything is stored in Cloudflare KV—sessions, users, etc. Plus, it all runs on the edge, so it's super fast.
Check out packages/example-client to see how to add auth to your own app.
Found a bug? Please open an issue on our GitHub repository.
