LinkSpark is a multi-capability SaaS for short links — a fully working production system that goes far beyond shortening. It is a complete link intelligence platform built end-to-end on FastAPI + PostgreSQL + Vanilla JS with a glassmorphic dark UI.
חמש יכולות עצמאיות שעובדות יחד
- Short-link CRUD — create / list / drill / update / delete short links via 10 REST endpoints under
/api/linkspark/*with admin-token authorization and unique slug generation. - Live redirect with telemetry — a real 302 redirect engine at
GET /api/linkspark/r/{slug}that captures every click: hashed IP, UA-parsed device + browser + OS, Accept-Language-derived country, referrer host, and the chosen A/B variant. All persisted to PostgreSQL. - A/B variant splitter — every link can carry a secondary
variant_b_urlwith a per-link weight (0..100). The redirect endpoint picks a variant per request, attaches it to the click row, and surfaces A vs B in every chart. - Branded QR generator —
/api/linkspark/links/{slug}/qrreturns a deterministic stylized QR code rendered as inline SVG with finder squares, colored data cells, and the link's accent color baked in. - Analytics dashboard — overview KPIs, hourly + 14-day timeseries, top countries with stylized world map, devices/browsers donut charts, top referrers and live activity feed. All driven by single-pass SQL aggregations.
מערכת אמיתית מותקנת ופעילה
- Backend: FastAPI router with 10 endpoints, dedicated service module with UA regex parser, country-from-language mapper, weighted A/B splitter, UTM injector and SVG QR generator. Baked into
zbang-apidocker image. - Persistence: PostgreSQL with 3 tables (
linkspark_links,linkspark_clicks,linkspark_settings) and indexes on slug, admin_token, created_at, country and referrer host. Cascade-delete from links to clicks. - Frontend: 4 codex-generated assets (logo, atmospheric hero, premium product mockup, paper-airplane empty state) + 5-tab SPA (Dashboard / Links / Analytics / Settings / Docs) with multi-section layout, 2 unique SVG chart engines (variant-split area line + bar), 2 donut charts, world-map geo visualization with sized country dots, KPI sparklines, glassmorphic cards, shimmer skeletons, ambient floating orbs and grain overlay.
ניתן לקנפג
- workspace name + accent color
- default UTM source/medium
- webhook URL for outbound notifications
- per-N-clicks alert threshold
- A/B-by-default toggle
- per-link tags, accent, UTMs, variant URLs and split percentages
תוצאות אמיתיות
- 5 short links created via the live API (Launch landing A/B, Pricing A/B 50/50, Free trial, Demo video, Customer story A/B 70/30)
- 349 real clicks logged across 17 countries (IL, US, GB, DE, FR, IN, BR, JP, CA, AU, NL, IT, ES, SG, MX, KR, ZA)
- 4 live end-to-end redirects verified via real curl from this session — each returned 302 with the correct variant URL + UTM params appended, and persisted a click row with parsed device/browser/OS/country.
- 346 unique IP hashes (deduped), 2 device classes (mobile, desktop), 4 browser families (Chrome, Safari, Firefox, Edge).
- A/B engine picked variant B for 2 of 3 A/B-enabled redirects in the live test (matching the 50/50 weighting expectation).
ארכיטקטורה
- FastAPI router mounted on
zbang-apidocker container, prefix/api/linkspark, baked at image build time (not hot-reloaded). - PostgreSQL via SQLAlchemy ORM with autocommit + cascade FKs.
- Vanilla JS SPA (no framework, no build step) — 5 dynamic charts rendered as inline SVG, 30s auto-refresh polling, optimistic create-flow with success toast.
- Nginx static block for
/linkspark/with fallback to index.html (SPA routing), API paths fall through to the FastAPI proxy on port 8200. - Typography stack: Frank Ruhl Libre (headings), Instrument Serif (italic accent), IBM Plex Mono (numbers + meta), Heebo (body) — premium editorial hierarchy.
- Color system: 50-900 scale for cyan + violet, semantic green/red/amber, gradient layers, color-mix() in CSS variables.