Skip to content

crnobog69/vid

Repository files navigation

vid - URL Shortener

Modern URL shortener with user management, Redis caching, and admin panel. Built with Go.

Features

  • URL shortening with custom short codes
  • User authentication and personal dashboards
  • Admin panel with user and link management
  • Redis caching for fast performance
  • Click tracking and statistics
  • Catppuccin Mocha theme
  • Serbian language UI (You can manually translate by changing .html files)

Quick Start

With Docker Compose (Recommended)

  1. Start everything:
git clone https://github.com/crnobog69/vid.git

First copy docker-compose.yml.example to docker-compose.yml

cp docker-compose.yml.example docker-compose.yml

Then change the environment as in Configuration section.

After that you can start:

docker compose up -d
sudo docker compose ud -d
  1. Access:

  2. Stop:

    docker-compose down
    sudo docker compose down

Local Development

  1. Start Redis:

    docker run -d -p 6379:6379 redis:7-alpine
  2. Build and run:

    go build -o vid main.go
    ./vid
  3. Access: http://localhost:13888

Configuration

Copy .env.example and customize:

PORT=13888
DOMAIN=vid.crnbg.org

# Redis (optional)
USE_REDIS=true
REDIS_ADDR=localhost:6379

# Admin user
ADMIN_EMAIL=admin@vid.crnbg.org
ADMIN_PASSWORD=changeme

# Access control
USER_SIGNUP=true              # Allow new user registration
REQUIRE_LOGIN=false           # Require login to use shortener
ALLOW_ANONYMOUS_CUSTOM_LINKS=true  # Allow custom links without login

Also change in Redis:

command: redis-server --requirepass
test: ["CMD", "redis-cli", "-a", 

Environment Variables

Variable Default Description
PORT 13888 Server port
DOMAIN vid.crnbg.org Your domain
USE_REDIS true Enable Redis caching
REDIS_ADDR localhost:6379 Redis address
REDIS_PASSWORD `` Redis password
ADMIN_EMAIL admin@vid.crnbg.org Admin email
ADMIN_PASSWORD changeme Admin password
USER_SIGNUP true Allow user registration
REQUIRE_LOGIN false Require login for shortening
ALLOW_ANONYMOUS_CUSTOM_LINKS true Allow custom links for anonymous
SESSION_SECRET (required) Session encryption key

Generate Secure Passwords

# Session secret
openssl rand -hex 32

# Redis password  
openssl rand -base64 32

# Database password
openssl rand -hex 32

Tech Stack

  • Backend: Go 1.19+
  • Database: SQLite
  • Cache: Redis 7
  • Sessions: gorilla/sessions
  • Theme: Catppuccin Mocha

Admin Panel

Access at /admin with credentials:

  • Default: admin@vid.crnbg.org / changeme

Features:

  • View all links and users
  • Delete links and users
  • Change user passwords
  • Create new users
  • Platform statistics

Update

Stop the containers:

sudo docker compose down

Then:

git pull

After that:

sudo docker compose up -d --build

Built for vid.crnbg.org

About

URL Shortener written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published