
Deploy Cut | (Just Updated) URL Shortener & Bitly Alternative, Redis Included, Admin Set at Boot
Cut self-hosted URL shortener with Redis, Bitly alternative, admin API
redis
Just deployed
/data
Just deployed
Deploy and Host Cut on Railway
Built for an LLM agent to deploy and use. The deploy form has no fields to fill: the administrator password is generated at deploy time, the Redis that stores the links is included and password-protected, and every write answers 401 until a session cookie from a normal sign-in is sent. Cut is a small open-source self-hosted URL shortener, a Bitly alternative: create short links with custom or random slugs, redirect them, count clicks and manage everything from an admin page.
About Hosting Cut
This template runs two services: cut (the shortener and its admin page behind one public domain) and redis (the link store, with a volume mounted at /data and append-only persistence on). Links, click counts and login rate-limit counters live in Redis, so they survive redeploys of either service.
Locked from boot. Stock Cut redirects an unauthenticated write to the login page with a 302, which an API client reads as success, and starts with whatever admin password it is given, including none. This template's image answers 401 on POST /admin/links, on the edit route and on the delete route when there is no session, refuses to start with an ADMIN_PASSWORD shorter than 12 characters, and the generated one is 32 alphanumerics. Sign-in attempts are rate limited per client IP by upstream (2 per minute, 5 per hour, 10 per day), so an agent should sign in once per run.
Redirects. A short link is https://YOUR_DOMAIN/SLUG and answers 302 to the target. Point a custom domain at the cut service to use your own short domain.
Using the web interface. Open /admin on the public URL and sign in with the ADMIN_PASSWORD value from the cut service variables.
Agent contract
- Public URL:
https://RAILWAY_PUBLIC_DOMAIN(the generated domain of thecutservice) - Private URL:
http://cut.railway.internal:8080 - Credentials: the variable
ADMIN_PASSWORDon thecutservice (there is no username) - Auth: sign in with
POST /admin/login(form fieldpassword); a correct password answers302and sets anauthcookie to send on every/admin/*write, a wrong one answers302with no cookie, and a write without the cookie answers401 - Health:
GET /returns 200 without credentials
#!/bin/sh
# needs: SITE_URL (public https URL of the cut service) and ADMIN_PASSWORD (its variable); also curl, grep
J=$(mktemp)
curl -s -o /dev/null -w "health: %{http_code}\n" "$SITE_URL/"
curl -s -o /dev/null -w "write without key: %{http_code}\n" -X POST -d "url=https://example.com/x" "$SITE_URL/admin/links"
curl -s -o /dev/null -w "wrong password: %{http_code}\n" -c "$J" -X POST -d "password=not-the-password" "$SITE_URL/admin/login"
echo "wrong password sets cookie: $(grep -c auth "$J")"
curl -s -o /dev/null -w "login: %{http_code}\n" -c "$J" -X POST --data-urlencode "password=$ADMIN_PASSWORD" "$SITE_URL/admin/login"
echo "login sets cookie: $(grep -c auth "$J")"
curl -s -o /dev/null -w "link create: %{http_code}\n" -b "$J" -X POST -d "url=https://example.com/agent-check" -d "slug=agent-check" "$SITE_URL/admin/links"
curl -s -o /dev/null -D- "$SITE_URL/agent-check" | grep -i '^location:' | sed 's/^[Ll]ocation: /redirect: /'
curl -s -o /dev/null -w "link delete: %{http_code}\n" -b "$J" -X POST "$SITE_URL/admin/links/agent-check/delete"
curl -s -o /dev/null -w "after delete: %{http_code}\n" "$SITE_URL/agent-check"
rm -f "$J"
A fresh deploy prints health: 200, write without key: 401, wrong password: 302, wrong password sets cookie: 0, login: 302, login sets cookie: 1, link create: 302, redirect: https://example.com/agent-check, link delete: 302 and after delete: 404.
Why Deploy Cut on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Cut on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
- Agent-ready - no deployer fields, a contract block and one script that proves a sign-in, a create, a redirect, a delete and the refusal without a session.
- Locked by default - no empty or weak admin password, and no write that an unauthenticated client can mistake for success.
- Data survives redeploys - links and counters sit on a Redis volume with append-only persistence.
- Pinned - the upstream image is pinned by digest.
- No per-link pricing - unlimited links on your own domain instead of a Bitly plan.
Common Use Cases
- Self-hosted URL shortener - branded short links on your own domain instead of Bitly or Rebrandly.
- Agent-driven link management - an agent creates, redirects and deletes short links over plain HTTP with a session cookie.
- Campaign and QR-code links - one short URL per campaign, with click counts per link.
- Internal go-links for a team - short memorable slugs that redirect to docs, dashboards and tickets.
Dependencies for Cut Hosting
- The cut service and a Redis service with a volume, both created by the template. A custom domain is optional.
Deployment Dependencies
Template Content
