Skip to main content

Phoenix LiveView-style reactive components for Django with Rust-powered performance. Real-time UI updates over WebSocket, no JavaScript build step required.

Project description

djust

Blazing fast reactive server-side rendering for Django, powered by Rust

djust brings Phoenix LiveView-style reactive components to Django, with performance that feels native. Write server-side Python code with automatic, instant client updates—no JavaScript bundling, no build step, no complexity.

🌐 djust.org | 📚 docs.djust.org | 🚀 Quick Start | 📝 Examples

PyPI version CI MIT License Python 3.10+ Django 4.2+ PyPI Downloads

✨ Features

  • 10-100x Faster - Rust-powered template engine and Virtual DOM diffing
  • 🔄 Reactive Components - Phoenix LiveView-style server-side reactivity
  • 🔌 Django Compatible - Works with existing Django templates and components
  • 📦 Zero Build Step - ~53 KB gzipped minified client JavaScript, no bundling needed
  • 🌐 WebSocket Updates - Real-time DOM patches over WebSocket (with HTTP fallback)
  • 🎯 Minimal Client Code - Smart diffing sends only what changed
  • 🔒 Type Safe - Rust guarantees for core performance-critical code
  • 🐞 Developer Debug Panel - Interactive debugging with event history and VDOM inspection
  • 💤 Lazy Hydration - Defer WebSocket connections for below-fold content (20-40% memory savings)
  • 🚀 TurboNav Compatible - Works seamlessly with Turbo-style client-side navigation
  • 📱 PWA Support - Offline-first Progressive Web Apps with automatic sync
  • 🏢 Multi-Tenant Ready - Production SaaS architecture with tenant isolation
  • 🔐 Authentication & Authorization - View-level and handler-level auth with Django permissions integration

🎯 Quick Example

from djust import LiveView, event_handler

class CounterView(LiveView):
    template_string = """
    <div>
        <h1>Count: {{ count }}</h1>
        <button dj-click="increment">+</button>
        <button dj-click="decrement">-</button>
    </div>
    """

    def mount(self, request, **kwargs):
        self.count = 0

    @event_handler
    def increment(self):
        self.count += 1  # Automatically updates client!

    @event_handler
    def decrement(self):
        self.count -= 1

That's it! No JavaScript needed. State changes automatically trigger minimal DOM updates.

🔄 How Reactivity Works

djust uses a Rust-powered Virtual DOM (VDOM) to diff server-rendered HTML and send only the changed patches over WebSocket. Understanding a few core attributes makes everything click.

Template Anatomy

