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
··· 29 30 - name: Install cosign 31 if: github.event_name != 'pull_request' 32 - uses: sigstore/cosign-installer@v3.7.0 33 with: 34 - cosign-release: "v2.4.1" 35 36 - name: Setup Docker buildx 37 uses: docker/setup-buildx-action@v3
··· 29 30 - name: Install cosign 31 if: github.event_name != 'pull_request' 32 + uses: sigstore/cosign-installer@v3.8.1 33 with: 34 + cosign-release: "v2.4.3" 35 36 - name: Setup Docker buildx 37 uses: docker/setup-buildx-action@v3
+9 -39
Cargo.lock
··· 1440 1441 [[package]] 1442 name = "nu-ansi-term" 1443 - version = "0.46.0" 1444 source = "registry+https://github.com/rust-lang/crates.io-index" 1445 - checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" 1446 dependencies = [ 1447 - "overload", 1448 - "winapi", 1449 ] 1450 1451 [[package]] ··· 1525 version = "1.20.2" 1526 source = "registry+https://github.com/rust-lang/crates.io-index" 1527 checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" 1528 - 1529 - [[package]] 1530 - name = "overload" 1531 - version = "0.1.1" 1532 - source = "registry+https://github.com/rust-lang/crates.io-index" 1533 - checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 1534 1535 [[package]] 1536 name = "parking" ··· 1751 1752 [[package]] 1753 name = "ring" 1754 - version = "0.17.8" 1755 source = "registry+https://github.com/rust-lang/crates.io-index" 1756 - checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" 1757 dependencies = [ 1758 "cc", 1759 "cfg-if", 1760 "getrandom", 1761 "libc", 1762 - "spin", 1763 "untrusted", 1764 "windows-sys 0.52.0", 1765 ] ··· 2432 2433 [[package]] 2434 name = "tokio" 2435 - version = "1.43.0" 2436 source = "registry+https://github.com/rust-lang/crates.io-index" 2437 - checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" 2438 dependencies = [ 2439 "backtrace", 2440 "bytes", ··· 2529 2530 [[package]] 2531 name = "tracing-subscriber" 2532 - version = "0.3.19" 2533 source = "registry+https://github.com/rust-lang/crates.io-index" 2534 - checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" 2535 dependencies = [ 2536 "nu-ansi-term", 2537 "sharded-slab", ··· 2739 ] 2740 2741 [[package]] 2742 - name = "winapi" 2743 - version = "0.3.9" 2744 - source = "registry+https://github.com/rust-lang/crates.io-index" 2745 - checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 2746 - dependencies = [ 2747 - "winapi-i686-pc-windows-gnu", 2748 - "winapi-x86_64-pc-windows-gnu", 2749 - ] 2750 - 2751 - [[package]] 2752 - name = "winapi-i686-pc-windows-gnu" 2753 - version = "0.4.0" 2754 - source = "registry+https://github.com/rust-lang/crates.io-index" 2755 - checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 2756 - 2757 - [[package]] 2758 name = "winapi-util" 2759 version = "0.1.9" 2760 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2762 dependencies = [ 2763 "windows-sys 0.59.0", 2764 ] 2765 - 2766 - [[package]] 2767 - name = "winapi-x86_64-pc-windows-gnu" 2768 - version = "0.4.0" 2769 - source = "registry+https://github.com/rust-lang/crates.io-index" 2770 - checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 2771 2772 [[package]] 2773 name = "windows-core"
··· 1440 1441 [[package]] 1442 name = "nu-ansi-term" 1443 + version = "0.50.1" 1444 source = "registry+https://github.com/rust-lang/crates.io-index" 1445 + checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" 1446 dependencies = [ 1447 + "windows-sys 0.52.0", 1448 ] 1449 1450 [[package]] ··· 1524 version = "1.20.2" 1525 source = "registry+https://github.com/rust-lang/crates.io-index" 1526 checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" 1527 1528 [[package]] 1529 name = "parking" ··· 1744 1745 [[package]] 1746 name = "ring" 1747 + version = "0.17.13" 1748 source = "registry+https://github.com/rust-lang/crates.io-index" 1749 + checksum = "70ac5d832aa16abd7d1def883a8545280c20a60f523a370aa3a9617c2b8550ee" 1750 dependencies = [ 1751 "cc", 1752 "cfg-if", 1753 "getrandom", 1754 "libc", 1755 "untrusted", 1756 "windows-sys 0.52.0", 1757 ] ··· 2424 2425 [[package]] 2426 name = "tokio" 2427 + version = "1.43.1" 2428 source = "registry+https://github.com/rust-lang/crates.io-index" 2429 + checksum = "492a604e2fd7f814268a378409e6c92b5525d747d10db9a229723f55a417958c" 2430 dependencies = [ 2431 "backtrace", 2432 "bytes", ··· 2521 2522 [[package]] 2523 name = "tracing-subscriber" 2524 + version = "0.3.20" 2525 source = "registry+https://github.com/rust-lang/crates.io-index" 2526 + checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" 2527 dependencies = [ 2528 "nu-ansi-term", 2529 "sharded-slab", ··· 2731 ] 2732 2733 [[package]] 2734 name = "winapi-util" 2735 version = "0.1.9" 2736 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2738 dependencies = [ 2739 "windows-sys 0.59.0", 2740 ] 2741 2742 [[package]] 2743 name = "windows-core"
+1 -1
Cargo.toml
··· 13 actix-web = "4.4" 14 actix-files = "0.6" 15 actix-cors = "0.6" 16 - tokio = { version = "1.36", features = ["rt-multi-thread", "macros"] } 17 sqlx = { version = "0.8", features = ["runtime-tokio", "postgres", "sqlite", "chrono"] } 18 serde = { version = "1.0", features = ["derive"] } 19 serde_json = "1.0"
··· 13 actix-web = "4.4" 14 actix-files = "0.6" 15 actix-cors = "0.6" 16 + tokio = { version = "1.43", features = ["rt-multi-thread", "macros"] } 17 sqlx = { version = "0.8", features = ["runtime-tokio", "postgres", "sqlite", "chrono"] } 18 serde = { version = "1.0", features = ["derive"] } 19 serde_json = "1.0"
+1 -1
Dockerfile
··· 4 WORKDIR /usr/src/frontend 5 6 # Copy frontend files 7 - COPY frontend/package*.json ./ 8 RUN bun install 9 10 COPY frontend/ ./
··· 4 WORKDIR /usr/src/frontend 5 6 # Copy frontend files 7 + COPY frontend/package.json ./ 8 RUN bun install 9 10 COPY frontend/ ./
+3 -3
README.md
··· 8 9 ## How to Run 10 11 - ### From Docker: 12 13 ```bash 14 docker run -p 8080:8080 \ ··· 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.1 20 ``` 21 22 ### Environment Variables ··· 31 32 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. 33 34 - ### From Docker Compose: 35 36 Edit the docker-compose.yml file. It comes included with a PostgreSQL db configuration. 37
··· 8 9 ## How to Run 10 11 + ### From Docker 12 13 ```bash 14 docker run -p 8080:8080 \ ··· 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 ··· 31 32 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. 33 34 + ### From Docker Compose 35 36 Edit the docker-compose.yml file. It comes included with a PostgreSQL db configuration. 37
+1 -1
docker-compose.yml
··· 19 - shortener-network 20 21 app: 22 - image: ghcr.io/waveringana/simplelink:v2.1 23 container_name: shortener-app 24 ports: 25 - "8080:8080"
··· 19 - shortener-network 20 21 app: 22 + image: ghcr.io/waveringana/simplelink:v2.2 23 container_name: shortener-app 24 ports: 25 - "8080:8080"
+3
migrations/20250219000000_extend_short_code.sql
···
··· 1 + -- PostgreSQL migration 2 + ALTER TABLE links ALTER COLUMN short_code TYPE VARCHAR(32); 3 +
-4
src/handlers.rs
··· 707 WHERE link_id = $1 708 GROUP BY DATE(created_at) 709 ORDER BY DATE(created_at) ASC 710 - LIMIT 30 711 "#, 712 ) 713 .bind(link_id) ··· 724 WHERE link_id = ? 725 GROUP BY DATE(created_at) 726 ORDER BY DATE(created_at) ASC 727 - LIMIT 30 728 "#, 729 ) 730 .bind(link_id) ··· 789 AND query_source != '' 790 GROUP BY DATE(created_at), query_source 791 ORDER BY DATE(created_at) ASC, COUNT(*) DESC 792 - LIMIT 300 793 "#, 794 ) 795 .bind(link_id) ··· 809 AND query_source != '' 810 GROUP BY DATE(created_at), query_source 811 ORDER BY DATE(created_at) ASC, COUNT(*) DESC 812 - LIMIT 300 813 "#, 814 ) 815 .bind(link_id)
··· 707 WHERE link_id = $1 708 GROUP BY DATE(created_at) 709 ORDER BY DATE(created_at) ASC 710 "#, 711 ) 712 .bind(link_id) ··· 723 WHERE link_id = ? 724 GROUP BY DATE(created_at) 725 ORDER BY DATE(created_at) ASC 726 "#, 727 ) 728 .bind(link_id) ··· 787 AND query_source != '' 788 GROUP BY DATE(created_at), query_source 789 ORDER BY DATE(created_at) ASC, COUNT(*) DESC 790 "#, 791 ) 792 .bind(link_id) ··· 806 AND query_source != '' 807 GROUP BY DATE(created_at), query_source 808 ORDER BY DATE(created_at) ASC, COUNT(*) DESC 809 "#, 810 ) 811 .bind(link_id)
+1 -1
src/models.rs
··· 87 .duration_since(UNIX_EPOCH) 88 .unwrap() 89 .as_secs() as usize 90 - + 24 * 60 * 60; // 24 hours from now 91 92 Self { sub: user_id, exp } 93 }
··· 87 .duration_since(UNIX_EPOCH) 88 .unwrap() 89 .as_secs() as usize 90 + + 14 * 24 * 60 * 60; // 2 weeks from now 91 92 Self { sub: user_id, exp } 93 }