README.md

April 15, 2026 ยท View on GitHub

django-structurator

๐Ÿš€ django-structurator is an incredibly powerful, AI-friendly CLI tool designed to scaffold production-ready Django projects and apps instantly. It enforces a strict, scalable architecture out of the box, eliminating repetitive boilerplate and creating a highly modular environment.

Whether you're a human developer looking for consistency or an AI Coding Assistant (like Cursor, Claude, or Antigravity) seeking explicit structural rules, this package lays down a flawless foundation. No extra dependencies. No bloated templates. Just a clean, prompt-driven workflow.


โš™๏ธ Features

  • ๐Ÿ“ Scalable Folder Structure โ€“ Consistent architecture for better maintainability.
  • ๐Ÿงฉ Modular App Generation โ€“ Create Django apps with optional files: forms, signals, validators, tasks, and more.
  • ๐Ÿ”Œ Optional Add-ons:
    • Django REST Framework (DRF)
    • Django Debug Toolbar
    • Celery + Redis
    • SMTP Email Configuration
    • Jazzmin Admin UI
    • Custom Django Logger
  • ๐Ÿ“„ Auto-generates essentials: .env.example, .gitignore, requirements/, and more.

๐Ÿ“ฆ Installation

pip install django-structurator

โšก Usage

๐Ÿ“‚ Create a New Django Project

Interactive Mode:

django-str startproject

Non-Interactive Mode (Full Stack Automation):

django-str startproject --no-que --name myproject --path . --env django-environ --db postgresql --use-docker --use-celery

The CLI natively supports configuring:

  • Database: SQLite / PostgreSQL / MySQL
  • Environments: django-environ / python-dotenv
  • Optional Integrations: use-smtp-email, use-celery, use-redis, use-drf, use-jazzmin, use-logger, use-docker

๐Ÿงฑ Create a New Django App

App generation must be executed from the root of an existing Django project (where manage.py lives).

Interactive Mode:

django-str startapp

Non-Interactive Mode (API Microservice):

django-str startapp --no-que --name billing --use-api-drf --use-tasks

Optional App-level Modules:

  • use-forms, use-signals, use-tasks, use-app-static-template, use-template-tags, use-api-drf

๐Ÿ—๏ธ Example Project Structure

```text
my_project/
โ”‚
โ”œโ”€โ”€ docs/                     # Documentation files
โ”‚   โ”œโ”€โ”€ ARCHITECTURE.md       # Project folder architecture guide
โ”‚   โ”œโ”€โ”€ CHANGELOG.md          # Change log for the project
โ”‚   โ””โ”€โ”€ README.md             # Main documentation file
โ”‚
โ”œโ”€โ”€ local_db/                 # Local SQLite database for development
โ”‚   โ””โ”€โ”€ db.sqlite3
โ”‚
โ”œโ”€โ”€ logs/                     # Every level Log files will be here
โ”‚   โ”œโ”€โ”€ critical.log
โ”‚   โ”œโ”€โ”€ debug.log
โ”‚   โ”œโ”€โ”€ error.log
โ”‚   โ”œโ”€โ”€ info.log
โ”‚   โ””โ”€โ”€ warning.log
โ”‚
โ”œโ”€โ”€ nginx/                    # Optional: Nginx reverse proxy configuration
โ”‚   โ””โ”€โ”€ nginx.conf
โ”‚
โ”œโ”€โ”€ docker-compose.yml        # Optional: Docker map (web, db, redis, celery)
โ”œโ”€โ”€ Dockerfile                # Optional: Docker web container configuration
โ”‚
โ”œโ”€โ”€ requirements/             # Dependency management
โ”‚   โ”œโ”€โ”€ base.txt              # Core dependencies
โ”‚   โ”œโ”€โ”€ development.txt       # Development-specific dependencies
โ”‚   โ”œโ”€โ”€ production.txt        # Production-specific dependencies
โ”‚   โ””โ”€โ”€ test.txt              # Testing dependencies
โ”‚
โ”œโ”€โ”€ src/                      # Main source code folder
โ”‚   โ”œโ”€โ”€ apps/                 # All Django apps
โ”‚   โ”‚   โ”œโ”€โ”€ app-1/            # Example Django app
โ”‚   โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ api/          # API for app-1
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ v1/       # Version 1 of the API
โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ serializers.py
โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ views.py
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ migrations/   # Database migrations
โ”‚   โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ templatetags/ # Custom template tags and filters
โ”‚   โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ admin.py      # Admin site configuration
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ apps.py       # App configuration
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ models.py     # App models (Abstracts TimeStamped UUID)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ tests.py      # Isolated DB test cases
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ urls.py       # App-specific URL patterns
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ views.py      # App views
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ app-2/            # Another app
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ common/               # Shared utilities, constants, and helpers
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ constants.py      # Commonly used constants
โ”‚   โ”‚   โ””โ”€โ”€ helpers.py        # Utility functions (mailer, loggers)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ config/               # Project configuration
โ”‚   โ”‚   โ”œโ”€โ”€ settings/         # Environment-specific settings
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ base.py       # Base settings
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ development.py # Development environment settings
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ production.py # Production environment settings
โ”‚   โ”‚   โ”œโ”€โ”€ .env              # Environment secrets boundary
โ”‚   โ”‚   โ”œโ”€โ”€ .env.example      # Example env file
โ”‚   โ”‚   โ”œโ”€โ”€ asgi.py           # ASGI configuration
โ”‚   โ”‚   โ”œโ”€โ”€ celery.py         # Celery configuration file
โ”‚   โ”‚   โ”œโ”€โ”€ urls.py           # Master URL configuration
โ”‚   โ”‚   โ””โ”€โ”€ wsgi.py           # WSGI configuration
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ media/                # Uploaded media files
โ”‚   โ”œโ”€โ”€ static/               # Static files
โ”‚   โ”œโ”€โ”€ templates/            # Global HTML templates
โ”‚   โ””โ”€โ”€ manage.py             # Django's management script
โ”‚
โ””โ”€โ”€ .gitignore                # Git ignore file

โœ… Requirements

  • Python 3.8+
  • Django 3.2+

๐Ÿง  Why Use It?

  • ๐Ÿ”ฅ Save time and skip repetitive setup

  • ๐Ÿงผ Enforce consistency across teams

  • โšก Fast, interactive, zero-bloat generator


๐Ÿ“„ License

MIT License - See the LICENSE