This project is a web-based implementation of a minimal todo app built using FastHTML, HTMX, and SQLite.
The app uses FastHTML to define routes and handle todo list operations. Key routes include:
GET /
: The main page that renders the initial todo list.POST /
: Handles adding new todo items.DELETE /{id}
: Handles deleting todo items.Todo items are stored in an SQLite database:
todos
: A table storing todo items with id
and title
fields.HTMX is used to create a dynamic user interface:
hx-post
attribute on the form triggers a POST request to add new todos.hx-delete
attribute on delete links triggers DELETE requests to remove todos.hx-target
specifies where the response from the server should be inserted.hx-swap
determines how the new content should be added or replaced.
beforeend
: Adds the new content at the end of the target element. This is used to add the new list item to end of the todo list.outerHTML
: Replaces the entire target element with the new content. This is used to replaces the todo list item completely with None
to remove it from the list.