A Full-Stack Task Board
We are going to build a real web application: a shared task board with three columns, a browser interface, and a JSON API over the same data.
It is about four hundred lines of Zuri, and it uses almost everything this
book has covered. Classes and inheritance for the domain model. Custom
errors for validation. The module system for structure. Files and JSON for
persistence. The HTTP server for routing, middleware and static files. Wire
for server-rendered HTML. os for configuration and signals. log for
output.
No dependencies. Nothing to install. zuri run taskboard and it runs.
What It Does
- Three columns:
todo,doing,done. - A page at
/showing the board, with forms to add, move and delete. - A JSON API under
/apidoing the same things, for anything that is not a browser. - A
board.jsonfile holding the state, written atomically. - One error handler turning domain errors into the right status code, for both the HTML and the JSON side.
How the Chapter Is Organised
Each section builds one layer, from the inside out:
- Laying Out the Project: the directory structure and why it is shaped this way.
- The Storage Layer: the JSON file and the board that sits on top of it.
- Validation and the Domain Model: the
Taskclass, which owns every rule about what a task is. - The JSON API: six routes over the board.
- Server-Rendered Pages with Wire: the templates, the forms and the redirect-after-post pattern.
- Middleware, Logging and Errors: the two pieces of cross-cutting behaviour every request goes through.
- Running It for Real: configuration, signals and what changes when you want more than one core.
- Testing the Board: a suite over all three layers, and what the layering bought.
Read it in order. Each section assumes the previous one exists.