Folder-Based Routing
Albedo translates your file system directly into FastAPI routes. All application routes must live inside the app/pages/ directory.
To create a new route, simply create a folder and place a page.py and page.html file inside it.
Route Types
| File Path | URL Route | Type |
|---|---|---|
app/pages/page.py |
/ |
Index - The root of your app. |
app/pages/about/page.py |
/about |
Static - Standard URL path. |
app/pages/users/[id]/page.py |
/users/{id} |
Dynamic - Captures a variable. |
app/pages/files/[...slug]/page.py |
/files/{slug:path} |
Catch-all - Captures nested paths. |
Dynamic Routes
When you wrap a folder name in brackets (e.g., [id]), Albedo treats it as a dynamic URL parameter. This parameter is automatically passed to your loader() and action() functions.
Directory Structure:
app/
└── pages/
└── users/
└── [id]/
├── page.py
└── page.html
page.py
# The 'id' parameter name must match the folder name [id]
def loader(id: int):
return {"user_id": id}
Catch-All Routes
If you need a route to capture an arbitrary number of nested directories (like a file viewer), use the [...slug] syntax.
A folder named [...path] will match /files/docs/2026/report.pdf, and the string "docs/2026/report.pdf" will be passed to your Python function as the path argument.