Skip to main content

A CLI tool to quickly scaffold Django + Inertia.js projects with React or Vue

Project description

Django Inertia Starter

A powerful CLI tool to quickly scaffold Django + Inertia.js projects with React or Vue.js frontends.

๐Ÿš€ Quick Start

Installation

pip install create-django-inertia

Create a New Project

# Basic project creation (interactive prompts)
create-django-inertia myproject

# Create with React and TypeScript
create-django-inertia myproject --react --typescript

# Create with Vue 3 and TypeScript  
create-django-inertia myproject --vue --typescript

# Create in current directory
create-django-inertia myproject . --react

Run Your Project

cd myproject

# Backend setup
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
python manage.py migrate

# Frontend setup  
npm install

# Run development servers
python manage.py runserver & npm run dev

Visit http://localhost:8000 to see your app!

๐Ÿ“ Project Structure

myproject/
โ”œโ”€โ”€ manage.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ package.json             # Frontend dependencies
โ”œโ”€โ”€ vite.config.ts           # Vite configuration
โ”œโ”€โ”€ tsconfig.json            # TypeScript config (if --typescript)
โ”œโ”€โ”€ .gitignore
โ”‚
โ”œโ”€โ”€ myproject/               # Django project settings
โ”‚   โ”œโ”€โ”€ settings.py          # Pre-configured with Inertia.js
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ”œโ”€โ”€ views.py             # Inertia.js views
โ”‚   โ”œโ”€โ”€ wsgi.py
โ”‚   โ””โ”€โ”€ asgi.py
โ”‚
โ”œโ”€โ”€ home/                    # Django app
โ”‚   โ”œโ”€โ”€ views.py             # Sample Inertia views
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ””โ”€โ”€ migrations/
โ”‚
โ”œโ”€โ”€ templates/
โ”‚   โ””โ”€โ”€ base.html            # Inertia.js layout with Vite integration
โ”‚
โ”œโ”€โ”€ static/                  # Frontend source files
โ”‚   โ”œโ”€โ”€ components/          # Reusable components
โ”‚   โ”œโ”€โ”€ pages/               # Inertia.js pages
โ”‚   โ”‚   โ””โ”€โ”€ home/
โ”‚   โ”‚       โ””โ”€โ”€ page.tsx     # Home page component
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”‚   โ””โ”€โ”€ app.css          # Tailwind CSS with OKLCH colors
โ”‚   โ”œโ”€โ”€ lib/                 # Utilities and helpers
โ”‚   โ””โ”€โ”€ main.tsx             # Frontend entry point
โ”‚
โ””โ”€โ”€ media/                   # User uploads

โš™๏ธ Features

๐Ÿ—๏ธ Full-Stack Integration

  • Django Backend: Robust Python web framework with ORM, admin, and security
  • Inertia.js: Seamless SPA experience without separate API
  • Modern Frontend: React 18 or Vue 3 with Vite 6.0 for fast development

๐ŸŽจ Frontend Options

  • React: Modern React with hooks and TypeScript support
  • Vue 3: Composition API with <script setup> syntax
  • TypeScript: Full TypeScript support for both frameworks
  • Vite 6.0: Latest build tool with improved performance

๐Ÿ”ง Developer Experience

  • Hot Module Replacement: Instant updates during development
  • Pre-configured: Ready-to-use setup with modern defaults
  • Modern Design: Beautiful landing page with OKLCH color system
  • Tailwind CSS v4: Latest CSS framework with inline theming
  • Geist Fonts: Modern typography from Vercel

๐Ÿ“ฆ Production Ready

  • Static Files: Optimized Django static file handling with Vite
  • Modern Dependencies: Latest stable versions of all packages
  • Build Process: Optimized production builds
  • Deployment: Works with any Django hosting solution

๐Ÿ› ๏ธ Command Options

create-django-inertia

create-django-inertia PROJECT_NAME [DIRECTORY] [OPTIONS]

Arguments:

  • PROJECT_NAME: Name of your project (required)
  • DIRECTORY: Directory to create project in (optional, defaults to project name or use . for current directory)

Options:

  • --react: Use React frontend framework
  • --vue: Use Vue 3 frontend framework
  • --typescript: Use TypeScript instead of JavaScript
  • --force: Overwrite existing directory
  • --no-install: Skip installation prompts
  • --help: Show help message

Examples:

# Interactive setup (prompts for framework choice)
create-django-inertia myblog

# React with TypeScript
create-django-inertia myblog --react --typescript

# Vue 3 with TypeScript
create-django-inertia myblog --vue --typescript

# Create in current directory
create-django-inertia myblog . --react

# Force overwrite existing directory
create-django-inertia myblog --react --force

# Skip installation steps
create-django-inertia myblog --vue --no-install

๐Ÿƒโ€โ™‚๏ธ Development Workflow

1. Create and Setup Project

create-django-inertia myapp --react --typescript
cd myapp
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
npm install

2. Database Setup

python manage.py migrate
python manage.py createsuperuser  # Optional: create admin user

3. Development Servers

# Single command (runs both servers)
python manage.py runserver & npm run dev

# Or in separate terminals:
# Terminal 1: Django backend
python manage.py runserver

# Terminal 2: Vite frontend  
npm run dev

4. Create New Pages

  1. Add Django view in home/views.py:
def about(request):
    return inertia_render(request, 'home/about', {
        'message': 'About our company'
    })
  1. Add URL route in home/urls.py:
path('about/', views.about, name='about'),
  1. Create frontend component in static/pages/home/about.tsx (React) or static/pages/home/about.vue (Vue)

๐ŸŽฏ What's Included

Backend (Django)

  • โœ… Django 4.2+ with modern Python features
  • โœ… Inertia.js middleware and configuration
  • โœ… Home app with sample Inertia views
  • โœ… Admin interface ready
  • โœ… Static files configuration for Vite
  • โœ… CSRF protection integrated
  • โœ… Modern Django project structure

Frontend (React/Vue)

  • โœ… React 18 or Vue 3 with modern patterns
  • โœ… TypeScript support (optional)
  • โœ… Vite 6.0 for lightning-fast development
  • โœ… Inertia.js client-side routing
  • โœ… Tailwind CSS v4 with OKLCH colors
  • โœ… Modern landing page with components
  • โœ… Hot module replacement
  • โœ… Geist fonts integration
  • โœ… Production build optimization

๐Ÿ“š Learn More

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Django team for the amazing web framework
  • Inertia.js team for bridging frontend and backend
  • React and Vue teams for excellent frontend frameworks
  • Vite team for the blazing fast build tool

Happy coding! ๐Ÿš€

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

create_django_inertia-1.0.1.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

create_django_inertia-1.0.1-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

File details

Details for the file create_django_inertia-1.0.1.tar.gz.

File metadata

  • Download URL: create_django_inertia-1.0.1.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for create_django_inertia-1.0.1.tar.gz
Algorithm Hash digest
SHA256 66c417cc9a52ef7a6e4a0d50e6a1ffca1faecd3f43b413fe3a3cc6f8e8f71192
MD5 0065528078f402cab014e6a44b96b7f6
BLAKE2b-256 9b953d25a7d62f1aac8d246776d222d5e34f7d7b6585dd23f36d719294e45219

See more details on using hashes here.

File details

Details for the file create_django_inertia-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for create_django_inertia-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06f175296628ffe00499d172f94d80a329bb15247bb1d0969d5e9f7702438b85
MD5 42da5dd1c3696edf323536328293366c
BLAKE2b-256 a2bc83727c1fddf3414410b6cd07caa9ef285c489a65aa2b99a504d29fa29a9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page