https://github.com/dillonstreator/template-go-chi
A minimal production-ready golang HTTP server with go-chi/chi
https://github.com/dillonstreator/template-go-chi
go-chi golang graceful-shutdown railway-template starter starter-template
Last synced: 4 months ago
JSON representation
A minimal production-ready golang HTTP server with go-chi/chi
- Host: GitHub
- URL: https://github.com/dillonstreator/template-go-chi
- Owner: dillonstreator
- Created: 2023-11-18T23:07:52.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-13T00:30:48.000Z (7 months ago)
- Last Synced: 2025-05-22T02:11:41.084Z (5 months ago)
- Topics: go-chi, golang, graceful-shutdown, railway-template, starter, starter-template
- Language: Go
- Homepage:
- Size: 36.1 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `template-go-chi`
A minimal production-ready golang HTTP server with [`go-chi/chi`](https://github.com/go-chi/chi).
✅ Graceful shutdown \
✅ Tracing with OpenTelemetry \
✅ Trust proxy resolution \
✅ Structured logging with `log/slog` \
✅ Rich request logging middleware including bytes written/read, request id, trace id, context propagation, and more \
✅ Panic recovery with rich logging including request id and trace id[](https://railway.app/template/FdfQPz?referralCode=ToZEjF)
## Installation
Go 1.20+ required
```sh
git clone https://github.com/dillonstreator/template-go-chicd template-go-chi
go run .
```## Configuration
See all example configuration via environment variables in [`.env-example`](./.env-example)
### Open Telemetry
Open Telemetry is disabled by default but can be enabled by setting the `OTEL_ENABLED` environment to `true`.
By default, the trace exporter is set to standard output. This can be overridden by setting `OTEL_EXPORTER_OTLP_ENDPOINT`.
Start the `jaegertracing/all-in-one` container with `docker-compose up` and set `OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318` to collect logs in jaeger. Docker compose will expose jaeger at http://localhost:16686