Key features of FastHX
mainFastHX is a Python server-side rendering library for FastAPI designed for HTMX-based applications. Key capabilities include:
- FastAPI Integration: Uses standard Python decorator syntax without magic dependencies in routes.
- Templating Agnostic: Works with
htmy,jinja2,dominate, or any other SSR library. - HTMX Optimized: Built for HTMX but usable standalone. Routes work correctly even if they receive non-HTMX requests (serving both data and HTML).
- Async HTML Streaming: Supports async streaming for better performance (TTFB/FCP).
- Context Awareness: The rendering engine has access to all route dependencies and the current request.
- Header Preservation: Response headers set in your routes are preserved after rendering.
- Type Safety: Correct typing allows for applying other typed decorators to your routes.
- Sync/Async Support: Works with both synchronous and asynchronous routes.