You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/architecture.qmd
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ description: "Overview of the FastAPI webapp template architecture including dat
8
8
This application uses a **hybrid Post-Redirect-Get (PRG) + HTMX** architecture. Every mutating endpoint supports both paths simultaneously:
9
9
10
10
-**Non-HTMX path (PRG):** A standard browser form submission sends a POST request. On success the server issues a `303 See Other` redirect to a GET endpoint, which re-renders the full page with updated data. On error a full-page error template is returned.
11
-
-**HTMX path:** When the browser sends the `HX-Request: true` header (added automatically by [htmx.org](https://htmx.org)), the same POST endpoint detects the header via `utils/htmx.py:is_htmx_request()` and instead returns a `200` HTML partial that HTMX swaps into the relevant section of the page. On error a toast partial is returned and swapped into `#toast-container` via out-of-band (OOB) swap.
11
+
-**HTMX path:** When the browser sends the `HX-Request: true` header (added automatically by [htmx.org](https://htmx.org)), the same POST endpoint detects the header via `utils/core/htmx.py:is_htmx_request()` and instead returns a `200` HTML partial that HTMX swaps into the relevant section of the page. On error a toast partial is returned and swapped into `#toast-container` via out-of-band (OOB) swap.
12
12
13
13
The HTMX rollout keeps the existing POST route contract intact — dedicated `PUT`/`PATCH`/`DELETE` routes may be introduced in a future iteration.
14
14
@@ -129,7 +129,7 @@ Toast partials are rendered from `templates/base/partials/toast.html` and inject
129
129
130
130
### HTMX request detection
131
131
132
-
All HTMX-aware endpoints use the `is_htmx_request()` helper from `utils/htmx.py`:
132
+
All HTMX-aware endpoints use the `is_htmx_request()` helper from `utils/core/htmx.py`:
Copy file name to clipboardExpand all lines: docs/customization.qmd
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -128,7 +128,7 @@ The GET route for the homepage is defined in the main entry point for the applic
128
128
129
129
We name our GET routes using the convention `read_<name>`, where `<name>` is the name of the resource, to indicate that they are read-only endpoints that do not modify the database. In POST routes that modify the database, you can use the `get_session` dependency as an argument to get a database session.
130
130
131
-
Routes that require authentication generally take the `get_authenticated_account` dependency as an argument. Unauthenticated GET routes generally take the `get_optional_user` dependency as an argument. If a route should *only* be seen by authenticated users (i.e., a login page), you can redirect to the dashboard if `get_optional_user` returns a `User` object.
131
+
Routes that require authentication generally take the `get_authenticated_account` dependency as an argument. Unauthenticated GET routes generally take the `get_optional_user` dependency as an argument. Routes that should *only* be seen by unauthenticated users (e.g., login, register) use the `require_unauthenticated_client` dependency, which automatically redirects authenticated users to the dashboard. Routes that require re-verification of credentials (e.g., account deletion) use the `get_verified_account` dependency, which wraps `get_authenticated_account` with an additional email/password check.
132
132
133
133
### Context variables
134
134
@@ -173,7 +173,7 @@ Middleware functions are decorated with `@app.exception_handler(ExceptionType)`
173
173
Here's a middleware for handling the `PasswordValidationError` exception, which returns a toast partial for HTMX requests or a full error page for non-HTMX requests:
Copy file name to clipboardExpand all lines: docs/static/documentation.txt
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -229,7 +229,7 @@ description: "Overview of the FastAPI webapp template architecture including dat
229
229
This application uses a **hybrid Post-Redirect-Get (PRG) + HTMX** architecture. Every mutating endpoint supports both paths simultaneously:
230
230
231
231
- **Non-HTMX path (PRG):** A standard browser form submission sends a POST request. On success the server issues a `303 See Other` redirect to a GET endpoint, which re-renders the full page with updated data. On error a full-page error template is returned.
232
-
- **HTMX path:** When the browser sends the `HX-Request: true` header (added automatically by [htmx.org](https://htmx.org)), the same POST endpoint detects the header via `utils/htmx.py:is_htmx_request()` and instead returns a `200` HTML partial that HTMX swaps into the relevant section of the page. On error a toast partial is returned and swapped into `#toast-container` via out-of-band (OOB) swap.
232
+
- **HTMX path:** When the browser sends the `HX-Request: true` header (added automatically by [htmx.org](https://htmx.org)), the same POST endpoint detects the header via `utils/core/htmx.py:is_htmx_request()` and instead returns a `200` HTML partial that HTMX swaps into the relevant section of the page. On error a toast partial is returned and swapped into `#toast-container` via out-of-band (OOB) swap.
233
233
234
234
The HTMX rollout keeps the existing POST route contract intact — dedicated `PUT`/`PATCH`/`DELETE` routes may be introduced in a future iteration.
235
235
@@ -350,7 +350,7 @@ Toast partials are rendered from `templates/base/partials/toast.html` and inject
350
350
351
351
### HTMX request detection
352
352
353
-
All HTMX-aware endpoints use the `is_htmx_request()` helper from `utils/htmx.py`:
353
+
All HTMX-aware endpoints use the `is_htmx_request()` helper from `utils/core/htmx.py`:
354
354
355
355
```python
356
356
def is_htmx_request(request: Request) -> bool:
@@ -843,7 +843,7 @@ Middleware functions are decorated with `@app.exception_handler(ExceptionType)`
843
843
Here's a middleware for handling the `PasswordValidationError` exception, which returns a toast partial for HTMX requests or a full error page for non-HTMX requests:
0 commit comments