Documentation Menu
Installation
Complete guide to deploying OpenAuthster and integrating it into your application.
Architecture Overview
OpenAuthster requires deploying two components in sequence:
- OpenAuthster Issuer - The authentication server (Cloudflare Worker)
- OpenAuthster WebUI - The management dashboard (Cloudflare Pages)
Once deployed, you integrate the client SDK into your application.
Part 1: Deploy the Issuer
The issuer is the core authentication server. Deploy it first.
Prerequisites
- Wrangler CLI installed globally
- Bun.js or Node.js
- Cloudflare account with Workers and D1 access
# Install Wrangler globally
bun add -g wrangler
# or
npm install -g wrangler1. Clone the Repository
Clone as a private repository (recommended for production):
git clone https://github.com/shpaw415/OpenAuthSter-issuer.git openauth-issuer
cd openauth-issuer⚠️ Security: Keep your issuer repository private - it contains sensitive authentication configuration.
2. Install Dependencies
bun install3. Configure Wrangler
# Rename example config
mv wrangler.example.json wrangler.json
# Generate TypeScript types
wrangler types4. Create D1 Database
wrangler d1 create openauth-dbCopy the database_id and database_name from the output.
5. Update wrangler.json
Edit wrangler.json with your database credentials and environment variables:
{
"d1_databases": [
{
"binding": "AUTH_DB",
"database_name": "openauth-db",
"database_id": "your-database-id-here",
"migrations_dir": "drizzle/migrations",
"remote": true
}
],
"vars": {
"WEBUI_ADMIN_EMAILS": "admin@example.com",
"WEBUI_ORIGIN_URL": "https://admin.yourdomain.com",
"ISSUER_URL": "https://auth.yourdomain.com"
}
}6. Run Database Migrations
wrangler d1 migrations apply AUTH_DB --remote7. Configure OpenAuth
Edit openauth.config.ts:
// openauth.config.ts
export default async (env: Env) =>
createExternalGlobalProjectConfig({
register: {
fallbackEmailFrom: "noreply@yourdomain.com",
strategy: {
email: {
provider: "custom", // or "resend"
sendEmailFunction(to, code) {
console.log(`Send code ${code} to email ${to}`);
},
},
},
},
});8. Deploy to Cloudflare Workers
- Create a private GitHub repository and push your code
- Go to Cloudflare Dashboard → Workers & Pages
- Click "Create application" → "Create Worker"
- Connect to your GitHub repository
- Cloudflare will deploy using your
wrangler.jsonconfiguration
Your issuer is now deployed! 🎉
Part 2: Deploy the WebUI
The WebUI allows you to manage projects, themes, and providers.
Prerequisites
- Issuer deployed from Part 1
- Same D1 database credentials
1. Clone the Repository
git clone https://github.com/shpaw415/OpenAuthSter-webUI.git openauth-webui
cd openauth-webui2. Install Dependencies
bun install3. Configure wrangler.jsonc
# Rename example config
mv wrangler.example.jsonc wrangler.jsoncEdit wrangler.jsonc with your configuration:
{
"$schema": "./node_modules/wrangler/config-schema.json",
"name": "openauthster-webui",
"pages_build_output_dir": ".frame-master/build",
"compatibility_date": "2025-11-09",
"d1_databases": [
{
"binding": "PROJECT_DB",
"database_name": "<YOUR_D1_DATABASE_NAME>",
"database_id": "<YOUR_D1_DATABASE_ID>",
"migrations_dir": "drizzle/migrations",
"remote": true,
},
],
"vars": {
// Redirect URI for your OpenAuthster-webui instance
// e.g. https://webui.yourdomain.com/
"PUBLIC_REDIRECT_URI": "<YOUR_WEBUI_URL>/",
// Issuer URL for your OpenAuthster-issuer instance
// e.g. https://auth.yourdomain.com
"PUBLIC_ISSUER": "<YOUR_ISSUER_URL>",
// Cloudflare API Token with permissions to manage Workers
"CLOUDFLARE_API_TOKEN": "<YOUR_CLOUDFLARE_API_TOKEN>",
// Cloudflare Account ID where your Cloudflare Worker OpenAuthster-issuer instance is deployed
"CLOUDFLARE_ACCOUNT_ID": "<YOUR_CLOUDFLARE_ACCOUNT_ID>",
// Cloudflare Zone ID for the domain used for auth endpoints
// it must match the domain set in CLOUDFLARE_AUTH_ENDPOINT_DOMAIN
"CLOUDFLARE_AUTH_DOMAIN_ZONE_ID": "<YOUR_CLOUDFLARE_AUTH_DOMAIN_ZONE_ID>",
// Add your Cloudflare Worker Service name here
// it's the name given to your Cloudflare Worker that is serving your OpenAuthster-issuer instance
"CLOUDFLARE_WORKER_SERVICE_NAME": "<YOUR_WORKER_SERVICE_NAME>",
/* (Optional)
Add your custom auth endpoint domain here e.g. auth.yourdomain.com.
it will be used to create auth endpoints for your projects as a suffix.
you must be the owner of the domain and have it added to your Cloudflare account.
If not set, PUBLIC_ISSUER will be used as the auth endpoint domain.
e.g. https://auth.yourdomain.com
*/
"CLOUDFLARE_AUTH_ENDPOINT_DOMAIN": "<YOUR_AUTH_ENDPOINT_DOMAIN>",
// Do not changes the followings
"BUN_VERSION": "1.3.4",
"SKIP_DEPENDENCY_INSTALL": "true",
"PUBLIC_CLIENT_ID": "openauth_webui",
},
"compatibility_flags": ["nodejs_compat"],
}Note: Use the same D1 database as your issuer.
4. Deploy to Cloudflare Pages
- Create a private GitHub repository and push your code
- Go to Cloudflare Dashboard → Pages
- Click "Create a project" → "Connect to Git"
- Select your repository
- Configure build settings:
- Build command:
bun install --frozen-lockfile && NODE_ENV=production bun run build - Build output directory:
.frame-master/build
- Build command:
- Add all environment variables from your
wrangler.jsonc - Deploy!
Your WebUI is now live! 🎉
Visit your WebUI URL and create your first project.
Part 3: Client SDK
For Local Development
Clone the shared types repository:
git clone https://github.com/shpaw415/OpenAuthSter-shared.gitnpm Installation
# Coming soon
npm install openauthster-sharedRelated Repositories
- OpenAuthster – Main project overview
- OpenAuthster Issuer – Authentication server
- OpenAuthster WebUI – Management dashboard
- OpenAuthster Shared – Client SDK and types
- openauth-react – React integration (WIP)
- openauthster-doc – This documentation site
Package Exports
The package exposes several entry points you can import from:
| Import Path | Contents |
|---|---|
openauthster-shared | Types, constants, provider registry |
openauthster-shared/client | Low-level createClient / createServerClient (raw OpenAuth client with cookies) |
openauthster-shared/client/user | OpenAuthsterClient class + createOpenAuthsterClient factory (recommended) |
openauthster-shared/database | Drizzle ORM schemas for D1 |
openauthster-shared/endpoints | API endpoint type definitions |
For most apps you only need openauthster-shared/client/user.
TypeScript
The package ships with full TypeScript types. No @types/* package is needed.
You can provide generic type parameters for your session shapes:
import { createOpenAuthsterClient } from "openauthster-shared/client/user";
type PublicData = { displayName: string; theme: "light" | "dark" };
type PrivateData = { internalRole: string };
const client = createOpenAuthsterClient<PublicData, PrivateData>({
clientID: "my_project",
issuerURI: "https://auth.yourdomain.com",
redirectURI: "https://myapp.com/",
copyID: null,
});
// client.data.public is typed as PublicData
// client.data.private is typed as PrivateData