A real-time TODO application built with Go, HTMX, WebSockets, and DOM morphing. This project demonstrates how to build responsive, interactive web applications without heavy JavaScript frameworks.
- Real-time updates via WebSockets
- Smooth UI transitions using HTMX and DOM morphing
- SQLite database with GORM
- Soft delete functionality
- Live reload during development
Standard:
go run main.goWith live reload (requires air):
airVisit http://localhost:8080 in your browser.
- Backend: Go with Chi router
- Database: SQLite + GORM
- Frontend: HTMX, idiomorph for DOM morphing
- Real-time: Gorilla WebSocket
This codebase intentionally prioritizes simplicity and shipping speed over "best practices" and premature abstractions.
1. No layers until needed
- Handlers call the database directly
- No repository pattern, service layer, or interfaces
- Extract to functions (not services) only when repeating 3+ times
2. One file for as long as possible
- Everything visible at once makes reasoning easier
- Split files only when navigation becomes genuinely hard
- "Proper structure" can wait until it's actually painful
3. GORM is fine
- Schema-as-structs and instant CRUD
- Optimize when there are actual performance problems, not theoretical ones
4. Add complexity incrementally
- Start simple, add features one at a time
- Refactor when pain is real, not anticipated
- Ship what works now
5. Functions over objects
- Write functions with explicit parameters
- Example:
toggleTodo(db *gorm.DB, id int)notservice.Toggle(id) - Dependencies should be visible, not hidden in struct fields
This approach trades "enterprise readiness" for shipping speed. The goal is to build and deploy real features, not to demonstrate architecture knowledge. Complexity can always be added later when actually needed.
Inspired by: Pieter Levels, Jon Calhoun, DHH
If this architecture bothers you, ask whether your suggested changes would help ship faster or just make the code "more correct." We optimize for the former.
Read the full blog post: Go, WebSockets, HTMX & Morphing is Fun!
