A production‑ready starter kit for modern Django applications.
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 |
you@example.com |
|
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 |
Generating from a branch
To generate from a specific branch (e.g. to test a pre-release feature):
uvx copier copy --trust "gh:danjac/django-studio@branch-name" my-projectUpdating a generated project
Once a project has been generated and committed, you can pull in template updates:
cd my-project
uvx copier update --trustCopier 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, project Skills, and MCP servers (PostgreSQL, Playwright, Django shell)
Stack
- Python 3.14, Django 6.1, PostgreSQL 18, Redis 8
- HTMX + Alpine.js + Tailwind CSS (no JS build step)
- uv for dependency management
- just for task running
- Django tasks for background tasks (instead of Celery)
- django-allauth for authentication
- pre-commit hooks for linting
- Cloudflare for DNS, CDN, SSL, and DDoS protection
- Hetzner Cloud for hosting (K3s) and object storage
- Full test coverage (pytest + Playwright)
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.
A guiding principle throughout is Locality of Behaviour: the behaviour of a piece of code should be obvious from looking at that code. HTMX, Alpine.js and Tailwind all put behaviour and styling directly on the element, and the generated project applies the same idea to its Python code - tests live beside the modules they test, feature code (such as an app's API or webhooks) lives in the app that owns it, and shared abstractions are extracted only once they are genuinely shared. See template/docs/project-structure.md for details.
Further reading:
- Locality of Behaviour - Carson Gross, the htmx essay that names the principle
- Colocation - Kent C. Dodds on keeping code, tests and styles close to where they are used
- The Wrong Abstraction - Sandi Metz on why duplication is cheaper than a premature abstraction
- CSS Utility Classes and "Separation of Concerns" - Adam Wathan, creator of Tailwind CSS, on styling at the element
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.
If you want to change any of the fundamental building-blocks of the stack - for example, switching from HTMX to React, or deploying to AWS instead of Hetzner - you are encouraged to make the changes you need in your project or fork this repository. The goal is to provide a solid starting point, not to lock you into a specific stack or workflow that does not suit your needs.
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 |
/dj-doc |
Create or update project-specific docs: domain, apps, rules, APIs, integrations |
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 recipe, 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 with TranslateBot, 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-remove-slop |
Audit and remove Django anti-patterns introduced by AI or inattentive devs |
/dj-full-coverage |
Enable 100% coverage gate and write tests for all uncovered lines |
Deployment
| Command | Summary |
|---|---|
/dj-deploy |
Interactive first-deploy wizard: provisions infra, configures secrets, deploys |
/dj-deploy-observe |
Deploy the observability stack (Grafana + Prometheus + Loki) |
/dj-tailscale [cmd] |
Enable, check or disable Tailscale private networking for the cluster |
/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 |
Feedback Loop
Two skills in particular are designed to help you provide feedback on the template itself: dj-sync and dj-feedback. The first allows you to pull in the latest template changes and resolve any merge conflicts interactively, while the second lets you report bugs or suggest improvements directly from your project.
This alleviates a common issue with template projects: once a project is generated, it can be difficult to keep it up to date with the latest improvements and fixes. By providing these skills, we aim to create a feedback loop that benefits both the template maintainers and the developers using it. As more developers use django-studio, we expect to receive valuable feedback that will help us refine the template and make it even more useful for the community.
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.
The point is that hosting is low and fixed. You pay per server, not per request, so the bill is the same whether the app is idle or busy - no egress charges, no per-request fees, no autoscaling that runs away. The default single-node topology is the cheapest option, and each role you split onto its own node adds exactly one server to the bill. See Hetzner's pricing for current rates.
Private networking with Tailscale
Tailscale is supported as an optional extra. When enabled, every node joins a private WireGuard mesh and SSH and the Kubernetes API travel over the tailnet instead of the public internet, so ports 22 and 6443 can be closed to everyone else. Ports 80 and 443 stay open for web traffic via Cloudflare.
It is off by default - there is no Copier question for it. Set tailscale_oauth_client_secret in terraform/hetzner/terraform.tfvars, or run /dj-tailscale enable, which handles both a fresh deploy and retrofitting a cluster that is already running.
Tailscale's free tier covers 3 users and 100 devices, so for solo projects and small teams this adds no cost. See docs/infrastructure.md in the generated project for the full setup.
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 |
| tailscale | Only if Tailscale is enabled - required to reach the cluster | See install docs |
See docs/deployment.md in the generated project for full deployment instructions.
