Skip to content

danjac/django-studio

Repository files navigation

Django Studio

A production‑ready starter kit for modern Django applications.

Photo by James Kovin on Unsplash

Photo by James Kovin on Unsplash

Overview

Copier template for Django projects with HTMX, Alpine.js, and Tailwind CSS.

This project is designed to be a starting point for building modern Django applications with a focus on simplicity, performance, and developer experience. It includes an opinionated and carefully curated stack of tools and libraries to help you get up and running quickly while following best practices, a design pattern library with tried-and-tested components and agentic Markdown documentation and custom Skills for AI-assisted development.

Status

This project is best described as "pre-alpha". While based on working projects in production, this is a new repo and the template has not yet been tested by external users. Expect many breaking changes and rough edges.

Audience

This template is built for solo developers building side projects and small SaaS applications. It encodes one person's proven defaults (stack choices, hosting provider, deployment topology) rather than aiming to be a general-purpose starter kit.

This project is intended for experienced developers who are comfortable with the stack choices and general web development concepts. It is not a tutorial or learning resource for beginners, but rather a practical tool to jumpstart new projects with a solid foundation.

This project provides AI-related features for those who wish to use LLMs as part of their workflow, but this is not a requirement and the project can be used without these features. You should always be comfortable taking the wheel and reviewing and modifying the code by hand as needed.

Getting Started

uvx copier copy --trust gh:danjac/django-studio my-project

Then follow the prompts:

Prompt Example Notes
project_name My Project Human-readable name
project_slug my_project Python package directory name
package_name my_project Python package name (snake_case)
description A project that does X One-sentence description
author Your Name
author_email [email protected]
domain example.com Production domain
license MIT MIT, Apache-2.0, GPL-3.0, AGPL-3.0, LGPL-3.0, MPL-2.0, BSD-2-Clause, BSD-3-Clause, ISC, EUPL-1.2, None

Updating a generated project

Once a project has been generated and committed, you can pull in template updates:

cd my-project
uvx copier update --trust

Copier performs a 3-way merge so your local changes are preserved. Resolve any conflicts, then commit.

The generated README.md will include instructions to get started with development, testing, and deployment.

Features

  • Django 6 with a modern stack (HTMX, Alpine.js, Tailwind CSS)
  • Docker Compose setup for local development (PostgreSQL, Redis, Mailpit)
  • Kubernetes deployment with Helm Charts
  • Grafana dashboards for OpenTelemetry monitoring
  • Terraform IaC scripts for provisioning Hetzner Cloud infrastructure and Cloudflare DNS
  • Design system with reusable components
  • AI-assisted development with agent documentation, agentic hooks, and project Skills

Stack

The focus of this project is a simple and robust foundation for both user and developer experience. Django is a tried and tested framework with a strong emphasis on convention and best practices, making it an ideal choice for the backend. For the frontend, HTMX and Alpine.js provide a powerful combination for building dynamic interfaces without the complexity of a full JavaScript framework, while Tailwind CSS offers a utility-first approach to styling that promotes consistency and rapid development.

K3s is a lightweight Kubernetes distribution that allows for easy deployment and scaling of applications. By using K3s, we can ensure that our application is production-ready and can handle increased traffic as needed. Helm Charts have been provided to deploy your project along with Grafana dashboards for monitoring. Full Github Actions CI/CD pipelines are included for testing and deployment.

This stack will be assessed constantly to ensure it remains the best choice for the target audience and use cases. If better tools or libraries become available, they will be evaluated and potentially integrated into the template in addition to or in place of the current choices.

Design system

UI components are provided by DaisyUI, a Tailwind CSS component library with 50+ production-ready components, built-in dark mode, and semantic theming. DaisyUI is vendored as .mjs files (no npm required) and works with the django-tailwind-cli standalone binary.

  • 50+ ready-made components (buttons, forms, modals, drawers, tabs, etc.)
  • Automatic dark/light mode via DaisyUI themes
  • Semantic color system (primary, secondary, error, etc.)
  • Focus on accessibility
  • Responsive layouts

