Minimal Go template for building fast, simple and mantainable web services and backend applications.
- Very minimal and zero overhead
- Production ready
- Simple and conventional structure, no black magic
- Separation of business logic and API logic
- Fully compatible and based on standard net/http
- Strict linting with golangci-lint
- Custom HTTP error handling and error mapping (separate service errors from API errors)
- Request payload validation
- Structured logging with zerolog
- Full AWS Lambda support (see serverless branch)
All utilities are implemented in the httpx
and util
package.
This repo contains a more real world example of a CRUD API with:
- sqlite3 storage
- Embedded sql migrations
- Apply migrations on startup with goose
- chi: HTTP router (std net/http compatible)
- chi/middleware: default middlewares and utils
- validator/v10: request body struct validation
- zerolog: structured logging
You can start by reading the small wiki with examples.
To get started, simply run:
make
This will build the project, you just need Go installed and nothing else.
To run the server:
./bin/api/main
This will create a sqlite3 file in the root of the project, run migrations and start the server on port 3000.