An open API service indexing awesome lists of open source software.

https://github.com/hotframe/hotframe

Modular Python web framework with hot-mount dynamic modules and stateful WebSocket-driven LiveComponents.
https://github.com/hotframe/hotframe

fastapi jinja2 live-component plugin-system python server-rendered sqlalchemy web-framework websocket

Last synced: about 1 month ago
JSON representation

Modular Python web framework with hot-mount dynamic modules and stateful WebSocket-driven LiveComponents.

Awesome Lists containing this project

README

          


hotframe


Modular Python web framework with hot-mount dynamic modules and stateful, WebSocket-driven LiveComponents.


Python 3.12+
License
PyPI


hotframe.dev

---

## What hotframe is

hotframe is a Python web framework that combines FastAPI, SQLAlchemy 2.0, and Jinja2 under Django-like ergonomics. It adds two pieces:

- **A hot-mount module engine** — install, activate, deactivate, and uninstall plugins at runtime without restarting the process.
- **`LiveComponent`** — stateful, server-rendered components driven by a single WebSocket per page. Server holds the state; the client streams events and applies HTML patches with `morphdom`. No client-side framework, no build step.

## Install

```bash
pip install hotframe
```

## Quickstart

```bash
hf startproject myapp
cd myapp
hf runserver
```

```
INFO hotframe.bootstrap Application started in 142ms
INFO uvicorn.error Uvicorn running on http://127.0.0.1:8000
```

## A LiveComponent in 30 seconds

```python
# modules/todo/components/todo_list/component.py
from hotframe.live import LiveComponent, event
from modules.todo.models import Todo

class TodoList(LiveComponent):
user_id: int # prop
items: list = [] # state
new_text: str = ""

async def on_mount(self) -> None:
self.items = await Todo.where(user_id=self.user_id).all()

@event("toggle")
async def toggle(self, todo_id: str) -> None:
t = next(t for t in self.items if str(t.id) == todo_id)
t.done = not t.done
await t.save()

@event("add")
async def add(self) -> None:
if not self.new_text.strip():
return
await Todo.create(user_id=self.user_id, text=self.new_text)
self.items = await Todo.where(user_id=self.user_id).all()
self.new_text = ""
```

```jinja
{# modules/todo/components/todo_list/template.html #}


    {% for todo in items %}


  • {{ todo.text }}

  • {% endfor %}


Add

```

```jinja
{# any page template #}
{% extends "shared/base.html" %}
{% block body %}
{% live "todo_list" user_id=user.id %}
{% endblock %}
```

That's it. Click the checkbox — the server toggles the todo, sends an HTML patch back, the DOM updates without a page reload, and the dev wrote zero JavaScript.

## Documentation

Full docs, guides and live examples at **[hotframe.dev](https://hotframe.dev)**.

## License

Apache License 2.0 — see [LICENSE](LICENSE).