Skills

Generated projects include dj-* Claude Code and OpenCode slash commands for common workflows:

General

Command Summary
/dj-help List all dj-* commands or show help for a specific command
/dj-sync Pull latest template changes via Copier and resolve merge conflicts interactively
/dj-feedback Report a bug or improvement against the django-studio template

Generators

Command Summary
/dj-create-app Create a Django app (apps.py, models, views, urls, admin, tests)
/dj-create-view Add a view, template, and URL
/dj-create-task Add a django-tasks-db background task with correct async patterns
/dj-create-command Add a management command with tests
/dj-create-model Design and write a Django model with factory, fixture, and model tests
/dj-create-migration Create a data migration (Python or SQL)
/dj-create-crud Generate full CRUD views, templates, URLs, and tests
/dj-create-e2e Write Playwright E2E test(s) for a described user interaction
/dj-create-tag Add a template tag (simple_tag, simple_block_tag, inclusion_tag, Node)
/dj-create-filter Add a template filter with correct escaping flags

Localisation

Command Summary
/dj-localize Add localization formats, extract strings, translate using agent, compile .mo catalogue

Audits

Command Summary
/dj-perf Performance audit: N+1 queries, missing indexes, caching, async
/dj-secure Security audit: settings, views, XSS, CSRF, IDOR, SQL injection
/dj-gdpr GDPR compliance audit: PII in models, erasure, consent, logging
/dj-a11y Accessibility audit: WCAG 2.1 AA — forms, icons, HTMX, Alpine, semantic HTML
/dj-deadcode Remove unused Python code, Django templates and static assets
/dj-full-coverage Enable 100% coverage gate and write tests for all uncovered lines

Deployment

Command Summary
/dj-launch Interactive first-deploy wizard: provisions infra, configures secrets, deploys
/dj-launch-observability Deploy the observability stack (Grafana + Prometheus + Loki)
/dj-scale [n] View or change the webapp replica count
/dj-rotate-secrets Rotate auto-generated and third-party Helm secrets and redeploy
/dj-enable-db-backups Enable automated daily PostgreSQL backups to a private Object Storage bucket
/dj-db-backup Trigger an immediate database backup without waiting for the daily cron
/dj-db-restore Guided production database restore from Object Storage backup
/dj-deploy-cron Schedule a management command as a Kubernetes cron job

MCP Servers

Generated projects include project-local MCP servers configured in .mcp.json (gitignored, generated at project creation). These give AI assistants direct access to your local development environment.

Server Purpose
@modelcontextprotocol/server-postgres Direct database queries and schema inspection
@playwright/mcp Browser automation and E2E test debugging
mcp-django Django shell — ORM queries, model introspection, arbitrary Python

See docs/mcp.md in the generated project for usage and security notes.

Hosting

Hetzner Cloud is a very cost-effective, EU-based hosting provider. Cloudflare is currently the cheapest and most secure option for DNS, CDN, SSL, and DDoS protection. These solutions will be reviewed on a regular basis - if better options become available, they will be offered instead of or addition to these choices.

Prices are subject to change, but the current hosting costs based on the default settings should range between 20-40 EUR per month.

Requirements

Development

Tool Purpose Install
uv Python package manager (runs uvx copier) curl -LsSf https://astral.sh/uv/install.sh | sh
just Task runner cargo install just or via your OS package manager
Docker + Compose PostgreSQL, Redis, Mailpit See Docker docs
gh GitHub CLI (issues, PRs) See install docs

Python 3.14 is managed automatically by uv - no separate install needed.

Deployment

Tool Purpose Install
Terraform Provision Hetzner infrastructure and Cloudflare DNS See install docs
Helm Deploy Kubernetes workloads See install docs
kubectl Kubernetes CLI See install docs
hcloud Hetzner Cloud CLI See install docs

See docs/deployment.md in the generated project for full deployment instructions.

About

Django project generator for rapid, opinionated full stack development

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors