A simple task management web application built with Go and HTMX for learning purposes.
- Create, read, update, and delete tasks
- Real-time UI updates with HTMX
- PostgreSQL database integration
- Clean architecture with service layers
- Go 1.24+
- Docker
- PostgreSQL client tools (
psql,pg_isready)
-
Clone the repository
git clone <repository-url> cd go-htmx-crud
-
Start the database
./local-db-startup.sh
-
Install dependencies
go mod tidy
-
Run the application
go run cmd/main.go
-
Open your browser Navigate to
http://localhost:4000
├── cmd/
│ ├── main.go # Application entry point
│ └── api/
│ └── api.go # HTTP server setup
├── services/
│ ├── database/ # Database connection and operations
│ └── tasks/ # Page routes & operations
├── templates/ # HTML templates
├── schema.sql # Database schema
└── local-db-startup.sh # Database setup script
The application uses PostgreSQL with a simple tasks table:
id(SERIAL PRIMARY KEY)task(VARCHAR(200))done(BOOLEAN)
The database runs on port 15432 to avoid conflicts with existing PostgreSQL installations.
- The application runs on
localhost:4000 - Templates are automatically parsed from the
templates/directory - Database connection is managed through the
databaseservice layer