GitHub - llama-farm/corral: ๐Ÿด Auth + Billing + Gating in one YAML file. Embedded library, not a service.

4 min read Original article โ†—

You don't add auth to your app. Your agent does.

npm License: MIT


โšก Get Started in 10 Seconds

Copy this into your AI coding agent (Claude Code, Cursor, Codex, OpenClaw, Windsurf โ€” anything):

Read: https://llama-farm.github.io/corral/llms.txt

Add auth and Stripe billing to my app. Free tier + Pro
at $29/mo with 14-day trial. Wire up everything: login,
signup, profile page, admin dashboard, upgrade banners,
and feature gating.

That's it. Your agent reads the spec, runs the CLI, wires the UI. You ship.


๐Ÿค” What Just Happened?

Your agent ran npx create-corral init, which:

  1. Detected your framework โ€” Express, Next.js, Hono, Fastify, Koa, Vite+React, FastAPI, and 13+ more
  2. Embedded auth into your existing server โ€” no new services, no Docker, same database
  3. Generated everything:
What File
Auth setup (Better Auth + your DB) src/lib/corral.ts
Login, signup, sessions, OAuth /api/auth/* routes
Profile page (edit name, password, delete account) src/components/ProfilePage.tsx
Admin dashboard (users, roles, plan overrides) src/components/AdminPanel.tsx
Account menu (dropdown for navbar) src/components/AccountMenu.tsx
Plan gating (<PlanGate>, <FeatureGate>, blur/block) src/gates.tsx
Auth hook + provider src/auth-context.tsx
Stripe checkout, billing portal, webhooks /api/corral/* routes
Agent integration guide CORRAL.md
Config (plans, features, meters, auth) corral.yaml
  1. Showed your agent the full feature list โ€” so it proactively wires up profile pages, upgrade banners, and admin dashboards without you asking

๐ŸŽ Everything You Get

Ready to use (works immediately)

  • โœ… Email/password sign-up & sign-in
  • โœ… Social login (Google, GitHub, Apple, Discord + 6 more)
  • โœ… Magic link & email OTP (passwordless)
  • โœ… Session management, password reset, email verification

Generated components (your agent wires them up)

  • ๐Ÿ”Œ Account Menu โ€” navbar dropdown: profile, settings, upgrade, admin, sign out
  • ๐Ÿ”Œ Profile Page โ€” edit name, change password, manage email, delete account
  • ๐Ÿ”Œ Admin Dashboard โ€” user list, role management, plan overrides, usage stats
  • ๐Ÿ”Œ Sign-in / Sign-up Pages โ€” social buttons, magic link, OTP tabs
  • ๐Ÿ”Œ Upgrade Banner โ€” shows free users what they're missing

Billing & monetization (Stripe-powered)

  • ๐Ÿ”Œ Pricing Table โ€” auto-generated from corral.yaml, monthly/annual toggle
  • ๐Ÿ”Œ One-click upgrade โ†’ Stripe Checkout โ†’ back to your app
  • ๐Ÿ”Œ Billing Portal โ€” manage subscription, invoices, payment method
  • ๐Ÿ”Œ Plan Gating โ€” <PlanGate plan="pro"> with blur/skeleton/block modes
  • ๐Ÿ”Œ Usage Metering โ€” track API calls, storage, etc. with per-plan limits
  • ๐Ÿ”Œ Free Trials โ€” configurable per plan (default 14 days)

Developer & admin tools

  • ๐Ÿ”Œ Feature Flags โ€” <FeatureGate feature="ai-chat"> per-plan toggling
  • ๐Ÿ”Œ CLI Auth โ€” device authorization flow (like gh auth login)
  • ๐Ÿ”Œ API Keys โ€” programmatic access for integrations
  • ๐Ÿ”Œ Deploy โ€” corral deploy docker|fly|railway|render

๐Ÿ”ง The 9-Command Workflow

Your agent runs these. You don't have to.

corral analyze --json          # 1. understand the project
corral init --yes --json       # 2. scaffold everything
corral add provider google     # 3. add OAuth
corral add plan pro --price 29 # 4. add paid plan
corral add feature ai --plans pro --gate blur  # 5. gate a feature
corral add meter api_calls --limit 10000       # 6. add usage meter
corral stripe sync --json      # 7. sync to Stripe
corral validate --json         # 8. verify everything
corral seed --env test --json  # 9. seed test users

Every command supports --json. Errors include a "fix" field. Exit 0 = deploy-ready.


๐Ÿ“‹ More Prompts to Try

Just auth, no billing:

Read: https://llama-farm.github.io/corral/llms.txt
Add authentication to my app with email + Google login.

Add to existing project:

Read: https://llama-farm.github.io/corral/llms.txt
Add Corral auth + billing to this project. Detect my
framework and embed into my existing server.

Deploy:

Read: https://llama-farm.github.io/corral/llms.txt
Generate Docker + Railway deployment configs for this app.

๐Ÿ—๏ธ How It Works

Corral is not a hosted service. It's a CLI that generates code into your project.

  • One YAML config (corral.yaml) โ€” plans, features, meters, auth providers
  • Embedded, not hosted โ€” mounts as route handlers in your app, same DB, same process
  • Built on Better Auth + Stripe
  • Agent-native โ€” llms.txt spec, CORRAL.md guide, --json everywhere, .corral/agent-checklist.json

Supported frameworks

Express ยท Hono ยท Fastify ยท Koa ยท Hapi ยท NestJS ยท Polka ยท Restify ยท AdonisJS ยท Elysia ยท H3/Nitro ยท Next.js ยท Vite+React ยท CRA ยท FastAPI ยท Django ยท Flask

Supported databases

SQLite (default) ยท PostgreSQL ยท MySQL ยท Turso/libSQL ยท Cloudflare D1


๐Ÿ“– Docs

llama-farm.github.io/corral


License

MIT ยฉ LlamaFarm

Built for agents, works for humans too ๐Ÿฆ™