A very performant and light (2mb in memory) link shortener and tracker. Written in Rust and React and uses Postgres/SQLite.
TypeScript 56.7%
Rust 34.8%
CSS 4.1%
JavaScript 1.5%
Shell 1.4%
Dockerfile 1.2%
HTML 0.3%
Other 0.1%
70 1 0

Clone this repository

https://tangled.org/nekomimi.pet/simplelink
git@knot.gaze.systems:nekomimi.pet/simplelink

For self-hosted knots, clone URLs may differ based on your setup.

README.md

SimpleLink#

A very performant and light (2MB in memory) link shortener and tracker. Written in Rust and React and uses Postgres or SQLite.

MainView

StatsView

How to Run#

From Docker#

docker run -p 8080:8080 \
    -e JWT_SECRET=change-me-in-production \
    -e SIMPLELINK_USER=admin@example.com \
    -e SIMPLELINK_PASS=your-secure-password \
    -v simplelink_data:/data \
    ghcr.io/waveringana/simplelink:v2.2

Environment Variables#

  • JWT_SECRET: Required. Used for JWT token generation
  • SIMPLELINK_USER: Optional. If set along with SIMPLELINK_PASS, creates an admin user on first run
  • SIMPLELINK_PASS: Optional. Admin user password
  • DATABASE_URL: Optional. Postgres connection string. If not set, uses SQLite
  • INITIAL_LINKS: Optional. Semicolon-separated list of initial links in format "url,code;url2,code2"
  • SERVER_HOST: Optional. Default: "127.0.0.1"
  • SERVER_PORT: Optional. Default: "8080"

If SIMPLELINK_USER and SIMPLELINK_PASS are not passed, an admin-setup-token is pasted to the console and as a text file in the project root.

From Docker Compose#

Edit the docker-compose.yml file. It comes included with a PostgreSQL db configuration.

Build#

From Source#

First configure .env.example and save it to .env

git clone https://github.com/waveringana/simplelink && cd simplelink
./build.sh
cargo run

Alternatively for a binary build:

./build.sh --binary

then check /target/release for the binary named SimpleGit

From Docker#

docker build -t simplelink .
docker run -p 8080:8080 \
    -e JWT_SECRET=change-me-in-production \
    -e SIMPLELINK_USER=admin@example.com \
    -e SIMPLELINK_PASS=your-secure-password \
    -v simplelink_data:/data \
    simplelink

From Docker Compose#

Adjust the included docker-compose.yml to your liking; it includes a postgres config as well.

Features#

  • Support for both PostgreSQL and SQLite databases
  • Initial links can be configured via environment variables
  • Admin user can be created on first run via environment variables
  • Link click tracking and statistics
  • Lightweight and performant