A fast link shortener built with Go, Echo, SQLite, and Alpine.js.
- Go 1.25.4+
- (Optional) Docker & Docker Compose
go mod download
go run main.goAccess dashboard at http://localhost:8080/dashboard (default: admin:admin)
docker-compose upCreate a link:
curl --user admin:admin -X POST http://localhost:8080/api/links \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/long/url", "slug": "my-link"}'List links:
curl --user admin:admin http://localhost:8080/api/linksRedirect:
curl -L http://localhost:8080/my-linkHealth check:
curl http://localhost:8080/healthEnvironment variables:
PORT- Server port (default: 8080)DB_PATH- SQLite database path (default:linked.db)ADMIN_CREDENTIALS- Admin credentialsusername:password(default:admin:admin)LOG_LEVEL-debug,info,warn,error(default:info)
Generate a secure random password:
python -c "import secrets; print(f'admin:{secrets.token_hex(16)}')"Use with curl:
curl --user admin:your_secure_password http://localhost:8080/api/linksOr set as environment variable:
export ADMIN_CREDENTIALS=$(python -c "import secrets; print(f'admin:{secrets.token_hex(16)}')")MIT