+0
日增长
8,923
stars
340
forks
68
watchers
158
prs
230
issues
9
releases
README
NOTE: this project is inactive, see 368
FastUI
Find the documentation here.
Join the discussion in the fastui slack channel here
Please note: FastUI is still an active work in progress, do not expect it to be complete.
The Principle (short version)
You can see a simple demo of an application built with FastUI here.
FastUI is a new way to build web application user interfaces defined by declarative Python code.
This means:
- If you're a Python developer — you can build responsive web applications using React without writing a single line of JavaScript, or touching npm.
- If you're a frontend developer — you can concentrate on building magical components that are truly reusable, no copy-pasting components for each view.
- For everyone — a true separation of concerns, the backend defines the entire application; while the frontend is free to implement just the user interface
At its heart, FastUI is a set of matching Pydantic models and TypeScript interfaces that allow you to define a user interface. This interface is validated at build time by TypeScript and pyright/mypy and at runtime by Pydantic.
The Practice — Usage
FastUI is made up of 4 things:
- fastui PyPI package — Pydantic models for UI components, and some utilities. While it works well with FastAPI it doesn't depend on FastAPI, and most of it could be used with any python web framework.
- @pydantic/fastui npm package — a React TypeScript package that lets you reuse the machinery and types of FastUI while implementing your own components
- @pydantic/fastui-bootstrap npm package — implementation/customisation of all FastUI components using Bootstrap
- @pydantic/fastui-prebuilt npm package (available on jsdelivr.com CDN) providing a pre-built version of the FastUI React app so you can use it without installing any npm packages or building anything yourself. The Python package provides a simple HTML page to serve this app.
Here's a simple but complete FastAPI application that uses FastUI to show some user profiles:
python
from datetime import date
from fastapi import FastAPI, HTTPException
from fastapi.responses import HTMLResponse
from fastui import FastUI, AnyComponent, prebuilt_html, components as c
from fastui.components.display import DisplayMode, DisplayLookup
from fastui.events import GoToEvent, BackEvent
from pydantic import BaseModel, Field
app = FastAPI()
class User(BaseModel):
id: int
name: str
dob: date = Field(title='Date of Birth')
define some users
users = [
User(id=1, name='John', dob=date(1990, 1, 1)),
User(id=2, name='Jack', dob=date(1991, 1, 1)),
User(id=3, name='Jill', dob=date(1992, 1, 1)),
User(id=4, name='Jane', dob=date(1993, 1, 1)),
]
@app.get("/api/", response_model=FastUI, response_model_exclude_none=True)
def users_table() - list[AnyComponent]:
"""
Show a table of four users, /api is the endpoint the frontend will connect to
when a user visits / to fetch components to render.
"""
return [Top issues
#294How to create custom components12 comments · 2024-04-30#75Chart component10 comments · 2023-12-05#129demo code /docs Fetch error Internal Server Error /openapi.json9 comments · 2023-12-27#286RawHtml Component for Arbitrary HTML Content8 comments · 2024-04-26#368State of the project — inactive7 comments · 2024-11-21#80DataTablesJS Component7 comments · 2023-12-08#309Provide documentation on how to use FastUI with local copies of js/css files6 comments · 2024-05-06#307It works only with internet6 comments · 2024-05-06
Latest release
v0.9.0 2025-10-28 v0.9.0 2025-10-28What's Changed Add support for Python 3.14, drop 3.9, update dependencies by @Viicos in https://github.com/pydantic/FastUI/pull/383 Full Changelog: https://github.com/pydantic/FastUI/compare/v0.8.0...v0.9.0