python-fasthtml 0.13.2


pip install python-fasthtml

  Latest version

Released: Mar 27, 2026


Meta
Author: Jeremy Howard and contributors
Requires Python: >=3.10

Classifiers

Natural Language
  • English

Intended Audience
  • Developers

Development Status
  • 3 - Alpha

Programming Language
  • Python :: 3
  • Python :: 3 :: Only

FastHTML

Welcome to the official FastHTML documentation.

FastHTML is a new next-generation web framework for fast, scalable web applications with minimal, compact code. It’s designed to be:

  • Powerful and expressive enough to build the most advanced, interactive web apps you can imagine.
  • Fast and lightweight, so you can write less code and get more done.
  • Easy to learn and use, with a simple, intuitive syntax that makes it easy to build complex apps quickly.

FastHTML apps are just Python code, so you can use FastHTML with the full power of the Python language and ecosystem. FastHTML’s functionality maps 1:1 directly to HTML and HTTP, but allows them to be encapsulated using good software engineering practices—so you’ll need to understand these foundations to use this library fully. To understand how and why this works, please read this first: fastht.ml/about.

Installation

Since fasthtml is a Python library, you can install it with:

pip install python-fasthtml

In the near future, we hope to add component libraries that can likewise be installed via pip.

Usage

For a minimal app, create a file “main.py” as follows:

main.py

from fasthtml.common import *

app,rt = fast_app()

@rt('/')
def get(): return Div(P('Hello World!'), hx_get="/change")

serve()

Running the app with python main.py prints out a link to your running app: http://localhost:5001. Visit that link in your browser and you should see a page with the text “Hello World!”. Congratulations, you’ve just created your first FastHTML app!

Adding interactivity is surprisingly easy, thanks to HTMX. Modify the file to add this function:

main.py

@rt('/change')
def get(): return P('Nice to be here!')

You now have a page with a clickable element that changes the text when clicked. When clicking on this link, the server will respond with an “HTML partial”—that is, just a snippet of HTML which will be inserted into the existing page. In this case, the returned element will replace the original P element (since that’s the default behavior of HTMX) with the new version returned by the second route.

This “hypermedia-based” approach to web development is a powerful way to build web applications.

Getting help from AI

Because FastHTML is newer than most LLMs, AI systems like Cursor, ChatGPT, Claude, and Copilot won’t give useful answers about it. To fix that problem, we’ve provided an LLM-friendly guide that teaches them how to use FastHTML. To use it, add this link for your AI helper to use:

This example is in a format based on recommendations from Anthropic for use with Claude Projects. This works so well that we’ve actually found that Claude can provide even better information than our own documentation! For instance, read through this annotated Claude chat for some great getting-started information, entirely generated from a project using the above text file as context.

If you use Cursor, type @doc then choose “Add new doc”, and use the /llms-ctx.txt link above. The context file is auto-generated from our llms.txt (our proposed standard for providing AI-friendly information)—you can generate alternative versions suitable for other models as needed.

Next Steps

Start with the official sources to learn more about FastHTML:

  • About: Learn about the core ideas behind FastHTML
  • Documentation: Learn from examples how to write FastHTML code
  • Idiomatic app: Heavily commented source code walking through a complete application, including custom authentication, JS library connections, and database use.

We also have a 1-hour intro video:

https://www.youtube.com/embed/Auqrm7WFc0I

The capabilities of FastHTML are vast and growing, and not all the features and patterns have been documented yet. Be prepared to invest time into studying and modifying source code, such as the main FastHTML repo’s notebooks and the official FastHTML examples repo:

Then explore the small but growing third-party ecosystem of FastHTML tutorials, notebooks, libraries, and components:

Finally, join the FastHTML community to ask questions, share your work, and learn from others:

Other languages and related projects

If you’re not a Python user, or are keen to try out a new language, we’ll list here other projects that have a similar approach to FastHTML. (Please reach out if you know of any other projects that you’d like to see added.)

  • htmgo (Go): “htmgo is a lightweight pure go way to build interactive websites / web applications using go & htmx. By combining the speed & simplicity of go + hypermedia attributes (htmx) to add interactivity to websites, all conveniently wrapped in pure go, you can build simple, fast, interactive websites without touching javascript. All compiled to a single deployable binary

If you’re just interested in functional HTML components, rather than a full HTMX server solution, consider:

  • fastcore.xml.FT: This is actually what FastHTML uses behind the scenes
  • htpy: Similar to fastcore.xml.FT, but with a somewhat different syntax
  • elm-html: Elm’s built-in HTML library with a type-safe functional approach
  • hiccup: Popular library for representing HTML in Clojure using vectors
  • hiccl: HTML generation library for Common Lisp inspired by Clojure’s Hiccup
  • Falco.Markup: F# HTML DSL and web framework with type-safe HTML generation
  • Lucid: Type-safe HTML generation for Haskell using monad transformers
  • dream-html: Part of the Dream web framework for OCaml, provides type-safe HTML templating

For other hypermedia application platforms, not based on HTMX, take a look at:

  • Hotwire/Turbo: Rails-oriented framework that similarly uses HTML-over-the-wire
  • LiveView: Phoenix framework’s solution for building interactive web apps with minimal JavaScript
  • Unpoly: Another HTML-over-the-wire framework with progressive enhancement
  • Livewire: Laravel’s take on building dynamic interfaces with minimal JavaScript
