Overview
Authenticate users, protect routes, and manage sessions in Next.js using MonoCloud.
MonoCloud’s Next.js SDK lets you add authentication to your Next.js application.
Use it to:
- Authenticate users
- Protect pages, API routes, and server actions
- Access the signed-in user from server and client code
The SDK supports both App Router and Pages Router applications.
Install the SDK
Install the SDK using your package manager:
npm install @monocloud/auth-nextjsView the source on GitHub: monocloud/auth-js
Get started quickly
Start with a quickstart to see MonoCloud in action:
Each quickstart walks you from a new Next.js app to a working sign-in flow, including authentication, middleware setup, and protected routes.
Before you continue
To integrate MonoCloud into your own app:
-
Follow the installation and configuration guide.
-
Choose the guides that match your routing setup to secure different parts of your app.
These guides show how to:
- Configure authentication and middleware
- Protect pages, components, APIs, and server actions
- Access the signed-in user on the server and client
App Router guides
For applications using the Next.js App Router:
Pages Router guides
For applications using the Next.js Pages Router:
API Reference
View all exported functions, hooks, components, and types: