Skip to content

A lightning-fast URL shortener built with Rust, featuring HTTP 307 redirects and a clean, modern UI.

License

Notifications You must be signed in to change notification settings

AptS-1547/shortlinker

Repository files navigation

shortlinker

GitHub release (latest by date) Rust Release Docker Build CodeFactor License: MIT Docker Pulls

A minimalist URL shortener service supporting HTTP 307 redirection, built with Rust.

English | 中文

admin-panel-dashboard

Features

  • High performance with Rust + Actix-web
  • Multiple storage backends: SQLite, MySQL, PostgreSQL
  • Dynamic link management without restart
  • Custom and random short codes
  • Expiration support with flexible time formats
  • Password-protected links
  • Admin API with Bearer token authentication
  • Web admin panel
  • TUI mode for terminal users
  • Docker and Unix socket support

Quick Start

Docker:

docker run -d -p 8080:8080 -v $(pwd)/data:/data e1saps/shortlinker

Local:

git clone https://github.com/AptS-1547/shortlinker && cd shortlinker
cargo run

CLI Usage

./shortlinker                                    # Start server
./shortlinker tui                                # TUI mode (requires 'tui' feature)
./shortlinker add github https://github.com     # Custom code
./shortlinker add https://example.com           # Random code
./shortlinker add secret https://example.com --password mypass  # Password protected
./shortlinker add temp https://example.com --expire 7d          # Expires in 7 days
./shortlinker list                              # List all links
./shortlinker remove github                     # Remove link
./shortlinker export links.csv                  # Export to CSV
./shortlinker import links.csv                  # Import from CSV

Admin API

# Set token
export ADMIN_TOKEN=your_secret_token

# List all links
curl -H "Authorization: Bearer $ADMIN_TOKEN" http://localhost:8080/admin/v1/links

# Create link
curl -X POST -H "Authorization: Bearer $ADMIN_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"code":"github","target":"https://github.com","expires_at":"7d"}' \
     http://localhost:8080/admin/v1/links

# Delete link
curl -X DELETE -H "Authorization: Bearer $ADMIN_TOKEN" \
     http://localhost:8080/admin/v1/links/github

See Admin API docs for batch operations, runtime config, and more.

Configuration

Generate a config file:

./shortlinker config generate

This creates config.example.toml with server, database, cache, logging, analytics, and ipc settings.

See Configuration docs for all options.

Documentation

Related

Custom Frontend

Place your custom frontend in ./frontend-panel directory. Shortlinker will automatically detect and serve it instead of the built-in panel. See Admin Panel docs for parameter injection details.

License

MIT License © AptS:1547

        />  フ
       |  _ _|    AptS:1547
     /` ミ_xノ    — shortlinker assistant bot —
    /     |
   /  ヽ   ノ      Rust / SQLite / Bloom / CLI
   │  | | |
/ ̄|   | | |
( ̄ヽ__ヽ_)__)
\二)

   「ready to 307 !」

About

A lightning-fast URL shortener built with Rust, featuring HTTP 307 redirects and a clean, modern UI.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors 6

Languages