Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
The fastest way to create an HTML app

A quick and easy way to generate markup for mailto links without having to worry about the annoying formatting.
FastHTML is a Python web framework for building interactive server-rendered web applications where Python functions return HTML partials, using HTMX to update the page without writing JavaScript.
FastHTML is a next-generation Python web framework developed by AnswerDotAI, designed to map its functionality 1:1 to HTML and HTTP while using Python code as the only input. It produces live web applications in a local browser when you run a short script, with a minimal app consisting of an import, a decorated route function, and a serve() call. The framework relies on fastcore.xml.FT for HTML generation, and on HTMX to handle interactive element swapping in the browser, so you never need to write JavaScript for common interactions. Because apps are plain Python, you can leverage the full Python ecosystem alongside the framework.
from fasthtml.common import *, a fast_app() call, and a route decorated with @rt('/') returning Div(P('Hello World!')), then served with serve().hx_get="/change" attribute makes the server respond with an HTML partial that replaces the original element in the page, giving dynamic behavior without custom JavaScript.Div(...), P(...), and the framework's functionality maps directly to HTML and HTTP.llms-ctx.txt auto-generated file is provided so AI assistants can learn FastHTML; the page gives its URL for use in Claude Projects and Cursor.adv_app.py, a heavily commented example covering custom authentication, JS library connections, and database use.hx_get on the original to replace it in place, without full page reloads.adv_app.py to see how to integrate custom authentication, JS libraries, and a database into one FastHTML app.Create a file named main.py and run it with python main.py; the framework prints a URL (defaulting to http://localhost:5001) to visit in the browser. Adding a second route that returns an HTML partial and attaching an HTMX attribute like hx_get to an existing element causes that partial to replace the element on click. The framework then serves HTML partials from Python functions, encapsulating the HTTP request–response cycle behind function calls.
Install the Python library with pip install python-fasthtml. After installation, create a Python file with the minimal app code and run it with python main.py.
FastHTML is newer than most LLMs, so assistants like ChatGPT, Claude, and Copilot don't have reliable knowledge of it. The project provides /llms-ctx.txt which you can load into your AI tool to give it accurate FastHTML syntax and patterns.
hx_get do?It's an HTMX attribute that makes an element fetch a URL and insert the response into the page. In the example, Div(P('Hello World!'), hx_get="/change") causes the P element to be replaced by the response from the /change route when clicked.
Start with the official documentation at fastht.ml/docs, the heavily commented adv_app.py in the GitHub repo, and the FastHTML Gallery at gallery.fastht.ml for minimal component examples.
The project notes that not all features and patterns are documented yet, so you may need to study source code notebooks and examples in the repo to learn the full capabilities.
