{"id":15039463,"url":"https://github.com/answerdotai/fasthtml","last_synced_at":"2026-03-13T22:04:07.702Z","repository":{"id":240177561,"uuid":"801880448","full_name":"AnswerDotAI/fasthtml","owner":"AnswerDotAI","description":"The fastest way to create an HTML app","archived":false,"fork":false,"pushed_at":"2025-05-05T12:57:04.000Z","size":9433,"stargazers_count":6288,"open_issues_count":61,"forks_count":263,"subscribers_count":61,"default_branch":"main","last_synced_at":"2025-05-06T01:18:35.657Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.fastht.ml/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnswerDotAI.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-05-17T05:16:59.000Z","updated_at":"2025-05-06T00:14:36.000Z","dependencies_parsed_at":"2024-05-17T06:32:03.485Z","dependency_job_id":"69f554d2-17f3-469b-a0cc-747e379f24f0","html_url":"https://github.com/AnswerDotAI/fasthtml","commit_stats":{"total_commits":839,"total_committers":68,"mean_commits":"12.338235294117647","dds":0.4135876042908224,"last_synced_commit":"f1cc34660a4765f14b99a406a8e66efd37720e28"},"previous_names":["answerdotai/fasthtml"],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Ffasthtml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Ffasthtml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Ffasthtml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Ffasthtml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnswerDotAI","download_url":"https://codeload.github.com/AnswerDotAI/fasthtml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252601896,"owners_count":21774666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T20:42:56.005Z","updated_at":"2026-02-20T07:01:04.113Z","avatar_url":"https://github.com/AnswerDotAI.png","language":"Jupyter Notebook","readme":"# FastHTML\n\n\n\u003c!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --\u003e\n\nWelcome to the official FastHTML documentation.\n\nFastHTML is a new next-generation web framework for fast, scalable web\napplications with minimal, compact code. It’s designed to be:\n\n- Powerful and expressive enough to build the most advanced, interactive\n  web apps you can imagine.\n- Fast and lightweight, so you can write less code and get more done.\n- Easy to learn and use, with a simple, intuitive syntax that makes it\n  easy to build complex apps quickly.\n\nFastHTML apps are just Python code, so you can use FastHTML with the\nfull power of the Python language and ecosystem. FastHTML’s\nfunctionality maps 1:1 directly to HTML and HTTP, but allows them to be\nencapsulated using good software engineering practices—so you’ll need to\nunderstand these foundations to use this library fully. To understand\nhow and why this works, please read this first:\n[fastht.ml/about](https://fastht.ml/about).\n\n## Installation\n\nSince `fasthtml` is a Python library, you can install it with:\n\n``` sh\npip install python-fasthtml\n```\n\nIn the near future, we hope to add component libraries that can likewise\nbe installed via `pip`.\n\n## Usage\n\nFor a minimal app, create a file “main.py” as follows:\n\n\u003cdiv class=\"code-with-filename\"\u003e\n\n**main.py**\n\n``` python\nfrom fasthtml.common import *\n\napp,rt = fast_app()\n\n@rt('/')\ndef get(): return Div(P('Hello World!'), hx_get=\"/change\")\n\nserve()\n```\n\n\u003c/div\u003e\n\nRunning the app with `python main.py` prints out a link to your running\napp: `http://localhost:5001`. Visit that link in your browser and you\nshould see a page with the text “Hello World!”. Congratulations, you’ve\njust created your first FastHTML app!\n\nAdding interactivity is surprisingly easy, thanks to HTMX. Modify the\nfile to add this function:\n\n\u003cdiv class=\"code-with-filename\"\u003e\n\n**main.py**\n\n``` python\n@rt('/change')\ndef get(): return P('Nice to be here!')\n```\n\n\u003c/div\u003e\n\nYou now have a page with a clickable element that changes the text when\nclicked. When clicking on this link, the server will respond with an\n“HTML partial”—that is, just a snippet of HTML which will be inserted\ninto the existing page. In this case, the returned element will replace\nthe original P element (since that’s the default behavior of HTMX) with\nthe new version returned by the second route.\n\nThis “hypermedia-based” approach to web development is a powerful way to\nbuild web applications.\n\n### Getting help from AI\n\nBecause FastHTML is newer than most LLMs, AI systems like Cursor,\nChatGPT, Claude, and Copilot won’t give useful answers about it. To fix\nthat problem, we’ve provided an LLM-friendly guide that teaches them how\nto use FastHTML. To use it, add this link for your AI helper to use:\n\n- [/llms-ctx.txt](https://www.fastht.ml/docs/llms-ctx.txt)\n\nThis example is in a format based on recommendations from Anthropic for\nuse with [Claude\nProjects](https://support.anthropic.com/en/articles/9517075-what-are-projects).\nThis works so well that we’ve actually found that Claude can provide\neven better information than our own documentation! For instance, read\nthrough [this annotated Claude\nchat](https://gist.github.com/jph00/9559b0a563f6a370029bec1d1cc97b74)\nfor some great getting-started information, entirely generated from a\nproject using the above text file as context.\n\nIf you use Cursor, type `@doc` then choose “*Add new doc*”, and use the\n/llms-ctx.txt link above. The context file is auto-generated from our\n[`llms.txt`](https://llmstxt.org/) (our proposed standard for providing\nAI-friendly information)—you can generate alternative versions suitable\nfor other models as needed.\n\n## Next Steps\n\nStart with the official sources to learn more about FastHTML:\n\n- [About](https://fastht.ml/about): Learn about the core ideas behind\n  FastHTML\n- [Documentation](https://www.fastht.ml/docs): Learn from examples how\n  to write FastHTML code\n- [Idiomatic\n  app](https://github.com/AnswerDotAI/fasthtml/blob/main/examples/adv_app.py):\n  Heavily commented source code walking through a complete application,\n  including custom authentication, JS library connections, and database\n  use.\n\nWe also have a 1-hour intro video:\n\n\u003chttps://www.youtube.com/embed/Auqrm7WFc0I\u003e\n\nThe capabilities of FastHTML are vast and growing, and not all the\nfeatures and patterns have been documented yet. Be prepared to invest\ntime into studying and modifying source code, such as the main FastHTML\nrepo’s notebooks and the official FastHTML examples repo:\n\n- [FastHTML Examples Repo on\n  GitHub](https://github.com/AnswerDotAI/fasthtml-example)\n- [FastHTML Repo on GitHub](https://github.com/AnswerDotAI/fasthtml)\n\nThen explore the small but growing third-party ecosystem of FastHTML\ntutorials, notebooks, libraries, and components:\n\n- [FastHTML Gallery](https://gallery.fastht.ml): Learn from minimal\n  examples of components (ie chat bubbles, click-to-edit, infinite\n  scroll, etc)\n- [Creating Custom FastHTML Tags for Markdown\n  Rendering](https://isaac-flath.github.io/website/posts/boots/FasthtmlTutorial.html)\n  by Isaac Flath\n- [How to Build a Simple Login System in\n  FastHTML](https://blog.mariusvach.com/posts/login-fasthtml) by Marius\n  Vach\n- Your tutorial here!\n\nFinally, join the FastHTML community to ask questions, share your work,\nand learn from others:\n\n- [Discord](https://discord.gg/qcXvcxMhdP)\n\n## Other languages and related projects\n\nIf you’re not a Python user, or are keen to try out a new language,\nwe’ll list here other projects that have a similar approach to FastHTML.\n(Please reach out if you know of any other projects that you’d like to\nsee added.)\n\n- [htmgo](https://htmgo.dev/) (Go): “*htmgo is a lightweight pure go way\n  to build interactive websites / web applications using go \u0026 htmx. By\n  combining the speed \u0026 simplicity of go + hypermedia attributes (htmx)\n  to add interactivity to websites, all conveniently wrapped in pure go,\n  you can build simple, fast, interactive websites without touching\n  javascript. All compiled to a single deployable binary*”\n\nIf you’re just interested in functional HTML components, rather than a\nfull HTMX server solution, consider:\n\n- [fastcore.xml.FT](https://fastcore.fast.ai/xml.html): This is actually\n  what FastHTML uses behind the scenes\n- [htpy](https://htpy.dev/): Similar to\n  [`fastcore.xml.FT`](https://fastcore.fast.ai/xml.html#ft), but with a\n  somewhat different syntax\n- [elm-html](https://package.elm-lang.org/packages/elm/html/latest/):\n  Elm’s built-in HTML library with a type-safe functional approach\n- [hiccup](https://github.com/weavejester/hiccup): Popular library for\n  representing HTML in Clojure using vectors\n- [hiccl](https://github.com/garlic0x1/hiccl): HTML generation library\n  for Common Lisp inspired by Clojure’s Hiccup\n- [Falco.Markup](https://github.com/pimbrouwers/Falco): F# HTML DSL and\n  web framework with type-safe HTML generation\n- [Lucid](https://github.com/chrisdone/lucid): Type-safe HTML generation\n  for Haskell using monad transformers\n- [dream-html](https://github.com/aantron/dream): Part of the Dream web\n  framework for OCaml, provides type-safe HTML templating\n\nFor other hypermedia application platforms, not based on HTMX, take a\nlook at:\n\n- [Hotwire/Turbo](https://turbo.hotwired.dev/): Rails-oriented framework\n  that similarly uses HTML-over-the-wire\n- [LiveView](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html):\n  Phoenix framework’s solution for building interactive web apps with\n  minimal JavaScript\n- [Unpoly](https://unpoly.com/): Another HTML-over-the-wire framework\n  with progressive enhancement\n- [Livewire](https://laravel-livewire.com/): Laravel’s take on building\n  dynamic interfaces with minimal JavaScript\n","funding_links":[],"categories":["Dev"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanswerdotai%2Ffasthtml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanswerdotai%2Ffasthtml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanswerdotai%2Ffasthtml/lists"}