FastHTML

fastht.ml
Developer Tools

Modern web applications in pure Python

llms.txt

FastHTML

FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore's FT "FastTags" into a library for creating server-rendered hypermedia applications. The FastHTML class itself inherits from Starlette, and adds decorator-based routing with many additions, Beforeware, automatic FT to HTML rendering, and much more.

Things to remember when writing FastHTML apps:

  • Although parts of its API are inspired by FastAPI, it is not compatible with FastAPI syntax and is not targeted at creating API services
  • FastHTML includes support for Pico CSS and the fastlite sqlite library, although using both are optional; sqlalchemy can be used directly or via the fastsql library, and any CSS framework can be used. Support for the Surreal and css-scope-inline libraries are also included, but both are optional
  • FastHTML is compatible with JS-native web components and any vanilla JS library, but not with React, Vue, or Svelte
  • Use serve() for running uvicorn (if __name__ == "__main__" is not needed since it's automatic)
  • When a title is needed with a response, use Titled; note that that already wraps children in Container, and already includes both the meta title as well as the H1 element.

Docs

  • FastHTML concise guide: A brief overview of idiomatic FastHTML apps
  • HTMX reference: Brief description of all HTMX attributes, CSS classes, headers, events, extensions, js lib methods, and config options
  • Starlette quick guide: A quick overview of some Starlette features useful to FastHTML devs.

API

  • API List: A succint list of all functions and methods in fasthtml.
  • MonsterUI API List: Complete API Reference for Monster UI, a component framework similar to shadcn, but for FastHTML

Examples

  • Websockets application: Very brief example of using websockets with HTMX and FastHTML
  • Todo list application: Detailed walk-thru of a complete CRUD app in FastHTML showing idiomatic use of FastHTML and HTMX patterns.

Optional

  • Surreal: Tiny jQuery alternative for plain Javascript with inline Locality of Behavior, providing me and any functions
  • Starlette full documentation: A subset of the Starlette documentation useful for FastHTML development.
  • JS App Walkthrough: An end-to-end walkthrough of a complete FastHTML app, including deployment to railway.
  • FastHTML by Example: A collection of 4 FastHTML apps showcasing idiomatic use of FastHTML and HTMX patterns.
  • Using Jupyter to write FastHTML: A guide to developing FastHTML apps inside Jupyter notebooks.
  • FT Components: Explanation of the FT components, which are a way to write HTML in a Pythonic way.
  • FAQ: Answers to common questions about FastHTML.
  • MiniDataAPI Spec: Explanation of the MiniDataAPI specification, which allows us to use the same API for many different database engines.
  • OAuth: Tutorial and explanation of how to use OAuth in FastHTML apps.
  • Routes: Explanation of how routes work in FastHTML.
  • WebSockets: Explanation of websockets and how they work in FastHTML.
  • Custom Components: Explanation of how to create custom components in FastHTML.
  • Handling Handlers: Explanation of how to request and response handlers work in FastHTML as routes.
  • Live Reloading: Explanation of how to use live reloading for FastHTML development.
Related

The AI Toolkit for TypeScript, from the creators of Next.js.

/llms.txt
136,985 tokens
Developer Tools

Meet the modern standard for public facing documentation. Beautiful out of the box, easy to maintain, and optimized for user engagement.

/llms.txt
5,436 tokens
/llms-full.txt
181,290 tokens
Developer Tools

Web development for the rest of us.

/llms.txt
602 tokens
/llms-full.txt
453,623 tokens
Developer Tools

Search through billions of items for similar matches to any object, in milliseconds. It’s the next generation of search, an API call away.

/llms.txt
15,715 tokens
/llms-full.txt
588,629 tokens
Developer Tools

Build and deploy reliable background jobs with no timeouts and no infrastructure to manage.

/llms.txt
12,202 tokens
/llms-full.txt
387,586 tokens
Developer Tools

Get the simple developer experience of SQLite in production, and scale your multi-tenant backend with unlimited databases.

/llms.txt
10,006 tokens
/llms-full.txt
163,317 tokens
Developer Tools

Upstash is a serverless data platform providing low latency and high scalability for real-time applications.

/llms.txt
52,307 tokens
/llms-full.txt
1,200,134 tokens
Developer Tools

One-click deployments built for teams, tuned for Laravel, loaded with tools and goodies you're going to love.

/llms.txt
565 tokens
/llms-full.txt
11,330 tokens
Developer Tools