{% load djust_tags %}
<!DOCTYPE html>
<html>
<head>
    {% djust_scripts %}              {# Loads the client runtime #}
</head>
<body dj-view="{{ dj_view_id }}">   {# Identifies the WebSocket session #}
    <div dj-root>                    {# Reactive boundary — only this is diffed #}
        <h1>Count: {{ count }}</h1>
        <button dj-click="increment">+</button>
    </div>
    {# Static content outside dj-root is never touched by VDOM patching #}
</body>
</html>
Attribute Where Purpose
{% djust_scripts %} <head> Injects client JavaScript
dj-view="{{ dj_view_id }}" <body> Connects page to WebSocket session
dj-root Inner <div> Marks the reactive region; only HTML inside is diffed and patched

Stable List Identity

For lists that can reorder or have items inserted/deleted, add data-key or dj-key on each item. djust uses this to emit MoveChild patches instead of remove-then-insert pairs — preserving DOM state (focus, scroll position, animations):

{% for item in items %}
<div data-key="{{ item.id }}">
    {{ item.name }}
    <button dj-click="delete" data-item-id="{{ item.id }}">Delete</button>
</div>
{% endfor %}

Without a key, djust diffs by position — correct, but produces more DOM mutations for reorders.

Common Pitfall: One-Sided {% if %} in Class Attributes

Using {% if %} without {% else %} inside an HTML attribute value can cause VDOM patching misalignment due to djust's branch-aware div-depth counting:

{# WRONG: one-sided if inside class attribute #}
<div class="card {% if active %}active{% endif %}">

{# CORRECT: use full if/else #}
<div class="card {% if active %}active{% else %}{% endif %}">

{# ALSO CORRECT: move conditional outside the tag #}
{% if active %}
<div class="card active">
{% else %}
<div class="card">
{% endif %}
    ...
</div>

This applies only to attribute values — {% if %} blocks in element content work fine.

See the VDOM Architecture guide and Template Cheat Sheet for full details.

🚀 Getting Started

Here's a complete walkthrough from zero to a working reactive counter in 5 steps.

Step 1 — Install

pip install djust django-channels

Step 2 — Add to INSTALLED_APPS and configure settings

In myproject/settings.py:

INSTALLED_APPS = [
    # ... your existing apps ...
    'channels',   # WebSocket support
    'djust',
]

ASGI_APPLICATION = 'myproject.asgi.application'

CHANNEL_LAYERS = {
    'default': {
        'BACKEND': 'channels.layers.InMemoryChannelLayer',
    }
}

Step 3 — Configure asgi.py

Replace myproject/asgi.py with:

import os
from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from djust.websocket import LiveViewConsumer
from django.urls import path

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')

application = ProtocolTypeRouter({
    "http": get_asgi_application(),
    "websocket": AuthMiddlewareStack(
        URLRouter([
            path('ws/live/', LiveViewConsumer.as_asgi()),
        ])
    ),
})

Step 4 — Add the URL route

In myproject/urls.py:

from django.urls import path
from myapp.views import CounterView

urlpatterns = [
    path('counter/', CounterView.as_view(), name='counter'),
]

Step 5 — Write the view and template

myapp/views.py:

from djust import LiveView, event_handler

class CounterView(LiveView):
    template_name = 'counter.html'

    def mount(self, request, **kwargs):
        self.count = 0

    @event_handler
    def increment(self):
        self.count += 1

    @event_handler
    def decrement(self):
        self.count -= 1

myapp/templates/counter.html:

{% load djust_tags %}
<!DOCTYPE html>
<html>
<head>
    <title>Counter</title>
    {% djust_scripts %}
</head>
<body dj-view="{{ dj_view_id }}">
    <div dj-root>
        <h1>Count: {{ count }}</h1>
        <button dj-click="increment">+</button>
        <button dj-click="decrement">-</button>
    </div>
</body>
</html>

Run with uvicorn myproject.asgi:application --reload and open /counter/. Clicking the buttons updates the count without a page reload — no JavaScript written, no build step.

Next steps:


📊 Performance

Benchmarked on M1 MacBook Pro (2021):

Operation Django djust Speedup
Template Rendering (100 items) 2.5 ms 0.15 ms 16.7x
Large List (10k items) 450 ms 12 ms 37.5x
Virtual DOM Diff N/A 0.08 ms Sub-ms
Round-trip Update 50 ms 5 ms 10x

Run benchmarks yourself:

cd benchmarks
python benchmark.py

🚀 Installation

Prerequisites

  • Python 3.10+
  • Rust 1.70+ (for building from source)
  • Django 4.2+

Install from PyPI

pip install djust

Build from Source

Using Make (Easiest - Recommended for Development)

# Clone the repository
git clone https://github.com/djust-org/djust.git
cd djust

# Install Rust (if needed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install everything and build
make install

# Start the development server
make start

# See all available commands
make help

Common Make Commands:

  • make start - Start development server with hot reload
  • make stop - Stop the development server
  • make status - Check if server is running
  • make test - Run all tests
  • make clean - Clean build artifacts
  • make help - Show all available commands

Using uv (Fast)

# Clone the repository
git clone https://github.com/djust-org/djust.git
cd djust

# Install Rust (if needed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install uv (if needed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install maturin and build
uv pip install maturin
maturin develop --release

Using pip

# Clone the repository
git clone https://github.com/djust-org/djust.git
cd djust

# Install Rust (if needed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install maturin
pip install maturin

# Build and install
maturin develop --release

# Or build wheel
maturin build --release
pip install target/wheels/djust-*.whl

📖 Documentation

Setup

  1. Add to INSTALLED_APPS:
INSTALLED_APPS = [
    # ...
    'channels',  # Required for WebSocket support
    'djust',
    # ...
]
  1. Configure ASGI application (asgi.py):
import os
from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from djust.websocket import LiveViewConsumer
from django.urls import path

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')

application = ProtocolTypeRouter({
    "http": get_asgi_application(),
    "websocket": AuthMiddlewareStack(
        URLRouter([
            path('ws/live/', LiveViewConsumer.as_asgi()),
        ])
    ),
})
  1. Add to settings.py:
ASGI_APPLICATION = 'myproject.asgi.application'

CHANNEL_LAYERS = {
    'default': {
        'BACKEND': 'channels.layers.InMemoryChannelLayer'
    }
}

Creating LiveViews

Class-Based LiveView

from djust import LiveView, event_handler

class TodoListView(LiveView):
    template_name = 'todos.html'  # Or use template_string

    def mount(self, request, **kwargs):
        """Called when view is first loaded"""
        self.todos = []

    @event_handler
    def add_todo(self, text):
        """Event handler - called from client"""
        self.todos.append({'text': text, 'done': False})

    @event_handler
    def toggle_todo(self, index):
        self.todos[index]['done'] = not self.todos[index]['done']

Function-Based LiveView

from djust import live_view

@live_view(template_name='counter.html')
def counter_view(request):
    count = 0

    def increment():
        nonlocal count
        count += 1

    return locals()  # Returns all local variables as context

Template Syntax

djust supports Django template syntax with event binding:

<!-- Variables -->
<h1>{{ title }}</h1>

<!-- Filters (all 57 Django built-in filters supported) -->
<p>{{ text|upper }}</p>
<p>{{ description|truncatewords:20 }}</p>
<a href="?q={{ query|urlencode }}">Search</a>
{{ body|urlize }}  {# No |safe needed — djust's Rust engine auto-marks urlize output as safe via safe_output_filters. Unlike standard Django where you'd add |safe, djust handles this automatically. #}

<!-- Control flow -->
{% if show %}
    <div>Visible</div>
{% endif %}

{% if count > 10 %}
    <div>Many items!</div>
{% endif %}

{% for item in items %}
    <li>{{ item }}</li>
{% endfor %}

<!-- URL resolution -->
<a href="{% url 'myapp:detail' pk=item.id %}">View</a>

<!-- Template includes -->
{% include "partials/header.html" %}

<!-- Event binding -->
<button dj-click="increment">Click me</button>
<input dj-input="on_search" type="text" />
<form dj-submit="submit_form">
    <input name="email" />
    <button type="submit">Submit</button>
</form>

Django migration note: In standard Django, urlize requires |safe to render its HTML output. djust's Rust template engine automatically marks urlize, urlizetrunc, and unordered_list as safe (via safe_output_filters in the renderer) because these filters handle their own HTML escaping internally. Adding |safe after them is unnecessary.

Supported Events

  • dj-click - Click events
  • dj-input - Input events (passes value)
  • dj-change - Change events (passes value)
  • dj-submit - Form submission (passes form data as dict)

Reusable Components

djust provides a powerful component system with automatic state management and stable component IDs.

Basic Component Example

from djust.components import AlertComponent

class MyView(LiveView):
    def mount(self, request):
        # Components get automatic IDs based on attribute names
        self.alert_success = AlertComponent(
            message="Operation successful!",
            type="success",
            dismissible=True
        )
        # component_id automatically becomes "alert_success"

Component ID Management

Components automatically receive a stable component_id based on their attribute name in your view. This eliminates manual ID management:

# When you write:
self.alert_success = AlertComponent(message="Success!")

# The framework automatically:
# 1. Sets component.component_id = "alert_success"
# 2. Persists this ID across renders and events
# 3. Uses it in HTML: data-component-id="alert_success"
# 4. Routes events back to the correct component

Why it works:

  • The attribute name (alert_success) is already unique within your view
  • It's stable across re-renders and WebSocket reconnections
  • Event handlers can reference components by their attribute names
  • No manual ID strings to keep in sync

Event Routing Example:

class MyView(LiveView):
    def mount(self, request):
        self.alert_warning = AlertComponent(
            message="Warning message",
            dismissible=True
        )

    @event_handler
    def dismiss(self, component_id: str = None):
        """Handle dismissal - automatically routes to correct component"""
        if component_id and hasattr(self, component_id):
            component = getattr(self, component_id)
            if hasattr(component, 'dismiss'):
                component.dismiss()  # component_id="alert_warning"

When the dismiss button is clicked, the client sends component_id="alert_warning", and the handler uses getattr(self, "alert_warning") to find the component.

Creating Custom Components

from djust import LiveComponent, event_handler
from djust.components import register_component

class ButtonComponent(LiveComponent):
    template = '<button dj-click="on_click" data-component-id="{{ component_id }}">{{ label }}</button>'

    def mount(self, **kwargs):
        self.label = kwargs.get("label", "Click")
        self.clicks = 0

    @event_handler()
    def on_click(self, **kwargs):
        self.clicks += 1
        self.trigger_update()

    def get_context_data(self):
        return {"label": self.label, "clicks": self.clicks}

# register_component accepts LiveComponent subclasses (stateful, event-driven)
register_component('my-button', ButtonComponent)

Decorators

from djust import LiveView, event_handler, reactive

class MyView(LiveView):
    @event_handler
    def handle_click(self):
        """Marks method as event handler"""
        pass

    @reactive
    def count(self):
        """Reactive property - auto-triggers updates"""
        return self._count

    @count.setter
    def count(self, value):
        self._count = value

Configuration

Configure djust in your Django settings.py:

LIVEVIEW_CONFIG = {
    # Transport mode
    'use_websocket': True,  # Set to False for HTTP-only mode (no WebSocket dependency)

    # Debug settings
    'debug_vdom': False,  # Enable detailed VDOM patch logging (for troubleshooting)

    # Serialization (issue #292)
    'strict_serialization': False,  # Raise TypeError for non-serializable state values (recommended in development)

    # CSS Framework
    'css_framework': 'bootstrap5',  # Options: 'bootstrap5', 'tailwind', None
}

Common Configuration Options:

Option Default Description
use_websocket True Use WebSocket transport (requires Django Channels)
debug_vdom False Enable detailed VDOM debugging logs
strict_serialization False Raise TypeError for non-serializable state (recommended in dev)
css_framework 'bootstrap5' CSS framework for components

CSS Framework Setup:

For Tailwind CSS (recommended), use the one-command setup:

python manage.py djust_setup_css tailwind

This auto-detects template directories, creates config files, and builds your CSS. For production:

python manage.py djust_setup_css tailwind --minify

See the CSS Framework Guide for detailed setup instructions, Bootstrap configuration, and CI/CD integration.

Debug Mode:

When troubleshooting VDOM issues, enable debug logging:

# In settings.py
LIVEVIEW_CONFIG = {
    'debug_vdom': True,
}

# Or programmatically
from djust.config import config
config.set('debug_vdom', True)

This will log:

  • Server-side: Patch generation details (stderr)
  • Client-side: Patch application and DOM traversal (browser console)

State Management

djust provides Python-only state management decorators that eliminate the need for manual JavaScript.

🚀 Quick Start (5 minutes)

Build a debounced search in 8 lines of Python (no JavaScript):

from djust import LiveView
from djust.decorators import debounce

class ProductSearchView(LiveView):
    template_string = """
    <input dj-input="search" placeholder="Search products..." />
    <div>{% for p in results %}<div>{{ p.name }}</div>{% endfor %}</div>
    """

    def mount(self, request):
        self.results = []

    @debounce(wait=0.5)  # Wait 500ms after typing stops
    def search(self, query: str = "", **kwargs):
        self.results = Product.objects.filter(name__icontains=query)[:10]

That's it! Server only queries after you stop typing. Add @optimistic for instant UI updates, @cache(ttl=300) to cache responses for 5 minutes.

👉 Full Quick Start Guide (5 min)


Key Features

  • Zero JavaScript Required - Common patterns work without writing any JS
  • 87% Code Reduction - Decorators replace hundreds of lines of manual JavaScript
  • Lightweight Bundle - ~53 KB gzipped minified client.js, no npm dependencies
  • Competitive DX - Matches Phoenix LiveView and Laravel Livewire developer experience

Available Decorators

Decorator Use When Example
@debounce(wait) User is typing Search, autosave
@throttle(interval) Rapid events Scroll, resize
@optimistic Instant feedback Counter, toggle
@cache(ttl, key_params) Repeated queries Autocomplete
@client_state(keys) Multi-component Dashboard filters
@background Long operations AI generation, file processing
DraftModeMixin Auto-save forms Contact form

Quick Decision Matrix:

  • Typing in input? → @debounce(0.5)
  • Scrolling/resizing? → @throttle(0.1)
  • Need instant UI update? → @optimistic
  • Same query multiple times? → @cache(ttl)
  • Multiple components? → @client_state([keys])
  • Long-running work? → @background or self.start_async(callback)
  • Auto-save forms? → DraftModeMixin

Learn More

🧭 Navigation Patterns

djust provides three navigation mechanisms for building multi-view applications without full page reloads:

When to Use What

Scenario Use Why
Filter/sort/paginate within same view dj-patch / live_patch() No remount, URL stays bookmarkable
Navigate to a different LiveView dj-navigate / live_redirect() Same WebSocket, no page reload
Link to non-LiveView page Standard <a href> Full page load needed

Quick Decision Tree

Use this flowchart when choosing a navigation method:

Is this a direct user click on a link?
├─ Yes → Is it the same view (filter/sort)?
│   ├─ Yes → Use dj-patch
│   └─ No → Use dj-navigate
│
└─ No → Is navigation conditional on server logic?
    ├─ Yes → Use live_redirect() in @event_handler
    │   Examples: form validation, auth checks, async operations
    └─ No → You probably need dj-navigate (see anti-pattern below)

⚠️ Anti-Pattern: Don't Use dj-click for Navigation

This is the most common mistake when building multi-view djust apps. Using dj-click to trigger a handler that immediately calls live_redirect() creates an unnecessary round-trip.

❌ Wrong — using dj-click to trigger a handler that calls live_redirect():

# Anti-pattern: Handler does nothing but navigate
@event_handler()
def go_to_item(self, item_id, **kwargs):
    self.live_redirect(f"/items/{item_id}/")  # Wasteful round-trip!
<!-- Wrong: Forces WebSocket round-trip just to navigate -->
<button dj-click="go_to_item" dj-value-item_id="{{ item.id }}">View</button>

What actually happens:

  1. User clicks button → Client sends WebSocket message (50-100ms)
  2. Server receives message, processes handler (10-50ms)
  3. Server responds with live_redirect command (50-100ms)
  4. Client finally navigates to new view Total: 110-250ms + handler processing time

✅ Right — using dj-navigate directly:

<!-- Right: Client navigates immediately, no server round-trip -->
<a dj-navigate="/items/{{ item.id }}/">View Item</a>

What happens:

  1. User clicks link → Client navigates directly Total: ~10ms (just DOM updates)

Why it matters:

  • Performance: 10-20x faster navigation
  • Network efficiency: Saves WebSocket bandwidth
  • User experience: Instant response, no loading indicators needed
  • Simplicity: Less code, fewer moving parts

When to Use live_redirect() in Handlers

Use handlers for navigation only when navigation depends on server-side logic or validation:

✅ Conditional navigation after form validation:

@event_handler()
def submit_form(self, **kwargs):
    if self.form.is_valid():
        self.form.save()
        self.live_redirect("/success/")  # OK: Conditional on validation
    else:
        # Stay on form to show errors
        pass

✅ Navigation based on auth/permissions:

@event_handler()
def view_sensitive_data(self, **kwargs):
    if not self.request.user.has_perm('app.view_sensitive'):
        self.live_redirect("/access-denied/")  # OK: Auth check required
        return
    self.show_sensitive = True

✅ Navigation after async operations:

@event_handler()
async def create_and_view_item(self, name, **kwargs):
    item = await Item.objects.acreate(name=name, owner=self.request.user)
    self.live_redirect(f"/items/{item.id}/")  # OK: Navigate to newly created item

✅ Multi-step wizard logic:

@event_handler()
def next_step(self, **kwargs):
    if self.current_step == "payment" and not self.payment_valid:
        # Stay on payment step if invalid
        return
    self.current_step = self.get_next_step()
    self.live_patch(params={"step": self.current_step})  # OK: Conditional flow

Common theme: The handler does meaningful work before navigating. If your handler only calls live_redirect(), use dj-navigate instead.

Quick Example: Multi-View App

from djust import LiveView
from djust.mixins.navigation import NavigationMixin
from djust.decorators import event_handler

class ProductListView(NavigationMixin, LiveView):
    template_string = """
    <!-- Filter within same view: use dj-patch -->
    <a dj-patch="?category=electronics">Electronics</a>
    <a dj-patch="?category=books">Books</a>

    <div>
        {% for product in products %}
            <!-- Navigate to different view: use dj-navigate -->
            <a dj-navigate="/products/{{ product.id }}/">{{ product.name }}</a>
        {% endfor %}
    </div>
    """

    def mount(self, request, **kwargs):
        self.category = "all"
        self.products = []

    def handle_params(self, params, uri):
        """Called when URL changes via dj-patch or browser back/forward"""
        self.category = params.get("category", "all")
        self.products = Product.objects.filter(category=self.category)

Learn More:

  • 📖 Navigation Guide - Complete API reference (live_patch(), live_redirect(), handle_params())

Developer Tooling

Debug Panel

Interactive debugging tool for LiveView development (DEBUG mode only):

# In settings.py
DEBUG = True  # Debug panel automatically enabled

Open: Press Ctrl+Shift+D (Windows/Linux) or Cmd+Shift+D (Mac), or click the 🐞 floating button

Features:

  • 🔍 Event Handlers - Discover all handlers with parameters, types, and descriptions
  • 📊 Event History - Real-time log with timing metrics (e.g., search • 45.2ms)
  • VDOM Patches - Monitor DOM updates with sub-millisecond precision
  • 🔬 Variables - Inspect current view state

Learn More:

Event Handlers

Always use @event_handler decorator for auto-discovery and validation:

from djust.decorators import event_handler

@event_handler()
def search(self, value: str = "", **kwargs):
    """Search handler - description shown in debug panel"""
    self.search_query = value

Parameter Convention: Use value for form inputs (dj-input, dj-change events):

# ✅ Correct - matches what form events send
@event_handler()
def search(self, value: str = "", **kwargs):
    self.search_query = value

# ❌ Wrong - won't receive input value
@event_handler()
def search(self, query: str = "", **kwargs):
    self.search_query = query  # Always "" (default)

🏗️ Architecture

┌─────────────────────────────────────────────┐
│  Browser                                    │
│  ├── Client.js (~53 KB gz) - Events & DOM  │
│  └── WebSocket Connection                   │
└─────────────────────────────────────────────┘
           ↕️ WebSocket (Binary/JSON)
┌─────────────────────────────────────────────┐
│  Django + Channels (Python)                 │
│  ├── LiveView Classes                       │
│  ├── Event Handlers                         │
│  └── State Management                       │
└─────────────────────────────────────────────┘
           ↕️ Python/Rust FFI (PyO3)
┌─────────────────────────────────────────────┐
│  Rust Core (Native Speed)                   │
│  ├── Template Engine (<1ms)                │
│  ├── Virtual DOM Diffing (<100μs)          │
│  ├── HTML Parser                            │
│  └── Binary Serialization (MessagePack)    │
└─────────────────────────────────────────────┘

🎨 Examples

See the examples/demo_project directory for complete working examples:

  • Counter - Simple reactive counter
  • Todo List - CRUD operations with lists
  • Chat - Real-time messaging

Run the demo:

cd examples/demo_project
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver

Visit http://localhost:8000

🔧 Development

Project Structure

djust/
├── crates/
│   ├── djust_core/        # Core types & utilities
│   ├── djust_templates/   # Template engine
│   ├── djust_vdom/        # Virtual DOM & diffing
│   ├── djust_components/  # Reusable component library
│   └── djust_live/        # Main PyO3 bindings
├── python/
│   └── djust/             # Python package
│       ├── live_view.py         # LiveView base class
│       ├── component.py         # Component system
│       ├── websocket.py         # WebSocket consumer
│       └── static/
│           └── client.js        # Client runtime
├── branding/                    # Logo and brand assets
├── examples/                    # Example projects
├── benchmarks/                  # Performance benchmarks
└── tests/                       # Tests

Running Tests

# All tests (Python + Rust + JavaScript)
make test

# Individual test suites
make test-python       # Python tests
make test-rust         # Rust tests
make test-js           # JavaScript tests

# Specific tests
pytest tests/unit/test_live_view.py
cargo test --workspace --exclude djust_live

For comprehensive testing documentation, see Testing Guide.

Building Documentation

cargo doc --open

💰 Supporting djust

djust is open source (MIT licensed) and free forever. If you're using djust in production or want to support development:

  • Star this repo - Help others discover djust
  • 💜 GitHub Sponsors - Monthly support from $5/month

Your support helps us maintain and improve djust for everyone!

🤝 Contributing

Contributions welcome! Please read CONTRIBUTING.md first.

Areas we'd love help with:

  • More example applications
  • Performance optimizations
  • Documentation improvements
  • Browser compatibility testing

📝 Roadmap

  • Template inheritance ({% extends %})
  • {% url %} and {% include %} tags
  • Comparison operators in {% if %} tags
  • All 57 Django built-in template filters
  • Security hardening (WebSocket origin validation, HMAC signing, rate limiting)
  • Developer debug panel with event history and VDOM inspection
  • Reusable component library (djust_components crate)
  • JIT pipeline improvements and stale-closure fixes
  • Authentication & authorization (view-level + handler-level)
  • File upload handling
  • Server-sent events (SSE) fallback
  • React/Vue component compatibility
  • TypeScript definitions (djust.d.ts shipped with the package)
  • Redis-backed session storage
  • Horizontal scaling support

🔒 Security

  • CSRF protection via Django middleware
  • XSS protection via automatic template escaping (Rust engine escapes all variables by default)
  • HTML-producing filters (urlize, urlizetrunc, unordered_list) handle their own escaping internally — the Rust engine's safe_output_filters whitelist prevents double-escaping, so |safe is never needed with these filters
  • WebSocket authentication via Django sessions
  • WebSocket origin validation and HMAC message signing (v0.2.1)
  • Per-view and global rate limiting support
  • Configurable allowed origins for WebSocket connections
  • View-level auth enforcement (login_required, permission_required) before mount()
  • Handler-level @permission_required for protecting individual event handlers
  • djust_audit command and djust.S005 system check for auth posture visibility

Report security issues to: security@djust.org

📄 License

MIT License - see LICENSE file for details.

🙏 Acknowledgments

  • Inspired by Phoenix LiveView
  • Built with PyO3 for Python/Rust interop
  • Uses html5ever for HTML parsing
  • Powered by the amazing Rust and Django communities

💬 Community & Support


djust.org — Made with ❤️ by the djust community

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

djust-1.0.0rc2.tar.gz (4.9 MB view details)

Uploaded Source

Built Distributions

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

djust-1.0.0rc2-cp314-cp314-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.14Windows x86-64

djust-1.0.0rc2-cp314-cp314-manylinux_2_34_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

djust-1.0.0rc2-cp314-cp314-macosx_11_0_arm64.whl (7.2 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

djust-1.0.0rc2-cp314-cp314-macosx_10_12_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

djust-1.0.0rc2-cp313-cp313-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.13Windows x86-64

djust-1.0.0rc2-cp313-cp313-manylinux_2_34_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

djust-1.0.0rc2-cp313-cp313-macosx_11_0_arm64.whl (7.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

djust-1.0.0rc2-cp313-cp313-macosx_10_12_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

djust-1.0.0rc2-cp312-cp312-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.12Windows x86-64

djust-1.0.0rc2-cp312-cp312-manylinux_2_34_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

djust-1.0.0rc2-cp312-cp312-macosx_11_0_arm64.whl (7.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

djust-1.0.0rc2-cp312-cp312-macosx_10_12_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

djust-1.0.0rc2-cp311-cp311-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.11Windows x86-64

djust-1.0.0rc2-cp311-cp311-manylinux_2_34_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

djust-1.0.0rc2-cp311-cp311-macosx_11_0_arm64.whl (7.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

djust-1.0.0rc2-cp311-cp311-macosx_10_12_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

djust-1.0.0rc2-cp310-cp310-manylinux_2_34_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

Details for the file djust-1.0.0rc2.tar.gz.

File metadata

  • Download URL: djust-1.0.0rc2.tar.gz
  • Upload date:
  • Size: 4.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for djust-1.0.0rc2.tar.gz
Algorithm Hash digest
SHA256 4c04759969b18c979db3ae5f9b0381300a4dbd456705ba40a99af2ca7c16665a
MD5 124e56ec557cfa8d2751df1915811045
BLAKE2b-256 81186a4eb4561c9f83acb06d9fc157c8242fbf2990b8f966b685de4d6e277e5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2.tar.gz:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: djust-1.0.0rc2-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 7.5 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for djust-1.0.0rc2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 74f3a93ca3a8d117a50089df95b8cf94c68a8a7ab6c175a05ef6321247199fa6
MD5 3f0bf5d52fad29436da6099f84b1774a
BLAKE2b-256 b1fa477e53e66d53021c160372378c9a7627e0827b78ea367f59a7baf22a571e

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp314-cp314-win_amd64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8abb5a674b38d7db1f3401654aedb78b49c66752e7b8c07caa9598dd35c97496
MD5 a4d7fdeb862b7ece9f4743ed7cc9f8d3
BLAKE2b-256 a1facf417ffa3cac23164b20ba0f2ce5f3d0ee7cfb8e803926f04ef847455d64

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp314-cp314-manylinux_2_34_x86_64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b7606ba238186d3105128020f7bc11221432602bc33a5ed106026eab0d3a0dc
MD5 14c09f33deba78939c349130a4959070
BLAKE2b-256 cd8218447ec0badcaf46ae1b13cef7b8e024c8b678a793c72d3448c739c7ff04

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2d01de45da226bf5484f162a5182210f485fc4df89dcd6cdedb8dac07f34dcfa
MD5 7b58c51d29c365a58d9aa713b00267fb
BLAKE2b-256 040fcdaf241e99e8ec9c9908435adbb2e17d8b18a38aed9b01e087d8d976f8e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp314-cp314-macosx_10_12_x86_64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: djust-1.0.0rc2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 7.5 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for djust-1.0.0rc2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 305debd4a576098e96d47685d961291939b119296ba5fd349b33a08ae464be20
MD5 889b10b7be68c3440d480d43c6ef21b8
BLAKE2b-256 26a3ecf07db4d585fbb01064264c870815dcb1665232a17df43ce12b85617086

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp313-cp313-win_amd64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 661eaeb94eae253dd628522e29df485f4a04447d3c095d15e5b67c5fb40501c5
MD5 7a81bedf2e4bc5c8d7bf12450b2dea7d
BLAKE2b-256 ac68641742cb6e39fd645b0275ad505f6ec301b7596e5f027ed57ab4e0f56895

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e5f528d73b6dd6378ab36c332863baca3560cff4ae64d638c9c70e9a4b77108b
MD5 c5821a6bf286f099fe0954dd3697e206
BLAKE2b-256 79e67abccb0a4bd1cff6b55f31d91a57a5d01b21f229900e0d8160f6df55ba4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 06f8186cee2785982cc3213880f8ce300192b02c9998282a4f71fc19043e5cc6
MD5 0543e7ad588ede249be883453c6b2ffe
BLAKE2b-256 bbc393a07544d27c5193e9f6c1b71a06c2ad37505f2e9e58cbe4dcf5ed5945a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: djust-1.0.0rc2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 7.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for djust-1.0.0rc2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2a92223850430f1417617f7113494ae5dd5289cc0524b7a69ebb80d270b28da0
MD5 7db86b1e7ba443b0e56e5f9a1f304a10
BLAKE2b-256 c88cef63bdabbf22f556171a1a97a7c07608f4a43d89c863d5734e4148f6c89c

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp312-cp312-win_amd64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 afa0f15a47072b5a4f1c4274afbb7bed3cfd1cd0e821779971c00ca25e3d2d0d
MD5 40fe4abb8d11cb31b85e69b375f2a364
BLAKE2b-256 221d49d7e05a668c5fb622f0c2a351037d1b9607a300bba327b8e2245d577381

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5fba4681bd7f8b6705480b39eb04577cf45b7cc396b1391129f06b05c1968b59
MD5 7d7e86f2d261d7b5e74455fe4be06e01
BLAKE2b-256 d810067c29d86c53efae54ffbe7ac961eca1fff49e857b508add8dea4c7ad1be

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2ab04a90af5e23a43b52e682497de9e70db35130ad5bd1e5e0a7026bfef2a427
MD5 f6234a29a74196648776b05d35fb67a3
BLAKE2b-256 e06e661eff80cbe0b5b76799cc860e3b1c80ab5302f96c76571aba807a625f0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: djust-1.0.0rc2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 7.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for djust-1.0.0rc2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 284f264f424285f1109ac1c3c7234bc9c1636f7ac24076cd7a7024d1b29d0df5
MD5 fd6daaab2dfc6e2acb295d61f1c297ea
BLAKE2b-256 b6e61306d75491f84e7c45b45ab4c6f8d7bdae825bf89f05926c37b7805b8871

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp311-cp311-win_amd64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 24cfc4ef52e40723dfae090efb491f74df6601a7b8f6d24f1a98e342273d469e
MD5 e18ee1a5f0a3714206f2bb8704612e35
BLAKE2b-256 376a639a16016a0b3615135ff8e4a9c7013ac7f2b21c4c6ca6c4e3971ff72d68

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f566d24d868a9590b51cccdc5c8a50f06b0226971d59a2a6c106e4e30fd1a40
MD5 e650f6e1351114fa4eb34bad0a795ed8
BLAKE2b-256 da6e39ae7832c7afb8897945922ce49df21d7b54422eb1cc9f6306b374da6685

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 50ed7e11e5bc8e41b9e4c3fa76abbb9fb33763ee18bee9905ae8d3453ac4cacd
MD5 f834ab5437cd61b8f719f58b5b2057f4
BLAKE2b-256 558d749a186a6302c184332cb2e6fae3bef87a7356447e812398bf429ca1dc5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djust-1.0.0rc2-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for djust-1.0.0rc2-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 91527972dfc29fbab678e57d41cb727a8fbf5e65ce6fba40c91b0dbc2745d57e
MD5 4ef08c7876e54ddeb6355a00121dcbec
BLAKE2b-256 50c6e7e2c73fb217bd02bd0661c11a8990a14ac17461eabff5e361c535162579

See more details on using hashes here.

Provenance

The following attestation bundles were made for djust-1.0.0rc2-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: release.yml on djust-org/djust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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