← built

url-shortner-go

A URL shortener in Go, small on purpose.

kind
learning go
year
2026

§01 context

I write TypeScript most days, so I wanted something small enough to finish and real enough to teach me Go's way of doing things.

No framework and no ORM. The standard library for HTTP, pgx for Postgres, migrations as plain SQL files, and a separate binary to run them.

§02 shape

How it’s put together

cmd/
 ├─ api/          the HTTP server
 └─ migration/    runs SQL migrations
internal/
 ├─ config/       env → typed config
 ├─ db/           pgx pool
 ├─ handlers/     urls, healthz
 ├─ httpx/        error responses
 └─ migrations/   plain .up / .down SQL

§03 hard parts

The hard parts

  1. 01

    Unlearning Node habits

    Explicit errors everywhere, no decorators, no DI container. A lot of things I reach for in NestJS just aren't needed here.

stack

  • Go
  • PostgreSQL
  • pgx
  • golang-migrate

next →

valve

A TypeScript library that queues outbound API calls under one rate limit shared by every worker.