0.13.2 Mar 27, 2026
0.13.1 Mar 24, 2026
0.13.0 Mar 23, 2026
0.12.50 Mar 13, 2026
0.12.49 Mar 13, 2026
0.12.48 Mar 02, 2026
0.12.47 Feb 21, 2026
0.12.46 Feb 21, 2026
0.12.45 Feb 21, 2026
0.12.44 Feb 20, 2026
0.12.43 Feb 20, 2026
0.12.42 Feb 16, 2026
0.12.41 Feb 07, 2026
0.12.40 Feb 02, 2026
0.12.39 Jan 09, 2026
0.12.37 Dec 30, 2025
0.12.36 Dec 08, 2025
0.12.35 Nov 19, 2025
0.12.34 Nov 19, 2025
0.12.33 Oct 30, 2025
0.12.32 Oct 30, 2025
0.12.31 Oct 26, 2025
0.12.30 Oct 19, 2025
0.12.29 Sep 22, 2025
0.12.28 Sep 19, 2025
0.12.27 Sep 12, 2025
0.12.26 Sep 11, 2025
0.12.25 Aug 22, 2025
0.12.24 Aug 08, 2025
0.12.23 Aug 04, 2025
0.12.22 Jul 24, 2025
0.12.21 Jul 02, 2025
0.12.20 Jun 19, 2025
0.12.19 May 29, 2025
0.12.18 May 19, 2025
0.12.17 May 16, 2025
0.12.16 May 14, 2025
0.12.15 May 03, 2025
0.12.14 Apr 19, 2025
0.12.12 Apr 05, 2025
0.12.11 Apr 05, 2025
0.12.10 Apr 05, 2025
0.12.9 Apr 01, 2025
0.12.8 Apr 01, 2025
0.12.7 Apr 01, 2025
0.12.6 Mar 29, 2025
0.12.5 Mar 26, 2025
0.12.4 Mar 01, 2025
0.12.3 Mar 01, 2025
0.12.2 Mar 01, 2025
0.12.1 Jan 31, 2025
0.12.0 Jan 06, 2025
0.11.0 Jan 05, 2025
0.10.3 Dec 25, 2024
0.10.2 Dec 23, 2024
0.10.1 Dec 01, 2024
0.10.0 Nov 19, 2024
0.9.2 Nov 19, 2024
0.9.1 Nov 07, 2024
0.9.0 Oct 30, 2024
0.8.0 Oct 21, 2024
0.7.1 Oct 20, 2024
0.7.0 Oct 20, 2024
0.6.14 Oct 19, 2024
0.6.13 Oct 15, 2024
0.6.12 Oct 13, 2024
0.6.11 Oct 13, 2024
0.6.10 Oct 08, 2024
0.6.9 Sep 27, 2024
0.6.8 Sep 24, 2024
0.6.7 Sep 23, 2024
0.6.6 Sep 23, 2024
0.6.4 Sep 19, 2024
0.6.3 Sep 19, 2024
0.6.2 Sep 16, 2024
0.6.1 Sep 16, 2024
0.6.0 Sep 14, 2024
0.5.3 Sep 14, 2024
0.5.2 Sep 09, 2024
0.5.1 Aug 31, 2024
0.5.0 Aug 30, 2024
0.4.5 Aug 22, 2024
0.4.4 Aug 19, 2024
0.4.3 Aug 16, 2024
0.4.2 Aug 15, 2024
0.4.1 Aug 15, 2024
0.4.0 Aug 15, 2024
0.3.7 Aug 14, 2024
0.3.6 Aug 14, 2024
0.3.5 Aug 14, 2024
0.3.4 Aug 12, 2024
0.3.3 Aug 11, 2024
0.3.2 Aug 11, 2024
0.3.1 Aug 10, 2024
0.3.0 Aug 10, 2024
0.2.4 Aug 05, 2024
0.2.3 Aug 05, 2024
0.2.2 Aug 05, 2024
0.2.1 Jul 30, 2024
0.2.0 Jul 29, 2024
0.1.11 Jul 28, 2024
0.1.10 Jul 27, 2024
0.1.9 Jul 27, 2024
0.1.8 Jul 26, 2024
0.1.7 Jul 18, 2024
0.1.6 Jul 13, 2024
0.1.5 Jul 13, 2024
0.1.4 Jul 09, 2024
0.1.3 Jul 08, 2024
0.1.2 Jul 08, 2024
0.1.1 Jul 05, 2024
0.1.0 Jun 25, 2024
0.0.17 Jun 25, 2024
0.0.16 Jun 16, 2024
0.0.15 Jun 16, 2024
0.0.14 Jun 15, 2024
0.0.13 Jun 13, 2024
0.0.11 Jun 13, 2024
0.0.10 Jun 09, 2024
0.0.9 Jun 05, 2024
0.0.8 Jun 05, 2024
0.0.7 Jun 04, 2024
0.0.6 Jun 04, 2024
0.0.5 Jun 04, 2024
0.0.4 Jun 02, 2024
0.0.3 Jun 02, 2024
0.0.2 May 17, 2024

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
fastcore (>=1.12.16)
python-dateutil
starlette (~=1.0)
oauthlib
itsdangerous
uvicorn[standard] (>=0.30)
httpx
fastlite (>=0.1.1)
python-multipart
beautifulsoup4