
Linky Blueprint
Deploying at: linky.faisaldarbar.com πΉ Project Goals Build a fully working, self-hosted link shortener Track click data: timestamps, referrer, location (IP-based) Clean and privacy-conscious (no creepy tracking) Add optional monetization via Razorpay (phase 2) Learn and apply Next.js, API routes, database, SSR π§± Stack Layer Tech Frontend Next.js (App Router), Tailwind CSS Backend Next.js API Routes, Node.js, Razorpay SDK (optional) Database SQLite for dev β Postgres (self-hosted) Auth (admin) Clerk or magic links / basic auth Hosting Self-hosted on Proxmox/Hetzner/VPS Domain linky.faisaldarbar.com π App Structure /linky βββ pages (or app/ if using App Router) β βββ index.tsx (create + view links) β βββ [shortcode].tsx (redirect handler) βββ /api β βββ create.ts (generate short link) β βββ track.ts (log analytics) β βββ verify-payment.ts (Razorpay, optional) βββ lib/ β βββ db.ts (Prisma or raw DB queries) β βββ utils.ts (random slug, etc.) βββ prisma/ β βββ schema.prisma βββ .env βββ next.config.js π― Core Features (MVP) π Shorten long URLs to custom slugs π Basic analytics (total clicks, referrer, timestamp) π Optional geolocation via IP (no cookies) β° Set expiration or limit on number of uses (optional) π§βπ» Admin-only dashboard to view/manage links π Auth (magic link or simple passcode for MVP) π Phase 2 β Monetized Links (Optional) πΈ Razorpay integration: create link β pay β unlock redirect π API verifies payment β returns actual destination π§Ύ Email or page shows receipt/confirmation π Phase 3 β Advanced Analytics View individual link performance: CTR, traffic sources Dashboard charts (Recharts, Chart.js) Export CSV π‘οΈ Security & Deployment Use Helmet.js for backend security headers Rate-limiting on API routes Logging with Pino or Winston Environment variables via dotenv GitHub Actions for CI/CD π‘ Future Ideas Team/multi-user support Custom domain per user Link folders / categories Tag links by campaign (UTM builder) Razorpay payout dashboard (for creators earning through links) Invite system for early access π Initial Hosting Plan Self-hosted on your Ubuntu server via Proxmox Reverse proxy via Nginx + SSL Subdomain: linky.faisaldarbar.com SQLite for now β PostgreSQL later (local) β Next Steps Initialize Next.js app with TailwindCSS Set up DB schema using Prisma (with SQLite first) Build URL shortening form (slug input + long URL input) Create API route to store short URL and long URL Build redirect route handler (e.g., /[slug] β redirect) Add click tracking (store timestamp, referrer, IP) Create simple admin dashboard (protected route) Add basic auth (env password or magic link) Deploy to VPS and point subdomain Monitor logs + errors Letβs build it! ...