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

Compare changes

Choose any two refs to compare.

+2 -2
.github/workflows/docker-image.yml
···
- name: Install cosign
if: github.event_name != 'pull_request'
-
uses: sigstore/cosign-installer@v3.7.0
+
uses: sigstore/cosign-installer@v3.8.1
with:
-
cosign-release: "v2.4.1"
+
cosign-release: "v2.4.3"
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
+9 -39
Cargo.lock
···
[[package]]
name = "nu-ansi-term"
-
version = "0.46.0"
+
version = "0.50.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
+
checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399"
dependencies = [
-
"overload",
-
"winapi",
+
"windows-sys 0.52.0",
[[package]]
···
version = "1.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
-
-
[[package]]
-
name = "overload"
-
version = "0.1.1"
-
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "parking"
···
[[package]]
name = "ring"
-
version = "0.17.8"
+
version = "0.17.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
+
checksum = "70ac5d832aa16abd7d1def883a8545280c20a60f523a370aa3a9617c2b8550ee"
dependencies = [
"cc",
"cfg-if",
"getrandom",
"libc",
-
"spin",
"untrusted",
"windows-sys 0.52.0",
···
[[package]]
name = "tokio"
-
version = "1.43.0"
+
version = "1.43.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e"
+
checksum = "492a604e2fd7f814268a378409e6c92b5525d747d10db9a229723f55a417958c"
dependencies = [
"backtrace",
"bytes",
···
[[package]]
name = "tracing-subscriber"
-
version = "0.3.19"
+
version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
+
checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
dependencies = [
"nu-ansi-term",
"sharded-slab",
···
[[package]]
-
name = "winapi"
-
version = "0.3.9"
-
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-
dependencies = [
-
"winapi-i686-pc-windows-gnu",
-
"winapi-x86_64-pc-windows-gnu",
-
]
-
-
[[package]]
-
name = "winapi-i686-pc-windows-gnu"
-
version = "0.4.0"
-
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-
[[package]]
name = "winapi-util"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
dependencies = [
"windows-sys 0.59.0",
-
-
[[package]]
-
name = "winapi-x86_64-pc-windows-gnu"
-
version = "0.4.0"
-
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-core"
+1 -1
Cargo.toml
···
actix-web = "4.4"
actix-files = "0.6"
actix-cors = "0.6"
-
tokio = { version = "1.36", features = ["rt-multi-thread", "macros"] }
+
tokio = { version = "1.43", features = ["rt-multi-thread", "macros"] }
sqlx = { version = "0.8", features = ["runtime-tokio", "postgres", "sqlite", "chrono"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
+3 -3
README.md
···
## How to Run
-
### From Docker:
+
### From Docker
```bash
docker run -p 8080:8080 \
···
-e SIMPLELINK_USER=admin@example.com \
-e SIMPLELINK_PASS=your-secure-password \
-v simplelink_data:/data \
-
ghcr.io/waveringana/simplelink:v2.1
+
ghcr.io/waveringana/simplelink:v2.2
```
### Environment Variables
···
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:
+
### From Docker Compose
Edit the docker-compose.yml file. It comes included with a PostgreSQL db configuration.
+1 -1
docker-compose.yml
···
- shortener-network
app:
-
image: ghcr.io/waveringana/simplelink:v2.1
+
image: ghcr.io/waveringana/simplelink:v2.2
container_name: shortener-app
ports:
- "8080:8080"
+3
migrations/20250219000000_extend_short_code.sql
···
+
-- PostgreSQL migration
+
ALTER TABLE links ALTER COLUMN short_code TYPE VARCHAR(32);
+
-4
src/handlers.rs
···
WHERE link_id = $1
GROUP BY DATE(created_at)
ORDER BY DATE(created_at) ASC
-
LIMIT 30
"#,
)
.bind(link_id)
···
WHERE link_id = ?
GROUP BY DATE(created_at)
ORDER BY DATE(created_at) ASC
-
LIMIT 30
"#,
)
.bind(link_id)
···
AND query_source != ''
GROUP BY DATE(created_at), query_source
ORDER BY DATE(created_at) ASC, COUNT(*) DESC
-
LIMIT 300
"#,
)
.bind(link_id)
···
AND query_source != ''
GROUP BY DATE(created_at), query_source
ORDER BY DATE(created_at) ASC, COUNT(*) DESC
-
LIMIT 300
"#,
)
.bind(link_id)
+1 -1
src/models.rs
···
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs() as usize
-
+ 24 * 60 * 60; // 24 hours from now
+
+ 14 * 24 * 60 * 60; // 2 weeks from now
Self { sub: user_id, exp }
}