App Builder

Access Control

Access Control - Opulent documentation

Access Control

Add authentication and authorization to your application — login, roles, and protected routes

What it is

Access Control lets you add user authentication and role-based authorization to any application built with Opulent. Users can sign up, log in, and access content based on their permissions — all configured through natural language.


Quick Start

"Add user authentication — email/password signup and login. Protect all dashboard routes."
"Add login with Google and GitHub OAuth. After login, redirect to /dashboard."
"Add an admin role. Only users with the admin role can see the /admin section."

Authentication Methods

MethodDescription
Email + PasswordStandard signup/login with email verification
Google OAuth"Sign in with Google"
GitHub OAuth"Sign in with GitHub" — popular for developer tools
Magic LinkPasswordless — user receives a login link by email
SSO / SAMLEnterprise single sign-on (Enterprise plan)

Specify which methods you need:

"Add authentication with email/password and Google OAuth. No GitHub."

Roles and Permissions

"Create three roles: admin, editor, and viewer.
- Admins can create, edit, and delete everything
- Editors can create and edit, but not delete
- Viewers can only read"
"Add a role check: only users where role = 'pro' can access /export"
"Add an invite system: admins can invite team members by email"

Protecting Routes

"All routes under /dashboard require login. Unauthenticated users
are redirected to /login."
"The /admin section is only accessible to users with the admin role.
Show a 403 page to anyone else."

Auth Stack

Opulent uses Better Auth by default for new projects — a modern, flexible auth library that supports all common providers and patterns without vendor lock-in.

For projects requiring enterprise auth:

  • Clerk (managed auth with full UI components)
  • Auth0 (enterprise SSO, MFA, compliance)
  • Supabase Auth (when using Supabase as the database)

Specify your preference:

"Use Clerk for auth — I want their prebuilt UI components"

Common Questions

Can I add auth to an existing app Opulent built? Yes: "Add email/password authentication to this app" — Opulent integrates auth into the existing structure.

Are passwords stored securely? Yes. Passwords are hashed with bcrypt or argon2. Opulent never stores plaintext passwords.

Can users manage their own accounts (change password, delete account)? Yes: "Add an account settings page where users can update their email, change their password, and delete their account".

Does this work with my existing user database? If you have an existing users table, specify it: "Add auth that uses our existing users table in PostgreSQL".