This project lets you turn a long link into a short link.
Example:
- Long : https://youtu.be/oUp4SWSrYYk?si=Z7r-93Y6WbqYXrns
- Short (yours) : https://sharplink.onrender.com/MultiHAT
- mirror (TinyURL) : https://tinyurl.com/2d89to88
When someone opens the short link, the website sends them to the long link.
You paste a big URL, press Generate, and you get a new short link.
You can pick the end part of the link (the “nickname”).
Example:
- Alias:
my-launch - Short link becomes:
http://YOUR-COMPUTER:5000/my-launch
If you leave it empty, the app will make a random one for you.
You can choose a date and time.
- Before that time: the short link works.
- After that time: the page shows Link expired.
If you leave it empty, the link never expires.
There is a checkbox called Also create a TinyURL mirror.
If you turn it on, the app will also ask TinyURL to create a short link that points to the same long URL.
Important: TinyURL does NOT let us choose a custom alias using this simple API.
You can press Copy to copy the link.
Note: copying works best on https:// or http://localhost. On http://<LAN-IP> some browsers block copying; the app tries a safe fallback, but a few browsers may still block it.
Run:
python -m venv .venv
.\.venv\Scripts\Activate.ps1Run:
pip install -r requirements.txtRun:
set FLASK_APP=app.py
flask run --host=0.0.0.0 --port=5000Open this in your browser:
- Open the website.
- Paste your long link into Destination URL.
- (Optional) Type a Custom alias.
- (Optional) Pick an Expires at date/time.
- (Optional) Turn on TinyURL mirror.
- Click Generate.
- Copy the short link and share it.
Your short links are saved in a small SQLite database file on your computer:
data/url_store.db
If a legacy data/url_store.json exists, the app will migrate it on first run.
You can override the database location with:
$env:SHARPLINK_DB_PATH="C:\path\to\url_store.db"You can also use a .env file. See .env.example.
This file remembers:
- the long URL
- when the short link was created
- when it expires (if you set it)
This app creates short links that work from your computer/server.
That means:
- If your computer is OFF, links won’t work.
- If people are not on your network, they cannot reach your computer unless you deploy it online.
To make links work for everyone on the internet, you must deploy this app on a public server (hosting).
You can also call the backend directly:
-
POST /api/shorten- JSON body example:
{ "url": "https://example.com", "alias": "custom", "expires_at": "2025-12-31T23:59", "use_tiny": true }
- JSON body example:
-
GET /ALIAS- Redirects to the long URL
- Returns 410 if expired
- Health check: http://localhost:5000/health
Install dev dependencies:
pip install -r requirements-dev.txtRun tests:
pytest- Only
http://andhttps://URLs are accepted. - Aliases are length-limited and restricted to letters, numbers,
-, and_. - API requests are rate-limited by IP.
- If you deploy publicly, add abuse controls and monitoring.
The default limiter uses in-memory storage, which is fine for local testing but not for production. Use Redis in production by setting:
$env:RATELIMIT_STORAGE_URI="redis://localhost:6379/0"Or add the same to your .env file. See .env.example.
Developed by Sagar Biswas: https://github.com/SagarBiswas-MultiHAT
