EN

VibeNest is currently available in English. More interface languages are coming soon.

Go to Home

nextjs-auth

A custom authentication system built with Next.js 15, featuring session-based auth, user registration, and secure password handling.

Try the Live App →

Why nextjs-auth?

A production-ready authentication layer designed for modern Next.js applications. Every component is purpose-built for security, performance, and developer experience — no black-box third-party providers required.

User Registration & Login

Complete authentication flow with email/password, built-in validation, and smooth UX.

Session Management

Server-side session handling with automatic expiration and secure cookie management.

Password Security

Bcrypt hashing for secure password storage, protecting user credentials at every step.

Built for Production

From database integration to route protection, every piece is optimized for real-world use. Type safety and validation ensure your auth layer is robust from day one.

Database Integration

PostgreSQL with Prisma ORM for type-safe queries and reliable data persistence.

Type Safety

Full TypeScript support with Zod validation — catch errors at compile time, not runtime.

Middleware Protection

Route protection for authenticated areas — guard pages with minimal configuration.

Tech Stack

Modern tools chosen for reliability and developer experience.

Next.js 15 & React 19

Frontend framework with server components and API routes

Server Actions & API Routes

Backend logic with Next.js server actions and route handlers

PostgreSQL & Prisma ORM

Reliable database with type-safe query builder

Custom Session-Based Auth

No external providers — full control over authentication

bcryptjs & Server Components

Secure password hashing with server-only execution

Zod Schema Validation

Runtime validation with static type inference

Project Structure

Clean, modular architecture that scales with your application.

Source Layout

src/
├── app/
│   ├── actions/auth.ts      # Server actions for auth
│   ├── dashboard/page.tsx   # Protected dashboard
│   ├── login/page.tsx       # Login form
│   ├── register/page.tsx    # Registration form
│   └── layout.tsx           # Root layout
├── lib/
│   ├── db.ts               # Prisma client
│   ├── session.ts          # Session management
│   ├── password.ts         # Password utilities
│   └── constants.ts        # App constants
└── middleware.ts           # Route protection

Database Schema

The application uses two main models to manage users and active sessions.

User

Stores user credentials and profile information with securely hashed passwords.

Session

Manages active user sessions with automatic expiration for security.

Getting Started

  1. 1 Configure environment — Copy .env.example to .env and set your PostgreSQL connection string.
  2. 2 Install dependencies — Run npm install to install all required packages.
  3. 3 Set up the database — Run npm run db:push to apply the Prisma schema to your database.
  4. 4 Start developing — Run npm run dev to launch the development server.
Visit /register to create an account and /login to sign in. Protected routes like /dashboard require authentication.

Ready to secure your app?

Get started with a custom authentication system built for modern Next.js applications.

Launch Demo →

Reconnecting to the server...

Reconnecting in sec.

Failed to reconnect.
The page will reload automatically.

Session paused by the server.

Failed to resume the session.
Reloading the page...