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

LayerTech
FrontendNext.js (App Router), Tailwind CSS
BackendNext.js API Routes, Node.js, Razorpay SDK (optional)
DatabaseSQLite for dev β†’ Postgres (self-hosted)
Auth (admin)Clerk or magic links / basic auth
HostingSelf-hosted on Proxmox/Hetzner/VPS
Domainlinky.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)

  • πŸ’Έ 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!