Short links, fast.
A self-hosted URL shortener built with Go. REST API, CLI, and MCP tools out of the box. Own your data. Deploy anywhere.
Built for developers
REST API
Full-featured HTTP API with JSON responses. Create, list, update, delete, and batch-shorten links. QR code generation and link preview fetching included.
CLI Tool
Built with Cobra. Create and manage links from your terminal with goshort-cli. Scriptable, pipeline-friendly, and config-file driven.
MCP Tools
7 tools, 3 resources, 2 prompts. Let Claude, Cursor, or any MCP-compatible agent shorten URLs, fetch metadata, and manage your link collection.
Secure by Default
Private IP blocking, Google Safe Browsing v4, per-IP rate limiting, and constant-time API key comparison. Parameterized queries throughout. No tracking. No cookies. MIT licensed.
See it in action
# Public — no auth, 30-day expiry
curl -X POST https://goshort.app/api/v1/urls/public \
-H "Content-Type: application/json" \
-d '{"url":"https://github.com/anIcedAntFA/goshort"}'
# Authenticated — custom alias, any expiry
curl -X POST https://goshort.app/api/v1/urls \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{"url":"https://github.com/anIcedAntFA/goshort","custom_alias":"goshort","expires_in":"365d"}'
# 201 Created
{
"short_code": "goshort",
"short_url": "https://goshort.app/goshort",
"original_url": "https://github.com/anIcedAntFA/goshort",
"expires_at": "2027-05-16T00:00:00Z"
} # Install (requires Go 1.22+)
go install github.com/anIcedAntFA/goshort/cmd/cli@latest
# Create a short link
goshort-cli shorten https://github.com/anIcedAntFA/goshort
# Short URL: https://goshort.app/k7Xm2p
# List all links
goshort-cli list
# Authenticated commands use GOSHORT_API_KEY env var
export GOSHORT_API_KEY=your-secret-key // Claude Code / Claude Desktop → .mcp.json
{
"mcpServers": {
"goshort": {
"command": "goshort",
"args": ["--mcp"],
"env": { "GOSHORT_API_KEY": "your-secret-key" }
}
}
}
// Cursor → .cursor/mcp.json (identical format)
{
"mcpServers": {
"goshort": {
"command": "goshort",
"args": ["--mcp"],
"env": { "GOSHORT_API_KEY": "your-secret-key" }
}
}
}
// Remote HTTP — connect to any deployed instance
// claude mcp add goshort-remote \
// --transport http https://goshort.app/mcp \
// --header "X-API-Key: your-api-key" Self-host in minutes
Quick start
Pick your preferred install method.
# Pull config files and start (Caddy handles TLS automatically)
curl -O https://raw.githubusercontent.com/anIcedAntFA/goshort/main/docker-compose.yml
curl -O https://raw.githubusercontent.com/anIcedAntFA/goshort/main/goshort.toml
docker compose up -d # Linux amd64 — swap suffix for darwin_arm64, windows_amd64, etc.
curl -L https://github.com/anIcedAntFA/goshort/releases/latest/download/goshort_linux_amd64.tar.gz | tar xz
./goshort # Requires Go 1.22+
go install github.com/anIcedAntFA/goshort/cmd/server@latest
goshort Configure & run
Edit goshort.toml.
[server]
base_url = "https://your.domain.com"
[auth]
api_key = "your-secret-key"
[cache]
driver = "memory" # none | memory | redis Start the server and confirm it's live.
# Start the server (binary / go install)
goshort
# Verify it's running
curl http://localhost:8080/health
# → {"status":"ok"} Support GoShort
MIT-licensed and free forever. Sponsorships help keep it maintained and growing.
Frequently asked questions
Is it free?
Yes. GoShort is MIT-licensed open source — self-host it for free on any server. The live demo at goshort.ngockhoi96.dev runs on a shared instance with a 5 req/min rate limit.
Can I use my own domain for short links?
Yes. Set base_url in goshort.toml to your domain (e.g. https://go.yourco.com) and all generated links use it. Bring your own TLS via Caddy or any reverse proxy.
Does it support custom aliases like /my-link?
Yes, via the authenticated REST API or CLI: POST /api/v1/urls with a custom_alias field, or goshort-cli shorten --alias my-link. The public demo widget uses auto-generated codes only.
How many URLs can I store?
Limited only by disk space. SQLite handles millions of rows without issue. For very high write throughput, a PostgreSQL backend is on the roadmap.
Do you track my URLs or collect analytics?
No tracking, no ads, no third-party scripts. The public instance counts clicks per link — nothing else. Self-hosted instances are entirely under your control.
What happens to links after 30 days on the public demo?
Public links expire after 30 days and return 410 Gone on access. Self-hosted instances let you set any expiry — or no expiry at all.