Overview

Maintenance mode redirects all visitor traffic to /maintenance — a simple "We'll be back soon" page — while you deploy updates, run migrations, or perform any work that needs the app temporarily offline.

Traffic is intercepted at the proxy level (proxy.ts), before Next.js handles the request. This means even API routes and server actions are unreachable while maintenance is active.

Enable maintenance mode

Set the environment variable and redeploy (or restart your dev server):

# .env
NEXT_PUBLIC_MAINTENANCE_MODE=true

The variable must be prefixed with NEXT_PUBLIC_ because the proxy reads it at the edge/runtime level, outside the Node.js server context.

What stays accessible

The following paths bypass maintenance mode and are always served normally:

  • /maintenance — the maintenance page itself
  • /_next/ — Next.js static assets and HMR
  • /favicon.ico
  • /robots.txt
  • /manifest.json
  • /images/ — public image assets

All other paths — including /dashboard, /api, /blog, and /docs — are redirected to /maintenance.

Disable maintenance mode

Set the variable back to false (or remove it entirely) and redeploy:

# .env
NEXT_PUBLIC_MAINTENANCE_MODE=false

Customize the maintenance page

The maintenance page lives at app/maintenance/page.tsx. Edit it to match your brand — add your logo, an estimated return time, or a status page link. Keep it dependency-light since it renders without access to Supabase or TinaCMS.