Examples

Complete implementation guides for integrating codalware-auth in your Next.js applications.

All examples are production-ready and include complete authentication flows, protected routes, and security features.

What's Included in Each Example

  • Complete authentication flow (login, register, password reset)
  • Protected routes and middleware configuration
  • Two-factor authentication (2FA) setup and management
  • User profile and security settings pages
  • NextAuth.js integration with Prisma
  • Full TypeScript support with type safety
  • Environment configuration and setup instructions
  • Production-ready code with best practices

Quick Start

Get started with any example in 3 commands:

# 1. Install dependencies
npm install codalware-auth @prisma/client next-auth
# 2. Initialize and migrate
npx authcore init --migrate
# 3. Start development server
npm run dev

Choosing Between App Router and Pages Router

Choose App Router If:

  • • Starting a new Next.js 13+ project
  • • Want to use Server Components
  • • Need streaming and suspense
  • • Prefer modern React patterns
  • • Want better performance out of the box

Choose Pages Router If:

  • • Working with existing Next.js project
  • • Need stable, battle-tested patterns
  • • Prefer traditional page-based routing
  • • Using Next.js 12 or earlier
  • • Want simpler mental model

Need Help?

Visit the complete documentation for detailed guides, API reference, and more examples.

View Documentation