Stop building auth. Start shipping features.
Quick Start β’ Features β’ Demo β’ Docs β’ Examples
Building authentication is hard. Building it securely is even harder. We've all been there:
- π© Spending days setting up auth instead of building features
- π§ Wrestling with OAuth provider documentation
- π¨ Building the same login forms over and over
- π Worrying about security vulnerabilities
- π Dealing with incomplete or confusing documentation
Easy Auth SDK solves all of this. One package, five minutes, and you're done.
// This is all you need. Seriously.
import { createAuthHandlers } from 'easy-auth-sdk/next'
export const { GET, POST } = createAuthHandlers({
database: { url: process.env.DATABASE_URL },
providers: { google: { enabled: true } }
})
npm install easy-auth-sdkThat's it. No complex configuration. Sensible defaults. It just works. |
Pre-built components with Shadcn UI + Tailwind. Fully customizable or bring your own. |
Rate limiting, CSRF protection, secure sessions, and password policies built-in. Sleep easy. |
|
First-class Next.js support. Express coming soon. Works with any Node.js app. |
Email/password, OAuth (Google, GitHub, etc.), password reset, and more out of the box. |
Full type safety. Autocomplete everything. Catch errors before runtime. |
npm install easy-auth-sdk
# Required peer dependencies (if not already installed)
npm install react react-dom next# .env.local
DATABASE_URL="postgresql://user:pass@localhost:5432/myapp"
AUTH_SECRET="your-secret-key-min-32-chars" # Generate with: openssl rand -base64 32// app/api/auth/[...auth]/route.ts
import { createAuthHandlers } from 'easy-auth-sdk/next'
export const { GET, POST } = createAuthHandlers({
database: {
type: 'postgres',
url: process.env.DATABASE_URL!
},
session: {
secret: process.env.AUTH_SECRET!
},
providers: {
emailPassword: { enabled: true },
google: {
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!
}
}
})// app/layout.tsx
import { NextAuthProvider } from 'easy-auth-sdk/next/client'
export default function RootLayout({ children }) {
return (
<html>
<body>
<NextAuthProvider>
{children}
</NextAuthProvider>
</body>
</html>
)
}// app/login/page.tsx
'use client'
import { AuthComponent } from 'easy-auth-sdk/react'
import { useNextAuth } from 'easy-auth-sdk/next/client'
export default function LoginPage() {
const { signIn, signUp, oauthSignIn, loading, error } = useNextAuth()
return (
<AuthComponent
onSignIn={signIn}
onSignUp={signUp}
onOAuthSignIn={oauthSignIn}
providers={[
{ id: 'google', name: 'Google' },
{ id: 'github', name: 'GitHub' }
]}
loading={loading}
error={error}
/>
)
}That's it! You now have a fully functional auth system with:
- β Beautiful login/signup UI
- β Email/password authentication
- β Social logins
- β Secure sessions
- β Password reset flow
- β TypeScript support
All components are:
- π¨ Beautifully designed with Shadcn UI
- π± Fully responsive out of the box
- βΏ Accessible (WCAG 2.1 compliant)
- π― Customizable with Tailwind classes
- π Dark mode ready
import { getServerSession } from 'easy-auth-sdk/next/server'
import { redirect } from 'next/navigation'
export default async function DashboardPage() {
const session = await getServerSession()
if (!session) {
redirect('/login')
}
return <h1>Welcome, {session.user.name}!</h1>
}'use client'
import { withNextAuth } from 'easy-auth-sdk/next/client'
function ProtectedComponent() {
return <div>Secret content π€«</div>
}
export default withNextAuth(ProtectedComponent)Setting up OAuth is as simple as adding credentials:
providers: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!
},
github: {
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!
},
// Add more providers...
}π Supported Providers
- β Google
- β GitHub
- β Facebook
- β Twitter/X
- β Microsoft (coming soon)
- β Apple (coming soon)
- β Discord (coming soon)
- β Custom OAuth
:root {
--primary: 220 90% 56%; /* Your brand color */
--primary-foreground: 0 0% 100%; /* Text on primary */
/* ... more variables */
}<AuthComponent
className="custom-auth-wrapper"
texts={{
signIn: {
title: "Welcome Back! π",
description: "Sign in to continue your journey"
}
}}
/>import { useNextAuth } from 'easy-auth-sdk/next/client'
function CustomLoginForm() {
const { signIn, loading, error } = useNextAuth()
// Build your own UI
return (
<form onSubmit={(e) => {
e.preventDefault()
signIn(email, password)
}}>
{/* Your custom form */}
</form>
)
}const config = {
security: {
rateLimit: {
maxAttempts: 5,
windowMs: 15 * 60 * 1000 // 15 minutes
},
passwordPolicy: {
minLength: 8,
requireUppercase: true,
requireNumbers: true,
requireSpecialChars: true
},
csrf: {
enabled: true
}
}
}const config = {
callbacks: {
onSignUp: async ({ user }) => {
// Send welcome email
await sendWelcomeEmail(user.email)
// Track analytics
analytics.track('user_signup', { userId: user.id })
},
onSignIn: async ({ user, account }) => {
// Update last login
await updateLastLogin(user.id)
},
onSignOut: async ({ user }) => {
// Cleanup tasks
await clearUserCache(user.id)
}
}
}Easy Auth automatically creates and manages these tables:
βββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β users β β accounts β β sessions β
βββββββββββββββ€ ββββββββββββββββ€ ββββββββββββββββ€
β id βββββββ€ userId βββββββ€ userId β
β email β β provider β β sessionToken β
β name β β providerId β β expiresAt β
β password β β accessToken β β createdAt β
β verified β β refreshToken β β updatedAt β
β createdAt β β createdAt β ββββββββββββββββ
β updatedAt β β updatedAt β
βββββββββββββββ ββββββββββββββββ# Generate migration files
npx drizzle-kit generate:pg
# Apply migrations
npx drizzle-kit push:pg
# View database studio
npx drizzle-kit studioMoving from NextAuth? It's seamless:
- import NextAuth from 'next-auth'
- import GoogleProvider from 'next-auth/providers/google'
+ import { createAuthHandlers } from 'easy-auth-sdk/next'
- export default NextAuth({
- providers: [
- GoogleProvider({
- clientId: process.env.GOOGLE_CLIENT_ID,
- clientSecret: process.env.GOOGLE_CLIENT_SECRET,
- })
- ]
- })
+ export const { GET, POST } = createAuthHandlers({
+ providers: {
+ google: {
+ clientId: process.env.GOOGLE_CLIENT_ID!,
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET!
+ }
+ }
+ })Full Migration Guide β
- Database Compatible: Our schema is NextAuth-compatible
- Similar API: Most functions have direct equivalents
- Better DX: Less configuration, more features
- Migration Script: Coming soon!
cd examples/next-app
npm install
npm run devcd examples/express-app
npm install
npm run dev- Email/Password authentication
- OAuth providers (Google, GitHub, etc.)
- Next.js integration
- Beautiful UI components
- TypeScript support
- Rate limiting & security
- Two-factor authentication (2FA)
- Magic link authentication
- Express.js adapter
- Remix adapter
- Email service integrations
- Admin dashboard
- Multi-tenant support
We love contributions! Please see our Contributing Guide for details.
# Clone the repo
git clone https://github.com/your-org/easy-auth-sdk
# Install dependencies
npm install
# Run tests
npm test
# Build
npm run buildMIT Β© Your Company
Twitter β’ Discord β’ GitHub
If Easy Auth helped you ship faster, consider sponsoring the project!



