Modern Django framework with type-safe Pydantic v2 configuration, Next.js admin integration, real-time WebSockets, and 8 enterprise apps. Replace settings.py with validated models, 90% less code. Production-ready with AI agents, auto-generated TypeScript clients, and zero-config features.
Project description
Django-CFG: Type-Safe Django Configuration Framework
๐ The Modern Django Framework for Enterprise Applications
Type-safe configuration โข AI-Native Docs โข Next.js Admin โข gRPC Streaming โข Real-time WebSockets โข AI Agents โข 8 Enterprise Apps
๐ฏ Live Demo โข ๐ Documentation โข ๐ค MCP Server โข ๐ GitHub
๐ฏ What is Django-CFG?
Django-CFG is a next-generation Django framework that replaces traditional settings.py with type-safe Pydantic v2 models. It eliminates runtime configuration errors, provides complete IDE autocomplete, and includes production-ready enterprise features out of the box.
Why Django-CFG?
Traditional Django problems:
- โ Runtime errors - configuration bugs discovered in production
- โ No IDE support - zero autocomplete, manual documentation lookup
- โ 200+ lines of unmaintainable settings.py
- โ Weeks of setup - for user auth, admin UI, payments, real-time features
Django-CFG solution:
- โ Startup validation - catch all config errors before deployment
- โ Full IDE autocomplete - IntelliSense for every setting
- โ 30 lines of code - 90% boilerplate reduction
- โ 30 seconds to production - everything included and ready
๐ Read the full comparison โ
๐ Quick Start
Requirements
- Python 3.12+ (required)
- pip or poetry
๐ Quick Install
Interactive Installer (Recommended)
Visit our interactive installer page that automatically detects your operating system:
โ https://djangocfg.com/installer
The installer automatically:
- Detects your OS and architecture
- Downloads the correct Go binary installer
- Runs system checks (Python, Docker, Node.js, etc.)
- Installs missing dependencies
- Creates a complete project structure
- Configures environment files
One-Line Commands
Linux / macOS
curl -L https://djangocfg.com/install.sh | sh
Windows (PowerShell)
powershell -c "iwr https://djangocfg.com/install.ps1 | iex"
Note: If you get a PowerShell execution policy error, run PowerShell as Administrator and execute:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
๐ฆ Manual Installation
# Create virtual environment with Python 3.12
python3.12 -m venv .venv && source .venv/bin/activate
# Install django-cfg and create project
pip3 install 'django-cfg[full]'
django-cfg create-project my_app
# Start the server
cd my_app/projects/django
poetry install
poetry run python manage.py runserver
What you get instantly:
- ๐จ Modern Admin UI โ
http://127.0.0.1:8000/admin/ - โก Next.js Dashboard โ Modern React admin interface
- ๐ก Real-time WebSockets โ Live updates with Centrifugo
- ๐ณ Docker Ready โ Production deployment configs
- ๐ฅ๏ธ Electron App โ Desktop app template
Project structure:
my_app/
โโโ docker/ # Docker deployment
โโโ projects/
โโโ django/ # Django backend
โโโ frontend/ # Next.js frontend
โโโ electron/ # Desktop app
Django-CFG startup with type-safe configuration validation
Optional Features (Extras)
Install additional features based on your needs:
# Full installation (recommended for production)
pip3 install 'django-cfg[full]'
# Individual extras
pip3 install 'django-cfg[grpc]' # gRPC microservices
pip3 install 'django-cfg[centrifugo]' # Real-time WebSockets
pip3 install 'django-cfg[rq]' # Background tasks with Redis Queue
pip3 install 'django-cfg[ai]' # AI agents with Pydantic AI
# Combine multiple extras
pip3 install 'django-cfg[grpc,centrifugo,rq]'
Note: Quotes around extras are required for zsh compatibility.
Available extras:
- ๐
[full]- All features (grpc + centrifugo + rq + ai) - ๐
[grpc]- gRPC server support (grpcio, grpcio-tools, protobuf) - ๐ก
[centrifugo]- Real-time WebSocket integration (cent, websockets) - ๐
[rq]- Redis Queue for background tasks (django-rq, rq-scheduler) - ๐ค
[ai]- AI agents framework (pydantic-ai)
Try Live Demo
See Django-CFG in action:
โ https://djangocfg.com/demo
Explore: Modern admin โข Next.js dashboard โข AI agents โข Real-time updates โข Support system
๐ก Core Features
๐ Type-Safe Configuration with Pydantic v2
Replace error-prone settings.py with validated Pydantic models.
Before: Django settings.py
# settings.py - Runtime errors, no validation
import os
DEBUG = os.getenv('DEBUG', 'False') == 'True' # โ String comparison bug
DATABASE_PORT = os.getenv('DB_PORT', '5432') # โ Still a string!
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.getenv('DB_NAME'), # โ No validation until connection
'PORT': DATABASE_PORT, # โ Type mismatch in production
}
}
# ... 200+ more lines
After: Django-CFG
# config.py - Type-safe, validated at startup
from django_cfg import DjangoConfig, DatabaseConfig
class MyConfig(DjangoConfig):
"""Production-ready type-safe configuration"""
project_name: str = "My App"
debug: bool = False # โ
Pydantic validates boolean
# Type-safe database with startup validation
databases: dict[str, DatabaseConfig] = {
"default": DatabaseConfig(
name="${DB_NAME}", # โ
Validated at startup
port=5432, # โ
Type-checked integer
)
}
Benefits:
- โ Pydantic v2 validation - catch errors before deployment
- โ Full IDE autocomplete - IntelliSense everywhere
- โ 90% less code - 200+ lines โ 30 lines
- โ Type hints - mypy and pyright compatible
๐ Type-safe configuration guide โ
โ๏ธ Next.js Admin Integration
Build modern admin interfaces with React - the only Django framework with built-in Next.js integration.
from django_cfg import DjangoConfig, NextJsAdminConfig
class MyConfig(DjangoConfig):
# One line for complete Next.js admin!
nextjs_admin: NextJsAdminConfig = NextJsAdminConfig(
project_path="../admin",
)
What you get:
- ๐ Three-in-One Architecture - Public site + User dashboard + Admin panel in ONE Next.js project
- โ๏ธ Dual Admin Strategy - Django Unfold (90% quick CRUD) + Next.js (10% complex features)
- โจ Zero Configuration - Auto JWT auth, theme sync, TypeScript generation
- ๐ฆ 60% Smaller - ZIP deployment (~7MB vs ~20MB)
- โก Auto-Detection - Dev mode automatically detected on ports 3000/3001
No migration needed - start with built-in admin, add Next.js when you need complex features!
๐ Next.js Admin Documentation โ
๐ก Real-Time WebSockets with Centrifugo
Production-ready WebSocket integration - live updates, notifications, and real-time collaboration.
from django_cfg import DjangoConfig, CentrifugoConfig
class MyConfig(DjangoConfig):
# Enable real-time features
centrifugo: CentrifugoConfig = CentrifugoConfig(
enabled=True,
api_url="http://localhost:8001/api",
)
Built-in features:
- โก Live Updates - Real-time data synchronization
- ๐ Notifications - Push notifications to connected clients
- ๐ฅ Presence - Track online users
- ๐ฌ Chat - Real-time messaging out of the box
- ๐ JWT Auth - Secure WebSocket connections
๐ Centrifugo Integration Guide โ
๐ gRPC Microservices & Streaming
Production-ready gRPC integration - bidirectional streaming, WebSocket bridge, and type-safe Protobuf.
from django_cfg.apps.integrations.grpc.services.centrifugo import (
CentrifugoBridgeMixin,
CentrifugoChannels,
ChannelConfig,
)
# Define type-safe channel mappings
class BotChannels(CentrifugoChannels):
heartbeat: ChannelConfig = ChannelConfig(
template='bot#{bot_id}#heartbeat',
rate_limit=5.0, # Max once per 5 seconds
)
status: ChannelConfig = ChannelConfig(
template='bot#{bot_id}#status',
critical=True, # Bypass rate limiting
)
# gRPC service with automatic WebSocket publishing
class BotStreamingService(
pb2_grpc.BotStreamingServiceServicer,
CentrifugoBridgeMixin # โ One-line WebSocket integration
):
centrifugo_channels = BotChannels()
async def ConnectBot(self, request_iterator, context):
async for message in request_iterator:
# Your business logic
await process_message(message)
# Auto-publish to WebSocket (1 line!)
await self._notify_centrifugo(message, bot_id=bot_id)
Built-in features:
- ๐ Bidirectional Streaming - Full-duplex gRPC communication
- ๐ Centrifugo Bridge - Auto-publish gRPC events to WebSocket
- ๐ก๏ธ Circuit Breaker - Graceful degradation if Centrifugo unavailable
- ๐ Auto Retry - Exponential backoff for critical events
- ๐ฆ Dead Letter Queue - Never lose important messages
- โก Rate Limiting - Per-channel throttling with critical bypass
- ๐ฏ Type-Safe Config - Pydantic v2 validation for channels
Architecture:
Trading Bot โโgRPCโโ> Django gRPC Service โโWebSocketโโ> Browser
โ
[Business Logic]
[Database Save]
[Centrifugo Publish]
Why this approach?
- โ Django controls all business logic and validation
- โ Single source of truth for data transformations
- โ Graceful degradation - gRPC works even if WebSocket fails
- โ Production-ready resilience patterns built-in
๐ gRPC Integration Guide โ
๐ค AI-Native Documentation
First Django framework with MCP server - Your AI coding assistant can access DjangoCFG docs instantly.
{
"mcpServers": {
"djangocfg-docs": {
"url": "https://mcp.djangocfg.com/mcp"
}
}
}
Access documentation from anywhere:
# CLI search (fast, no Django required)
django-cfg search "database configuration"
django-cfg search "redis cache" --limit 3
# Python API
from django_cfg.modules.django_ai import search, get_docs
results = search("How to configure Redis cache?")
# REST API
curl 'https://mcp.djangocfg.com/api/search?q=database&limit=5'
Supported AI assistants:
- ๐ค Claude Desktop - Add MCP server to config
- ๐ฅ๏ธ Cursor IDE - Native MCP support
- ๐ฌ ChatGPT - Via API integration
- ๐ง Any MCP Client - Universal protocol
๐ AI Documentation Guide โ
๐ค AI Agents Framework
Built-in AI agent framework - LLM workflow automation with Django ORM integration.
from django_cfg import DjangoConfig
class MyConfig(DjangoConfig):
# AI features (optional)
openai_api_key: str = "${OPENAI_API_KEY}"
anthropic_api_key: str = "${ANTHROPIC_API_KEY}"
enable_agents: bool = True # AI workflow automation
enable_knowbase: bool = True # Vector DB + RAG
Features:
- ๐ค AI Agents Framework - Type-safe LLM integration
- ๐ Vector Database - ChromaDB for semantic search
- ๐ RAG - Retrieval-augmented generation
- ๐ฏ Pydantic AI - Validated AI input/output
- ๐ Multi-LLM - OpenAI, Anthropic, Claude support
๐ฆ 8 Enterprise Apps Included
Ship features in days, not months - production-ready apps out of the box:
| App | Description | Time Saved |
|---|---|---|
| ๐ค Accounts | User management + OTP + SMS auth | 3-4 weeks |
| ๐ซ Support | Ticketing system + SLA tracking | 2-3 weeks |
| ๐ง Newsletter | Email campaigns + analytics | 2-3 weeks |
| ๐ Leads | CRM + sales pipeline | 2-3 weeks |
| ๐ค AI Agents | Workflow automation | 3-4 weeks |
| ๐ KnowBase | AI knowledge base + RAG | 2-3 weeks |
| ๐ณ Payments | Multi-provider payments | 2-3 weeks |
| ๐ง Maintenance | Multi-site management | 1-2 weeks |
Total time saved: 18+ months of development
class MyConfig(DjangoConfig):
# Enable apps as needed (one line each!)
enable_accounts: bool = True
enable_support: bool = True
enable_newsletter: bool = True
enable_leads: bool = True
enable_agents: bool = True
enable_knowbase: bool = True
enable_payments: bool = True
enable_maintenance: bool = True
๐ Built-in Apps Overview โ
๐จ Modern API UI with Tailwind 4
Beautiful browsable API - 88% smaller bundle, modern design.
- โ Glass morphism design
- โ Light/Dark/Auto themes
- โ Command palette (โK)
- โ 88% smaller (278KB โ 33KB)
- โ Auto-generated TypeScript clients
๐ Smart Multi-Database Routing
Zero-config database routing with automatic sharding:
from django_cfg import DjangoConfig, DatabaseConfig
class MyConfig(DjangoConfig):
databases: dict[str, DatabaseConfig] = {
"default": DatabaseConfig(
name="${DB_NAME}",
),
"analytics": DatabaseConfig(
name="${ANALYTICS_DB}",
routing_apps=["analytics", "reports"], # Auto-route!
),
}
โ Auto-routes read/write โข โ Cross-DB transactions โข โ Connection pooling
โ๏ธ Complete Configuration Example
All features in one DjangoConfig:
from django_cfg import DjangoConfig, DatabaseConfig, CacheConfig, NextJsAdminConfig
class ProductionConfig(DjangoConfig):
# Project
project_name: str = "My Enterprise App"
secret_key: str = "${SECRET_KEY}"
debug: bool = False
# Next.js Admin (optional)
nextjs_admin: NextJsAdminConfig = NextJsAdminConfig(
project_path="../admin",
)
# Real-time WebSockets (optional)
centrifugo: CentrifugoConfig = CentrifugoConfig(
enabled=True,
)
# 8 Enterprise Apps (enable as needed)
enable_accounts: bool = True # User management
enable_support: bool = True # Ticketing
enable_newsletter: bool = True # Email campaigns
enable_leads: bool = True # CRM
enable_agents: bool = True # AI automation
enable_knowbase: bool = True # Vector DB
enable_payments: bool = True # Payments
enable_maintenance: bool = True # Site management
# Infrastructure
databases: dict[str, DatabaseConfig] = {
"default": DatabaseConfig(name="${DB_NAME}"),
}
caches: dict[str, CacheConfig] = {
"default": CacheConfig(backend="redis"),
}
# AI Providers (optional)
openai_api_key: str = "${OPENAI_API_KEY}"
anthropic_api_key: str = "${ANTHROPIC_API_KEY}"
# Integrations
twilio_account_sid: str = "${TWILIO_ACCOUNT_SID}"
stripe_api_key: str = "${STRIPE_API_KEY}"
cloudflare_api_token: str = "${CF_API_TOKEN}"
๐ Configuration Reference โ
๐ Comparison with Alternatives
Django-CFG vs Traditional Solutions
| Feature | settings.py | django-environ | pydantic-settings | Django-CFG |
|---|---|---|---|---|
| Type Safety | โ Runtime | โ ๏ธ Basic | โ Pydantic | โ Full Pydantic v2 |
| IDE Autocomplete | โ None | โ None | โ ๏ธ Partial | โ 100% |
| Startup Validation | โ No | โ ๏ธ Partial | โ Yes | โ Yes + Custom |
| Next.js Admin | โ Manual | โ None | โ None | โ Built-in |
| WebSocket (Centrifugo) | โ Manual | โ None | โ None | โ Built-in |
| Enterprise Apps | โ Build all | โ None | โ None | โ 8 included |
| AI Framework | โ Manual | โ None | โ None | โ Built-in |
| Setup Time | ๐ก Weeks | ๐ก Hours | ๐ก Days | โ 30 seconds |
| Config Lines | โ ๏ธ 200+ | โ ๏ธ 150+ | โ ๏ธ 100+ | โ 30 lines |
Legend: โ Excellent | ๐ก Requires Work | โ ๏ธ Partial | โ Not Available
๐ Detailed Comparison Guide โ
๐ Documentation
๐ Getting Started
- Installation - Quick setup
- First Project - Create your first app
- Configuration - Type-safe config
- Why Django-CFG? - Full comparison
โ๏ธ Next.js Integration
- Overview - Three-in-One architecture
- Core Concepts - Philosophy & design
- Quick Start - 5-minute setup
- Configuration - All options
๐ก Real-Time & Microservices
- Centrifugo Integration - WebSocket setup
- Live Updates - Real-time data
- gRPC Streaming - Bidirectional streaming
- gRPC โ WebSocket Bridge - Auto-publish to clients
๐๏ธ Core Features
- Built-in Apps - 8 enterprise apps
- API Generation - Auto TypeScript clients
- Database - Multi-DB routing
- Type Safety - Pydantic validation
๐ค AI Features
- AI-Native Docs - MCP server for AI assistants
- AI Agents - Workflow automation
- Creating Agents - Build custom agents
- Django Integration - ORM integration
๐ Deployment
- Production Config - Best practices
- CLI Commands - 50+ commands
๐ค Community & Support
Resources
- ๐ djangocfg.com - Official website & docs
- ๐ GitHub - Source code & issues
- ๐ฌ Discussions - Community support
Links
- ๐ฏ Live Demo - See it in action
- ๐ฆ PyPI - Package repository
- ๐ Documentation - Complete guides
๐ License
MIT License - Free for commercial use
Made with โค๏ธ by the Django-CFG Team
Modern Django Framework โข Type-Safe Configuration โข AI-Native Docs โข Next.js Admin โข gRPC Streaming โข Real-Time WebSockets
Django-CFG is the modern Django framework for enterprise applications. Built with Pydantic v2 for type-safe configuration, first Django framework with MCP server for AI assistants, includes Next.js admin integration, gRPC bidirectional streaming with WebSocket bridge, Centrifugo real-time support, AI agent framework, and 8 production-ready apps. Perfect for building scalable microservices and real-time Django applications with reduced boilerplate and enterprise features out of the box.
Get Started: Documentation โข Live Demo โข GitHub
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_cfg-1.5.117.tar.gz.
File metadata
- Download URL: django_cfg-1.5.117.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a49ff19d65e0552c66beca6f7154e66466ececb59e26d86a7ef4bccb1573ba0
|
|
| MD5 |
8fe5694d8c8ffa2081a80a61771ef682
|
|
| BLAKE2b-256 |
8b28df679753e7fad5e6550e304b5119052ab5a5d8a5e482dd3b0742eed5e274
|
File details
Details for the file django_cfg-1.5.117-py3-none-any.whl.
File metadata
- Download URL: django_cfg-1.5.117-py3-none-any.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
722ae047e89d0424c47dc7b82d7fe5f87fc0b9471e87a7be14c44e0a31e069a0
|
|
| MD5 |
6b1834c4e5767e44111814000e9b5cd8
|
|
| BLAKE2b-256 |
6e11b1af5bebd9525a7c9830677fa6c010a7b70c2d1edbe238061f203c337def
|