Tiny URL shortener with click-tracking
- Go 56.4%
- CSS 23.4%
- HTML 16.6%
- JavaScript 2.7%
- Dockerfile 0.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| cmd/turls | ||
| internal | ||
| .gitignore | ||
| CLAUDE.md | ||
| DESIGN.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| PRODUCT.md | ||
| README.md | ||
| sqlc.yaml | ||
turls
A tiny URL shortener built in Go with the standard library net/http and html/template, SQLite storage via sqlc + modernc.org/sqlite (pure Go, no cgo), and bcrypt password hashing.
Anyone can shorten a link (1h/6h/12h/24h, or forever if signed in). Signed-in users get a dashboard listing their own links with click counts and delete.
Run
go run ./cmd/turls runserver
Serves on http://localhost:8080. Data lives in url_shortener.db (SQLite, created automatically).
Create a user
There is no registration and accounts are created with a local script that prompts for user credentials.
go run ./cmd/turls createuser
Test
go test ./...
Regenerate sqlc code
After editing internal/db/schema.sql or internal/db/query.sql:
sqlc generate