{"id":15142585,"url":"https://github.com/flokapi/hotmix","last_synced_at":"2026-01-31T08:04:06.118Z","repository":{"id":257762307,"uuid":"859356570","full_name":"flokapi/hotmix","owner":"flokapi","description":"Add htmx to your FastAPI app","archived":false,"fork":false,"pushed_at":"2024-09-18T14:36:28.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-01T22:43:46.394Z","etag":null,"topics":["fastapi","htmx","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flokapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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}},"created_at":"2024-09-18T14:23:09.000Z","updated_at":"2025-03-30T01:17:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"83a2e6e7-1a8a-4733-aaa9-65a218054d16","html_url":"https://github.com/flokapi/hotmix","commit_stats":null,"previous_names":["flokapi/hotmix"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flokapi/hotmix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flokapi%2Fhotmix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flokapi%2Fhotmix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flokapi%2Fhotmix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flokapi%2Fhotmix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flokapi","download_url":"https://codeload.github.com/flokapi/hotmix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flokapi%2Fhotmix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28934639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T07:49:44.436Z","status":"ssl_error","status_checked_at":"2026-01-31T07:49:34.274Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["fastapi","htmx","python"],"created_at":"2024-09-26T09:42:55.295Z","updated_at":"2026-01-31T08:04:06.111Z","avatar_url":"https://github.com/flokapi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\nHotMix allows you to conveniently add htmx to your FastAPI app.\n\n# Getting Started\n\nInstall the packages\n\n```\npip install uvicorn fastapi jinja2 hotmix\n```\n\nCreate a tempate folder and add a template.\n\n```\nmain.py\ntemplates/\n\tindex.html\n```\n\nContent of `index.html`\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\" /\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e\n    \u003ctitle\u003eSimple Page\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003eHotMix Hello World\u003c/h1\u003e\n    \u003cp\u003eParameter from the API: {{ param }}\u003c/p\u003e\n    \u003cp\u003eYou are accessing the path: {{ request.url.path }}\u003c/p\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nContent of `main.py`\n\n```python\nfrom fastapi import FastAPI, Request\nimport hotmix as hm\n\napp = FastAPI()\nhm.init(\"templates\")\n\n@app.get(\"/\")\n@hm.htmx(\"index\")\nasync def main(request: Request):\n    return {\"param\": 37}\n```\n\n\n\n# How it works\n\nInitialize hotmix while setting the templates folder path\n\n```python\nimport hotmix as hm\n\nhm.init(\"templates\")\n```\n\nFor each of the routes which should return some htmx content, add a decorator specifying the name of the template file, without the `.html` extension.\n\n```python\n@app.get(\"/\")\n@hm.htmx(\"index\")\nasync def main(request: Request):\n    return {\"param\": 37}\n```\n\nInstead of returning the dictionary as JSON data, it will pass the dictionary to the jinja2 template engine, which will return the `.html` with the desired parameters.\n\nHotMix can handle two kinds of parameters:\n\n- Explicit paramters: returned in the request answer dictionary. They are accessed by giving their names: `{{ param }}`.\n- Request parameters, accessed through the `request` keyword. For example `{{ request.url.path }}`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflokapi%2Fhotmix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflokapi%2Fhotmix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflokapi%2Fhotmix/lists"}