Skip to content

Core Architecture

Lariv Backend is a modern, modular web application built on Django 6.0, Python 3.13, and ASGI.

The Philosophy

The core philosophy of the project revolves around extreme decoupling, real-time interactivity, and Python-first UI development:

  1. Python-Based UI over Templates: Traditional Django templates are eschewed in favor of a custom, class-based UI Component Framework. UI elements are instantiated dynamically in pure Python, returning HTML imbued with HTMX and Alpine.js behaviors for Single Page Application (SPA)-like responsiveness.
  2. Surgical Monkey Patching: Upstream code should never be touched to satisfy downstream requirements. The platform makes extensive use of dynamic Python features (like add_to_class and dynamic dispatching) to inject fields and behaviors across disconnected applications and plugins. You should use the base registries to inject your views and forms.
  3. Plugin Architecture: Domain logic is structured into self-contained plugins. The core platform merely acts as a chassis for these plugins, discovering them at runtime and wiring up their UI, APIs, and data generators via Registries.

Application Structure

  • lariv/: The core application chassis, containing project-wide settings, base mixins, utility functions, and central registries (lariv.registry).
  • components/: The standard library of UI elements (Base Component, Forms, Tables, Inputs).
  • plugins/: Autonomous business domains. Each plugin defines its own models.py, views.py, ui.py (component definitions), and generator.py (data seeding).
  • services/: External boundaries for heavy, asynchronous workloads, strictly separated from the main Python thread block (e.g. Go microservices handling AI inference).

ASGI and Real-Time

By utilizing Django Channels on top of Daphne, Lariv can seamlessly handle WebSockets. This pairs perfectly with HTMX for real-time DOM hydration directly from the server without intermediate JavaScript state management.