A very performant and light (2mb in memory) link shortener and tracker. Written in Rust and React and uses Postgres/SQLite.
1# SimpleLink
2
3A very performant and light (2MB in memory) link shortener and tracker. Written in Rust and React and uses Postgres or SQLite.
4
5
6
7
8
9## How to Run
10
11### From Docker
12
13```bash
14docker run -p 8080:8080 \
15 -e JWT_SECRET=change-me-in-production \
16 -e SIMPLELINK_USER=admin@example.com \
17 -e SIMPLELINK_PASS=your-secure-password \
18 -v simplelink_data:/data \
19 ghcr.io/waveringana/simplelink:v2.2
20```
21
22### Environment Variables
23
24- `JWT_SECRET`: Required. Used for JWT token generation
25- `SIMPLELINK_USER`: Optional. If set along with SIMPLELINK_PASS, creates an admin user on first run
26- `SIMPLELINK_PASS`: Optional. Admin user password
27- `DATABASE_URL`: Optional. Postgres connection string. If not set, uses SQLite
28- `INITIAL_LINKS`: Optional. Semicolon-separated list of initial links in format "url,code;url2,code2"
29- `SERVER_HOST`: Optional. Default: "127.0.0.1"
30- `SERVER_PORT`: Optional. Default: "8080"
31
32If `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.
33
34### From Docker Compose
35
36Edit the docker-compose.yml file. It comes included with a PostgreSQL db configuration.
37
38## Build
39
40### From Source
41
42First configure .env.example and save it to .env
43
44```bash
45git clone https://github.com/waveringana/simplelink && cd simplelink
46./build.sh
47cargo run
48```
49
50Alternatively for a binary build:
51
52```bash
53./build.sh --binary
54```
55
56then check /target/release for the binary named `SimpleGit`
57
58### From Docker
59
60```bash
61docker build -t simplelink .
62docker run -p 8080:8080 \
63 -e JWT_SECRET=change-me-in-production \
64 -e SIMPLELINK_USER=admin@example.com \
65 -e SIMPLELINK_PASS=your-secure-password \
66 -v simplelink_data:/data \
67 simplelink
68```
69
70### From Docker Compose
71
72Adjust the included docker-compose.yml to your liking; it includes a postgres config as well.
73
74## Features
75
76- Support for both PostgreSQL and SQLite databases
77- Initial links can be configured via environment variables
78- Admin user can be created on first run via environment variables
79- Link click tracking and statistics
80- Lightweight and performant