Skip to content

monocloud/nextjs-quickstart

Repository files navigation


Next.js App Router Quickstart

A minimal Next.js App Router example showing how to add authentication with MonoCloud.

What this repo shows

  • MonoCloud authentication with Next.js App Router
  • Middleware-based route protection
  • Reading the signed-in user (server + client)
  • Sign in and sign out flows

Built with @monocloud/auth-nextjs.

Prerequisites

Before you begin, you’ll need:

Configure environment variables

This repo includes a .env.local template. Replace the placeholders with values from your MonoCloud application:

MONOCLOUD_AUTH_TENANT_DOMAIN=https://<your-domain>
MONOCLOUD_AUTH_CLIENT_ID=<your-client-id>
MONOCLOUD_AUTH_CLIENT_SECRET=<your-client-secret>
MONOCLOUD_AUTH_SCOPES=openid profile email
MONOCLOUD_AUTH_APP_URL=http://localhost:3000
MONOCLOUD_AUTH_COOKIE_SECRET=<random-secret>

⚠️ Do not commit real secrets. This file is for local development only.

Application URLs (local)

Configure these in your MonoCloud app:

  • Callback URL → http://localhost:3000/api/auth/callback
  • Sign-out URL → http://localhost:3000

Run locally

npm install
npm run dev

Open http://localhost:3000

What to copy from this repo

  • App Router–compatible auth middleware
  • Protected routes and pages
  • Server + client access to the authenticated user
  • Built-in sign-in and sign-out components

This repo is a reference, not a framework.

📘 Learn more

🤝 Contributing & Support

Issues & Feedback

  • Use GitHub Issues for bug reports and feature requests.
  • For tenant or account-specific help, contact MonoCloud Support through your dashboard.

Security

Do not report security issues publicly. Please follow the contact instructions at: https://www.monocloud.com/contact

📄 License

Licensed under the MIT License. See the included LICENSE file.

About

Minimal Next.js App Router example showing how to add authentication using MonoCloud.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors