μ∗ - python micro framework based around data-star, inspired by PocketBase
- Python 100%
- Introduce @tool decorator and McpContext for registering MCP tools with optional Pydantic args - Add FastMCP server integration with SSE mount at /mcp, lifecycle management - Rename Context → HttpContext, extract BaseContext for shared DB access - Replace file-glob discovery with package-based import (import_user_package) - Move render logic from html.py to lib/render.py - Rename test dummy routes.py → __init__.py to match package import model - Strip basecoat defaults from Config, add static file serving in dev - Generate __init__.py in `ms init` scaffolding - Hot reload now watches for file creation and moves, not just modifications |
||
|---|---|---|
| bin | ||
| src/microstar | ||
| tests | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| LICENSE | ||
| mise.toml | ||
| pyproject.toml | ||
| README.md | ||
μ∗
A Python web framework for building real-time, progressively enhanced web applications. HTML-in-Python with zero-config database and automatic real-time updates.
Philosophy
- HTML-first: Build UIs with pure Python using htpy
- Real-time by default: SSE streaming via datastar
- Backend-in-a-box: Built-in SQLite with JSON storage
- Decorator-driven: Routes, hooks, jobs, cron — all via decorators
Install
pip install microstar
Quick Start
# routes.py
from microstar import page, action, Context
from microstar.html import div, h1, button, data, actions
@page("/")
async def home(ctx: Context):
ctx.title = "My App"
return div()[
h1()["Hello μ∗"],
button(data.on("click", actions.post("/clicked")))["Click me"],
div(id="output")
]
@action("/clicked", methods=["POST"])
async def clicked(ctx: Context):
ctx.inner("#output")
yield div()["Clicked!"]
microstar # starts server on :6262
Features
- Pages & Actions — Declarative routes with streaming SSE responses
- Database —
ctx.db.insert(),query(),update(),delete()with JSON storage - Hooks —
@before,@after,@onfor intercepting DB operations - Variants — Render records in different formats, auto-broadcast on changes
- Jobs —
@job+run_job()for background task queue - Cron —
@cron("*/5 * * * *")for scheduled tasks - Commands —
@commandfor custom CLI commands - Console —
microstar consolefor interactive REPL with DB access