A simple URL shortener application built with Go, Echo, and PostgreSQL.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Go 1.25+
- Docker
- sqlc
- golangci-lint
- Air (Optional)
SQL queries are implemented using sqlc. Use the sqlc generate command to generate the Go code for the SQL queries.
List of available just commands
justSet up Git hooks
sh install-hooks.shInstall dependencies
go mod tidyFill out .env file with the required environment variables
cp .env.example .envRun the required services in Docker
docker compose up -d db valkey otel-collector
# or
just docker-upRun the application
just run
# or
just watch # run the app with live reloadBuild the application
just buildBuild the application for development
just build-devLive reload the application (with Air)
just watchClean up binary from the last build:
just cleanCreate a new migration file
just migrate-new nameApply all migrations
just migrate-upRollback the last migration
just migrate-downMigrate to a specific version
just migrate-force versionShow the current migration version
just migrate-versionTraces, metrics, and logs are collected via an OpenTelemetry Collector and exported to Grafana Cloud.
Set the following variables in your .env before starting the collector:
| Variable | Where to find it |
|---|---|
GRAFANA_CLOUD_OTLP_ENDPOINT |
Grafana Cloud → Connections → Add new connection → OpenTelemetry (OTLP) |
GRAFANA_CLOUD_INSTANCE_ID |
Your numeric stack/instance ID on the same page |
GRAFANA_CLOUD_API_KEY |
A Grafana Cloud API token with MetricsPublisher, LogsPublisher, and TracesPublisher scopes |
The collector exposes:
- Health check —
http://localhost:13133 - zPages (pipeline diagnostics) —
http://localhost:55679/debug/tracez
Audit the application for vulnerabilities, code quality, and dependency issues
just auditRun all tests, including DB integration tests (made with testcontainers)
just testRun all tests and display coverage
just test-coverList direct dependencies that have upgrades available
just upgradeableTidy module dependencies and format .go files
just tidy