AuthGate is the open-source platform that gives your SaaS authentication, billing, RBAC, and organization management — configured in TypeScript, deployed anywhere.
Works with your stack
Everything your SaaS needs, nothing it doesn't.
5 OAuth providers, email/password, magic links, MFA, session management. Drop-in React hooks and Next.js middleware.
Define plans in TypeScript, sync to Stripe via CLI. Entitlements, usage tracking, hybrid pricing — all version-controlled.
export default defineBilling({
// Your plans here
})Multi-tenant orgs with RBAC-as-code. Define roles and permissions in TypeScript, sync with one command, enforce with type-safe hooks.
From OAuth to MFA in minutes, not months
Multi-provider OAuth
Google, GitHub, Discord, Azure, Apple with zero config.
Email + magic links + SMS
Multiple auth methods for every user preference.
MFA policies
TOTP, SMS, backup codes. Enforce per role or globally.
Session management
JWT + refresh tokens, revocation, configurable expiry.
// app/api/auth/[...authgate]/route.ts
import { AuthGate } from '@auth-gate/nextjs'
const auth = AuthGate({
providers: ['google', 'github', 'discord'],
})
export const { GET, POST } = auth.handlersDefine your pricing in TypeScript. Sync to Stripe with one command. No billing surcharge — ever.
import { defineBilling } from '@auth-gate/billing'
export default defineBilling({
features: {
api_calls: { type: 'metered', resetPeriod: 'monthly' },
analytics: { type: 'boolean' },
},
plans: {
starter: {
name: 'Starter',
entitlements: { api_calls: { limit: 1000 } },
prices: [
{ amount: 999, currency: 'usd', interval: 'monthly' },
{ amount: 9999, currency: 'usd', interval: 'yearly' },
],
},
pro: {
name: 'Pro',
entitlements: {
api_calls: { limit: 50000 },
analytics: true,
},
prices: [
{ amount: 2999, currency: 'usd', interval: 'monthly' },
{ amount: 29999, currency: 'usd', interval: 'yearly' },
],
},
},
})$ npx @auth-gate/billing sync
AuthGate Billing Sync — DRY RUN
+ CREATE plan "starter"
entitlements: api_calls (limit: 1000)
+ price: $9.99/mo (usd)
+ price: $99.99/yr (usd)
+ CREATE plan "pro"
entitlements: api_calls (limit: 50000), analytics
+ price: $29.99/mo (usd)
+ price: $299.99/yr (usd)
Summary: 2 creates, 0 updates, 0 archives.
Run with --apply to execute.Same config, different targets. Sync to dev, staging, or production with environment-scoped API keys.
Post billing diffs as PR comments with revenue impact. Review price changes like code changes.
Generate Plans, Features, and Limits constants from your config. Full autocomplete in your editor.
Boolean gates and metered limits. Type-safe checks in your app, beautiful dashboards for your users.
import { billing } from '@auth-gate/billing'
// 1. Bill metered usage for a subscription
await billing.reportUsage({
subscriptionId: 'sub_xyz',
metric: 'api_calls',
action: 'set', // supports 'increment' | 'decrement'
quantity: 8500
})
// 2. Adjust limits for a given plan dynamically
await billing.updatePlanLimits({
planId: 'pro',
limits: {
api_calls: 50000
}
})Current billing period
Feb 1 – Feb 28, 2026
17% of limit used
78% of limit used
90% of limit used
Resets in 28 days · Overage charged at $0.002 / extra call
Typed roles, permissions, invitations, and org-level billing. Define access in code, enforce with full autocomplete.
import { createRbacHooks } from '@auth-gate/react'
import { rbac } from '../app/rbac'
export const { useRbac, RbacGate } =
createRbacHooks(rbac)Define resources, roles, and permissions in TypeScript. Sync to AuthGate with one command. Full type inference — like tRPC, but for access control.
import { defineRbac } from '@auth-gate/rbac'
export const rbac = defineRbac({
resources: {
documents: { actions: ['read', 'write', 'delete'] },
billing: { actions: ['read', 'manage'] },
members: { actions: ['invite', 'remove'] },
},
roles: {
viewer: {
name: 'Viewer',
grants: { documents: { read: true } },
},
editor: {
name: 'Editor',
inherits: ['viewer'],
grants: { documents: { write: true } },
},
admin: {
name: 'Admin',
inherits: ['editor'],
grants: {
documents: { delete: true },
billing: { read: true, manage: true },
members: { invite: true, remove: true },
},
},
},
})$ npx @auth-gate/rbac sync
AuthGate RBAC Sync — DRY RUN
Resources
+ CREATE resource "documents"
actions: [read, write, delete]
+ CREATE resource "billing"
actions: [read, manage]
+ CREATE resource "members"
actions: [invite, remove]
Roles
+ CREATE role "viewer"
+ CREATE role "editor"
inherits: [viewer]
+ CREATE role "admin"
inherits: [editor]
Summary: 6 creates, 0 updates, 0 archives.
Run with --apply to execute.Additive-only inheritance — child roles get all parent permissions plus their own grants. Cycle detection at validation time.
Permission strings flow as literal unions from config to hooks. can("documents:write") autocompletes — typos are compile errors.
Config-managed roles appear read-only in the dashboard. Dashboard-created roles are unaffected by sync.
First-class SDKs for web, mobile, and server. TypeScript-first with full type safety.
// app/api/auth/[...authgate]/route.ts
import { AuthGate } from '@auth-gate/nextjs'
const auth = AuthGate({
providers: ['google', 'github'],
callbacks: { onSignIn: (user) => /* ... */ },
});
export const { GET, POST } = auth.handlers
export const { auth: getSession } = auth@auth-gate/core
Framework-agnostic auth client
@auth-gate/nextjs
Next.js middleware + handlers
@auth-gate/react
React hooks + billing components
@auth-gate/react-native
React Native with secure storage
@auth-gate/billing
Billing-as-code CLI + config
@auth-gate/rbac
RBAC-as-code CLI + config
@auth-gate/billing-action
GitHub Action for PR diffs
@auth-gate/testing
E2E, billing & RBAC test helpers
TypeScript-first, config-as-code, and tools that meet you where you work.
Define auth providers, billing plans, roles, and permissions in TypeScript. Version control everything.
AI assistants can create projects, configure billing, and set up roles through the Model Context Protocol.
createTestBilling() for unit tests. @auth-gate/testing for E2E with real sessions. No mocks needed.
sync, pull, init, check, migrate. Billing and RBAC CLIs with dry-run by default, CI/CD ready.
Deploy on your own infrastructure. Docker, Vercel, bare metal. The entire platform is open source.
Dev, staging, production. Same config, different Stripe connections. Environment-scoped API keys.
Your AI assistant configures auth, billing, and RBAC through the Model Context Protocol.
> Set up a Pro plan at $29/mo with 10 seats and API access
create_billing_plan({ name: "Pro", price: 2900, interval: "month" })
✓ Created plan "Pro" — $29/mo
set_entitlements({ plan: "Pro", seats: 10, api_access: true })
✓ Added entitlements: seats: 10, api_access: true
> Now create an admin role with billing and user management
create_role({ name: "admin", permissions: ["billing.*", "users.*"] })
✓ Created role "admin" with 2 permission scopes
> Enable Google and GitHub auth
configure_auth_providers({ providers: ["google", "github"] })
✓ Enabled google, github{
"mcpServers": {
"authgate": {
"url": "https://<your-project>.authgate.dev/api/mcp",
"headers": {
"Authorization": "Bearer ag_live_..."
}
}
}
}Every layer is encrypted, signed, and auditable.
AES-256-GCM encryption at rest
PKCE + HMAC-signed OAuth state
Rate limiting on all endpoints
Automatic token rotation
Signed webhooks (HMAC-SHA256)
Full audit trail
Self-host for data sovereignty
SOC 2 Type II
Start free. Add billing or RBAC as your needs grow. Bundle both and save.
Auth forever free. Build and ship with zero cost.
Stripe sync, entitlements, usage tracking — flat fee, zero percentage.
Type-safe permissions, role inheritance, multi-tenant org roles.
Auth + Billing + RBAC. The complete platform at a bundled price.
Unlimited everything. Compliance, SLA, dedicated support.
100K MAU · $100.0K MRR
At this scale AuthGate saves you $7.7K/mo — that's $92.1K/yr back in your runway.
| Feature | Free | Pro | Enterprise |
|---|---|---|---|
| MAUs | Unlimited | Unlimited | Unlimited |
| Projects | 1 | 3 | Unlimited |
| Team seats | 1 | 3 | Unlimited |
| Environments | 1 | 2 | Unlimited |
| Audit trail | 7 days | 30 days | 1 year + export |
| Custom domain | |||
| MCP Server | |||
| Support | Community | Email (48h) | Dedicated + SLA |
| Uptime SLA | 99.5% | 99.95% |
Free and open source. Set up auth, billing, and orgs in under an hour. No credit card. No vendor lock-in.