MCPcopy Index your code
hub / github.com/banditburai/starHTML

github.com/banditburai/starHTML @v0.7.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.7.0 ↗ · + Follow
4,181 symbols 15,567 edges 168 files 1,962 documented · 47%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

StarHTML — Python Web Framework

StarUI — Python Component Library

PyPI Version License

A Python-first hypermedia framework, forked from FastHTML. Uses Datastar instead of HTMX for the same hypermedia-driven approach with a different flavor.

Documentation · UI Components · Quick Start · Community · Issues

Key Features

  • Python-First — Write reactive UIs using Python syntax with type safety and IDE support
  • Reactive Signals — Hypermedia approach with data-attribute-powered client-side reactivity where needed
  • Server-Sent Events — Built-in SSE support for real-time server interactions
  • Framework Agnostic — Works with any CSS framework (Tailwind, DaisyUI)
  • JavaScript Escape Hatch — Drop into raw JavaScript when needed for complex interactions

Quick Start

pip install starhtml
from starhtml import *

app, rt = star_app()

@rt('/')
def home():
    return Div(
        H1("StarHTML Demo"),

        # Define reactive state with signals
        Div(
            (counter := Signal("counter", 0)),  # Python-first signal definition

            # Reactive UI that updates automatically
            P("Count: ", Span(data_text=counter)),
            Button("+", data_on_click=counter.add(1)),
            Button("Reset", data_on_click=counter.set(0)),

            # Conditional styling
            data_class_active=counter > 0
        ),

        # Server-side interactions
        Button("Load Data", data_on_click=get("/api/data")),
        Div(id="content")
    )

@rt('/api/data')
def api_data():
    return Div("Data loaded from server!", id="content")

serve()

Run with python app.py and visit http://localhost:5001.

What's Different?

FastHTML StarHTML
HTMX for server interactions Datastar for reactive UI
Built with nbdev notebooks Standard Python modules
Multiple JS extensions Single reactive framework
WebSockets for real-time SSE for real-time

Development

git clone https://github.com/banditburai/starhtml.git
cd starhtml
uv sync  # or pip install -e ".[dev]"
pytest && ruff check .

Contributions welcome — see CONTRIBUTING.md.

Acknowledgments

StarHTML is a fork of FastHTML. Built on Datastar for client-side reactivity.

Extension points exported contracts — how you extend this code

VirtualReference (Interface)
(no doc) [1 implementers]
typescript/plugins/position.ts
DatastarFetchDetail (Interface)
(no doc)
typescript/devtools/capture.ts
SplitConfig (Interface)
(no doc)
typescript/plugins/split.ts
DebugMeta (Interface)
(no doc)
typescript/devtools/capture.ts
SplitState (Interface)
(no doc)
typescript/plugins/split.ts
SerializedMorph (Interface)
(no doc)
typescript/devtools/capture.ts
CornerHandle (Interface)
(no doc)
typescript/plugins/split.ts
DebugSSEEvent (Interface)
(no doc)
typescript/devtools/capture.ts

Core symbols most depended-on inside this repo

P
called by 489
patches/datastar-upstream.js
set
called by 263
src/starhtml/datastar.py
append
called by 257
src/starhtml/datastar.py
star_app
called by 249
src/starhtml/starapp.py
Icon
called by 249
src/starhtml/icons.py
join
called by 165
src/starhtml/datastar.py
js
called by 147
src/starhtml/datastar.py
elements
called by 113
src/starhtml/realtime.py

Shape

Method 2,341
Function 1,218
Class 462
Route 99
Interface 61

Languages

Python86%
TypeScript14%

Modules by API surface

src/starhtml/datastar.py153 symbols
tests/unit/test_forms.py141 symbols
tests/unit/test_utils_comprehensive.py117 symbols
tests/unit/test_xtend_comprehensive.py115 symbols
patches/datastar-upstream.js115 symbols
tests/unit/test_icons.py92 symbols
tests/integration/test_auth.py91 symbols
tests/unit/test_datastar_kwargs_processing.py89 symbols
tests/unit/test_plugins.py84 symbols
tests/unit/test_tags_comprehensive.py77 symbols
tests/fixtures/mock_datastar.py77 symbols
tests/unit/test_datastar_new_api.py71 symbols

For agents

$ claude mcp add starHTML \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact