Skip to Content
DocsFeaturesIntegrationsNext.js AdminOverview

Next.js Admin Integration


Django-CFG provides seamless integration for embedding custom Next.js admin dashboards as secondary admin interfaces. This powerful feature allows you to combine Django’s robust backend with modern React-based admin panels.

Overview

The all-in-one solution for Django + Next.js admin interfaces.

Django-CFG brings you a revolutionary approach: three interfaces in ONE Next.js project with dual admin strategy that combines the best of both worlds.

Three-in-One Architecture

Build everything in a single Next.js codebase:

  • 🌐 Public Website (/) - Landing pages, marketing content
  • πŸ‘€ User Dashboard (/private) - User-specific features and data
  • βš™οΈ Admin Panel (/admin) - Management interface with full React power

Shared components, shared layouts, shared API clients - write once, use everywhere!

Dual Admin Strategy

  • Tab 1: Built-in Admin - Quick CRUD with Django Unfold (90% of tasks)
  • Tab 2: Next.js Admin - Unlimited customization with React (10% complex features)

No migration needed - start simple, scale when needed!

Key Features

  • βœ… Zero Configuration - One line of config, smart defaults for everything
  • βœ… Auto-Generated APIs - TypeScript clients from Django models automatically
  • βœ… Auto-Detected Dev Mode - No env variables, Django detects dev servers (ports 3000/3001)
  • βœ… JWT Authentication - Seamless token injection, no setup required
  • βœ… ZIP Deployment - ~7MB single file vs ~20MB uncompressed (60% smaller Docker images)
  • βœ… Hot Reload - Full dev experience with instant feedback
  • βœ… Theme Sync - Dark/light mode synchronized across all interfaces

Architecture

Key Features

1. Simple Configuration

Configure your Next.js admin with just one line:

from django_cfg import DjangoConfig, NextJsAdminConfig config = DjangoConfig( project_name="My Project", # Simple configuration nextjs_admin=NextJsAdminConfig( project_path="../django_admin", ), )

All other settings use smart defaults that work out of the box.

2. Automatic API Client Generation

# Generate TypeScript clients and build Next.js python manage.py generate_clients --typescript # Output: # βœ… Generated TypeScript clients # βœ… Copied to Next.js project # βœ… Built Next.js static export # βœ… Created ZIP archive

3. ZIP-Based Deployment

Instead of copying thousands of files, the integration creates compressed ZIP archives:

  • Smaller Docker images - ~5-10MB vs ~20MB+ uncompressed
  • Faster builds - Single file copy vs thousands of files
  • Auto-extraction - Extracts on first HTTP request automatically
  • Production-ready - Perfect for containerized deployments

4. Development Workflow

Development mode supports full hot-reload:

# Terminal 1: Django python manage.py runserver # Terminal 2: Next.js dev server cd django_admin/apps/admin && pnpm dev # Admin loads from http://localhost:3001 with hot reload!

Use Cases

Single Custom Dashboard

Perfect for projects that need a modern admin interface:

  • Real-time analytics dashboards
  • Custom data visualization tools
  • Specialized admin workflows
  • Modern UI/UX requirements

Multiple Admin Dashboards

Ideal for enterprise applications:

  • Separate dashboards for different user roles
  • Department-specific admin interfaces
  • Microservices with dedicated admin panels
  • Multi-tenant applications

Gradual Migration

Great for legacy projects:

  • Keep existing Django admin running
  • Build new features in Next.js
  • Migrate incrementally
  • Zero downtime transitions

Quick Start

1. Configure

# api/config.py from django_cfg import DjangoConfig, NextJsAdminConfig config = DjangoConfig( project_name="My Project", nextjs_admin=NextJsAdminConfig( project_path="../django_admin", ), )

2. Generate API & Build

python manage.py generate_clients --typescript

3. Run

python manage.py runserver # Visit http://localhost:8000/admin/

What’s Next?

πŸ’‘ Core Concepts

Understand the philosophy, three-in-one architecture, and dual admin strategy.

πŸš€ Quick Setup

Get your Next.js admin running in 5 minutes with our quick setup guide.

βš™οΈ Configuration

Learn about all configuration options and customization possibilities.

πŸ”§ How It Works

Deep dive into the technical architecture and implementation details.

🚒 Deployment

Deploy your Next.js admin to production with Docker and best practices.

πŸ’Ό Examples

Real-world examples and patterns for common use cases and integrations.

Why django-cfg Next.js Integration?

vs Django Unfold

  • βœ… Both included - Keep Unfold for quick CRUD, add Next.js for complex features
  • βœ… No ceiling - When Unfold limitations hit, switch to Tab 2 with full React power
  • βœ… Progressive - Start simple, scale without migration

vs React Admin

  • βœ… Zero setup - One line of config vs complex setup
  • βœ… Built-in + Custom - Best of both worlds, not just custom
  • βœ… Auto-generated - TypeScript clients from Django automatically

vs Retool

  • βœ… Free & Open Source - No $$$$ monthly fees
  • βœ… Your code - Full control, no lock-in
  • βœ… Self-hosted - Your infrastructure, your data

The django-cfg Way

# Literally one line: nextjs_admin=NextJsAdminConfig(project_path="../admin")

That’s it! Everything else just works πŸŽ‰

Resources

The Magic Formula

One Next.js project = Public site + User dashboard + Admin panel

Dual admin strategy = Quick CRUD (Unfold) + Unlimited power (Next.js)

Zero configuration = Smart defaults + Auto-detection