This file will become your README and also the index of your documentation.
A guide to using the Todo application with nbdev and FastHTML
This is a simple Todo application built with FastHTML and nbdev. It demonstrates how to structure a FastHTML application using nbdev’s notebook-based development approach.
To run the application:
Copy from app import run_app
run_app()
This project is organized into several modules:
- core: Core utilities and configurations
- db: Database models and operations
- components: UI components for rendering Todos
- auth: Authentication functionality
- todos: Todo management routes
- app: Main application assembly
- User authentication
- Create, read, update, and delete Todos
- Drag and drop reordering of Todos
- Markdown support in Todo details
The application uses SQLite with FastLite, which supports the MiniDataAPI spec:
Copy from db import db, Todo, User
Database tables print(f”Tables: {list(db.t.keys())}“)
Todo schema print(f”Todo fields: {Todo.annotations}“)
Authentication is handled with session-based auth and Beforeware:
Copy from auth import before, login_redir
The beforeware checks if a user is authenticated and redirects to login if not
The main functionality is in the todos module:
Copy from todos import todo_routes
Routes include: GET / - Main todo list POST / - Create new todo PUT / - Update todo DELETE /todos/{id} - Delete todo GET /todos/{id} - View todo details GET /edit/{id} - Edit todo form
To add new features, create a new notebook with appropriate routes and import it in app.ipynb.
To deploy this application:
- Export the nbdev project
- Run the main app module
nbdev_export python -m todo_app.app