Authentication
Robust user authentication powered by NextAuth.js v4.
Supported Providers
Google OAuthEmail/PasswordMagic Links
fe comes pre-configured with the most common authentication methods. You can easily enable or disable providers in the configuration.
Configuration
Authentication logic is located in src/lib/auth.
Environment Variables
Add these to your .env.local file:
env
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-key
# Google Provider
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...Database Integration
User sessions and accounts are automatically stored in your configured database (MongoDB, PostgreSQL, or SQLite) using the custom adapter in src/lib/auth/adapters/database-adapter.ts.
Protecting Routes
You can protect routes using the Middleware or server-side session checks.
typescript
// src/middleware.ts
export { default } from "next-auth/middleware"
export const config = { matcher: ["/dashboard/:path*"] }