| A lightweight URL shortening service with built‑in analytics. Create short links, track clicks in real time, and understand your traffic without external tools. |
|---|
Preview
- 🔗 Shorten long URLs into clean, shareable links
- 📊 Click tracking (total, unique, timestamp, referrer)
- 🌍 Geo & device analytics (optional)
- ⏱ Real‑time statistics dashboard
- 🔐 Optional authentication & private links
- 🧩 RESTful API
- Marketing campaign tracking
- Sharing clean links on social media
- Measuring link performance
- Internal tooling / personal analytics
- Backend: FastAPI
- Database: PostgreSQL
- Frontend (optional): Vue.js
- Analytics: IP + User‑Agent parsing
- Auth (admin): TOKEN
- User submits a long URL
- App generates a unique short code
- Short URL redirects to the original URL
- Each redirect logs analytics data
POST /api/shorten
Request
{
"url": "https://example.com/very/long/url"
}Response
{
"r": "https://your.app/aZ3kQ"
}GET /:code
- Redirects to original URL
- Logs click metadata automatically
GET /api/stats/:code
Returns click count, timestamps, referrers, devices, etc.
- Total clicks
- Unique visitors
- Date & time
- Referrer
- Device / OS / Browser
- Country / city (if enabled)
- IPs can be anonymized
- No cookies required
- GDPR‑friendly setup possible
git clone https://github.com/yourname/url-shortener
cd url-shortener
npm install
npm run devEnvironment variables:
DATABASE_URLBASE_URLJWT_SECRET(optional)
- Custom aliases
- Expiration dates
- QR code generation
- Webhooks
- Rate limiting
GNU Affero General Public License v3.0
Feel free to adapt this README to your stack or deployment style.