Every click is a signal. Listen to all of them.
LinkSpark is a multi-channel link intelligence platform with deep click telemetry, programmable A/B variants, branded QR delivery and real-time conversion analytics — all powered by a stateful FastAPI backend persisted in PostgreSQL.
Click Volume / 24h hourly
Devices
Top countries
Top referrers
Live activity
Your links
| Slug | Title | Variants | Clicks | Last |
|---|
New short link
Daily volume / last 14 days
Browsers
Geo reach
Operating systems
Workspace
Health
Architecture at a glance
FastAPI router
Ten REST endpoints under /api/linkspark covering CRUD, analytics, QR rendering and the live 302 redirect with click telemetry.
GET /api/linkspark/overview
GET /api/linkspark/links
POST /api/linkspark/links
GET /api/linkspark/links/{'{slug}'}
GET /api/linkspark/r/{'{slug}'} ← redirect
PostgreSQL persistence
Three SQLAlchemy tables with foreign keys, indexes on slug + admin_token + created_at, and cascade-delete on click history.
linkspark_links (id, slug, …, ab_split)
linkspark_clicks (id, link_id, variant, country, device)
linkspark_settings (singleton row)
A/B variant engine
Weighted random splitter (0-100% split per link). The redirect endpoint chooses a variant per request, persists it on the click row, and exposes A vs B in every chart.
variant, target = svc.choose_variant(link)
target = svc.add_utm(target, ...)
return RedirectResponse(target, 302)
Telemetry pipeline
Per-click capture: hashed IP, country guess from Accept-Language, UA-parsed device/browser/os, referrer host, and the chosen variant — all persisted for aggregate analytics.
SHA-256 hash(ip) → ip_hash
parse_ua(ua) → device, browser, os
guess_country(al) → country (ISO)
QR engine
Deterministic stylized QR generator using SHA-256 of the slug as a seed, rendered as inline SVG with colored finder patterns and rounded data cells.
GET /api/linkspark/links/{'{slug}'}/qr
?size=240
→ image/svg+xml
Aggregations
Hourly + daily timeseries with variant split, plus group-by breakdowns over country, device, browser, OS, referrer host and A/B variant — single SQL pass each.
GET /api/linkspark/overview
GET /api/linkspark/links/{'{slug}'}/timeseries
GET /api/linkspark/links/{'{slug}'}/breakdown?by=country