Quickstart Guide
Get a working authentication system with phone OTP, email/password, and OAuth in under 5 minutes. This guide uses Next.js with the App Router and Prisma.Install Packages
Install the core package, a database adapter, and the Next.js integration:
This guide uses Prisma. If you prefer Drizzle, install
@arraf-auth/adapter-drizzle instead.Set Up Prisma (if not already configured)
If you haven’t set up Prisma yet, initialize it:Add the Arraf Auth schema to your Then push the schema to your database:
schema.prisma:Create API Route
Create a catch-all API route at This exposes all authentication endpoints under
app/api/auth/[...all]/route.ts:app/api/auth/[...all]/route.ts
/api/auth/*.Use Phone OTP Authentication
Now you can authenticate users with their phone number. Here’s a complete example:
Available Authentication Flows
Your authentication system now supports multiple flows:Phone + OTP (Primary for Saudi Market)
Email + Password
OAuth
OAuth providers require additional configuration. See the OAuth guide for details.
Next Steps
Phone + OTP Guide
Deep dive into phone authentication with SMS providers
Database Setup
Configure Prisma or Drizzle for your database
Session Management
Learn about JWT vs database sessions
OAuth Providers
Add Google and GitHub authentication