Home Features Security Examples Quick Start
Technical Deep Dive

Under the Hood

Explore the architecture that makes djust the fastest Python LiveView framework.

01. Rust VDOM Engine

Traditional Django templates re-render the entire string for every request. djust compiles templates into a Virtual DOM tree in Rust.

  • Sub-millisecond Patching Diffing happens in ~0.8ms, compared to 25ms+ for Django template rendering.
  • Smart Diffing We track variable dependencies. If you only change {{ count }}, we only check that node.

Rendering Performance (100 items)

Django Template 25.0ms
Jinja2 12.0ms
djust (Rust) 0.8ms
* Benchmarks on Apple M1 Pro. Includes parsing, diffing, and patch generation.
templates/dashboard.html
{% extends "base.html" %}

{% block title %}Dashboard{% endblock %}

{% block content %}
  <div class="stats">
    <h1>Welcome, {{ user.name }}</h1>

    <!-- This updates independently -->
    <div>Active Users: {{ active_count }}</div>

    <!-- Loop updates are optimized -->
    {% for item in items %}
      <div>{{ item.name }}</div>
    {% endfor %}
  </div>
{% endblock %}

02. Unified Templates

Don't learn a new syntax. djust supports standard Django template inheritance.

The entire page—base template, child template, and included components—is compiled into a single VDOM tree. This means you can update a variable in the navbar (defined in `base.html`) from a view rendering `child.html`.

How it works:

  1. Parser resolves {% extends %} and merges blocks.
  2. Merged template is compiled to Rust VDOM.
  3. State changes trigger a diff of the entire tree.
  4. Patches are sent for any changed node, anywhere in the tree.

03. ORM JIT Compiler

The #1 performance killer in Django apps is the N+1 query problem. djust solves it automatically.

Our compiler analyzes your templates to see exactly which fields you use (e.g., {{ book.author.name }}). It then automatically injects the optimal select_related and prefetch_related calls into your QuerySet.

  • Zero N+1 Queries Forgot select_related? No problem. We fix it for you.
  • Zero Data Leaks If a field isn't in the HTML, it's never fetched from the DB.
Without djust
With djust ORM JIT
Template:
{% for book in books %}
  {{ book.author.name }}
{% endfor %}
SQL Queries:
SELECT * FROM books
SELECT * FROM authors WHERE id=1
SELECT * FROM authors WHERE id=2
SELECT * FROM authors WHERE id=3
... (100 more)
Template:
{% for book in books %}
  {{ book.author.name }}
{% endfor %}
SQL Queries:
SELECT * FROM books
JOIN authors ON ...
// 1 Query Total

04. Python-First State Management

Complex UI patterns usually require JavaScript. djust provides Python decorators that handle them for you.

@debounce(wait=0.5)

Search & Autocomplete

Automatically delays the server request until the user stops typing. No more flooding your database with partial queries.

@debounce(0.5)
def search(self, query):
  self.results = DB.search(query)
@optimistic

Instant Feedback

Updates the UI immediately in the browser, then validates on the server. If the server rejects it, the UI rolls back automatically.

@optimistic
def toggle_like(self):
  self.liked = not self.liked
@client_state

Component Sync

Synchronize state between multiple components purely on the client-side, without a server roundtrip.

@client_state(['tab'])
def set_tab(self, tab):
  self.tab = tab