selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

GitHub
go-urlsh logo

Self-host go-urlsh

v1.0.1

Go URL shortener with web UI and API

ReleaseOpen SourceMIT
Updated11 months ago
LanguageGo
Setup difficultyModerate
Stars
159
Port
2000 (HTTP web UI and API)
Install with Docker Compose
urlsh web UI showing URL shortening interface

What is go-urlsh?

urlsh is a URL shortener and bookmarker service written in Go. It provides a web interface and REST API for creating and managing short URLs, with features like hit counting, URL expiration, custom keywords, and duplicate prevention. The admin API is protected by a static bearer token. It uses PostgreSQL as the primary database and optionally Redis for caching popular URLs. The project includes a terminal client (urlshc) for command-line usage. Deployment is primarily via docker-compose, which spins up the Go application alongside PostgreSQL and Redis containers. The codebase is MIT-licensed and maintained by Jitendra Adhikari.

Should you self-host go-urlsh?

go-urlsh scores 44/100 on selfhost.directory (how scoring works) and ranks #14 of 23 in URL Shortener. It has 159 GitHub stars.

There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.

Setup is moderate: expect some configuration beyond a single command. It is MIT-licensed and written mostly in Go.

Its closest alternative on selfhost.directory is dub-links (74/100, 24 961 stars). It scores higher overall, so compare the two before you pick. See go-urlsh vs dub-links side by side.

Features

  • Admin API
  • Custom Keywords
  • Duplicate Prevention
  • Hit Counter
  • OpenID Connect ProvidersEnv vars defined but implementation not documented
  • REST API
  • Terminal client
  • URL Expiration
  • URL Shortening

go-urlsh README

How to install go-urlsh

Install go-urlsh with Docker Compose

Environment variables
PORT, APP_ENV, DATABASE_URL, REDIS_URL, APP_ALLOW_DUPE_URL, APP_CHECK_URL_REACH, APP_ADMIN_TOKEN, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, MICROSOFT_TENANT_ID, MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET, YAHOO_CLIENT_ID, YAHOO_CLIENT_SECRET

first time only

cp .example.env .env

change auth token for admin if you want in .env file

APP_ADMIN_TOKEN=

docker-compose up

Preferred way per documentation. Spins up Go app, PostgreSQL, and Redis.

How to configure go-urlsh

  • APP_ADMIN_TOKENStatic auth token for admin endpoints

    Static auth token for admin endpoints

  • APP_ALLOW_DUPE_URL1Controls whether the same URL can be shortened again

    Controls whether the same URL can be shortened again

    values: 0, 1

  • APP_CHECK_URL_REACH0Whether to check if URL is reachable before shortening

    Whether to check if URL is reachable before shortening

    values: 0, 1

  • APP_ENVprodApplication environment

    Application environment

    values: dev, prod, test

  • DATABASE_URLPostgreSQL connection string

    PostgreSQL connection string

  • GOOGLE_CLIENT_IDGoogle OAuth client ID for OpenID Connect

    Google OAuth client ID for OpenID Connect

  • GOOGLE_CLIENT_SECRETGoogle OAuth client secret for OpenID Connect

    Google OAuth client secret for OpenID Connect

  • MICROSOFT_CLIENT_IDMicrosoft OAuth client ID for OpenID Connect

    Microsoft OAuth client ID for OpenID Connect

  • MICROSOFT_CLIENT_SECRETMicrosoft OAuth client secret for OpenID Connect

    Microsoft OAuth client secret for OpenID Connect

  • MICROSOFT_TENANT_IDMicrosoft Azure tenant ID for OpenID Connect

    Microsoft Azure tenant ID for OpenID Connect

  • PORT2000Application port for both inside and outside docker

    Application port for both inside and outside docker

  • REDIS_URLRedis connection string for caching

    Redis connection string for caching

  • YAHOO_CLIENT_IDYahoo OAuth client ID for OpenID Connect

    Yahoo OAuth client ID for OpenID Connect

  • YAHOO_CLIENT_SECRETYahoo OAuth client secret for OpenID Connect

    Yahoo OAuth client secret for OpenID Connect

go-urlsh releases & version history

More in Link Management

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…