Interactive random advice generator with instant results
Fetches fresh advice asynchronously via an external API — no page reload needed.
| Path | Method | Description |
|---|---|---|
/ |
GET |
Main page with initial advice |
/advice |
GET |
Returns a new advice card (HTMX partial) |
/api/advice |
GET |
Returns raw advice JSON (your own internal API endpoint) |
The app fetches advice from the public API:
https://api.adviceslip.com/advice
Handled inside fetch_advice() using httpx.AsyncClient.
You can replace this URL with any other advice source if desired.
- Get fresh advice instantly (HTMX partial updates)
- Fully async API fetching (httpx + FastAPI)
- Beautiful responsive UI (Tailwind)
- Separate JSON API:
/api/advice
- Python 3.12
- FastAPI
- httpx (async API client)
- Jinja2
- HTMX
- Tailwind CSS
- Render.com