A modern, server-side rendered Todo application built with Go and HTMX. This application demonstrates how to create a dynamic, interactive web application without writing any JavaScript, using HTMX for seamless server interactions.
- Create new todos
- Toggle todo completion status
- Edit existing todos
- Delete todos
- Server-side rendering with Go templates
- Real-time updates using HTMX
- SQLite database using GORM
- Backend: Go
- Frontend: HTMX + HTML Templates
- Database: SQLite
- ORM: GORM
- Template Engine: Go's built-in html/template
todo_go/
├── handlers/ # HTTP request handlers
├── lib/ # Library code (database initialization)
├── models/ # Data models
├── templates/ # HTML templates
└── main.go # Application entry point
- Go 1.16 or higher
- SQLite
- Clone the repository:
git clone https://github.com/yourusername/todo_go.git
cd todo_go
- Install dependencies:
go mod download
- Run the application:
go run main.go
- Open your browser and visit
http://localhost:8080
GET /
- Display the main todo listPOST /add
- Add a new todoPOST /todos/{id}/toggle
- Toggle todo completion statusGET /todos/{id}/edit
- Get todo edit formPOST /todos/{id}/update
- Update todoDELETE /todos/{id}/delete
- Delete todo
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.