A minimal REST API in Go with a clean, modular layout:
models/– domain structs and DTOshandlers/– HTTP handlers (business logic + validation)routes/– router wiringdb/– database init and helpersmain.go– app entrypointitems.db– sample SQLite database for local testingDockerfile– container build
This project is a compact template you can extend with auth, pagination, filtering, etc.
- CRUD endpoints for an
Itemresource - SQLite for zero-setup local runs (
items.dbincluded) - Idiomatic Go project structure (handlers/routes/models split)
- Ready-to-containerize with the included
Dockerfile
- Go (1.21+ recommended)
make(optional)- SQLite (optional; not required if using the bundled
items.db)
# 1) Get deps
go mod download
# 2) Run
go run ./...
# or
go run main.go
---