Enterprise-grade link intelligence platform powered by Gemini AI, realtime Socket.IO telemetry, and a production-hardened MERN stack.
- Overview
- Features
- Tech Stack
- Architecture
- Screenshots
- Live Demo
- Getting Started
- Environment Variables
- Folder Structure
- Security
- AI Features
- Realtime Engine
- Deployment
- Future Roadmap
- Author
- License
LinkMind AI is a production-grade, full-stack SaaS platform that redefines URL shortening with AI-powered analytics, realtime visitor telemetry, and enterprise-level security.
Built on the MERN stack with TypeScript end-to-end, it combines sub-5ms Redis-cached redirections, Socket.IO live dashboards, Gemini AI traffic intelligence, and a comprehensive admin moderation system โ all wrapped in a polished glassmorphism UI.
- ๐ Not just a URL shortener โ it's a complete link intelligence platform
- ๐ Realtime analytics โ live click streams, visitor counters, and timeline charts powered by Socket.IO
- ๐ค AI-driven insights โ Gemini generates actionable marketing recommendations from your traffic data
- ๐ก๏ธ Enterprise security โ CSRF protection, HttpOnly JWT cookies, RBAC, rate limiting, and Helmet headers
- โก Redis-powered performance โ BullMQ queue-based click processing with <4ms cache-hit redirections
- ๐ GeoIP tracking โ real geographic visitor data via MaxMind integration
| Feature | Description |
|---|---|
| URL Shortening | Generate compact, trackable short links with auto-generated codes |
| Custom Aliases | Create branded vanity URLs (/r/my-brand) with unique constraint validation |
| QR Code Generation | Automatic vector QR code generation for every shortened link |
| Campaign Grouping | Organize links into named campaigns for segmented analytics |
| Password Protection | Secure sensitive links behind password-gated unlock pages |
| Expiration System | Set auto-expiry dates with cron-based archival processing |
| Burn-After-Click | One-time-use links that self-destruct after first access |
| Favorites & Archive | Star important links and archive inactive ones |
| Bulk Export | Download click history as timestamped CSV or nested JSON |
| Feature | Description |
|---|---|
| Realtime Click Tracking | Live click events streamed to dashboards via Socket.IO |
| Visitor Demographics | Device type, OS, browser, country, city breakdown |
| Traffic Timeline | Interactive Recharts visualizations with hourly distribution |
| Referrer Analysis | Track inbound traffic sources and referral channels |
| Unique vs Total Clicks | Deduplicated visitor metrics with IP-based uniqueness |
| Active Visitor Counter | Live global connected-user count broadcast in realtime |
| GeoIP Resolution | Real city/country/timezone mapping via MaxMind geoip-lite |
| Feature | Description |
|---|---|
| JWT HttpOnly Cookies | Secure, non-JavaScript-accessible token storage |
| Refresh Token Flow | Automatic silent token refresh with 7-day sliding sessions |
| CSRF Protection | Double-submit cookie pattern (XSRF-TOKEN header validation) |
| Helmet Headers | Comprehensive HTTP security headers |
| CORS Policy | Configurable cross-origin protection |
| Rate Limiting | Granular DDoS protection across auth, API, redirect, and AI endpoints |
| RBAC | Role-based access control (user / admin) with middleware guards |
| Developer API Keys | SHA-256 hashed API keys with expiration and lastUsedAt tracking |
| Feature | Description |
|---|---|
| User Management | View, suspend, and manage all registered users |
| Global Analytics | Platform-wide click metrics and user activity overview |
| Audit Logs | Comprehensive administrative action logging with auto-rotation |
| Suspicious Link Monitoring | Review and moderate flagged or problematic links |
| Protected Routes | Admin-only pages gated by RBAC middleware |
| Feature | Description |
|---|---|
| Gemini-Powered Insights | Deep traffic analysis with actionable marketing recommendations |
| Engagement Analysis | AI evaluates click patterns, device ecosystems, and referral quality |
| Peak Time Detection | Identifies optimal posting windows from hourly activity profiles |
| Growth Tactics | Concrete, data-driven suggestions for campaign optimization |
| Smart Fallbacks | Heuristic analytics engine when Gemini API is unavailable |
| Technology | Purpose |
|---|---|
| React 19 | Component-based UI framework |
| TypeScript | End-to-end type safety |
| Redux Toolkit | Global state management with slices |
| Tailwind CSS v4 | Utility-first responsive styling |
| Framer Motion | Smooth page transitions and micro-animations |
| Recharts | Interactive data visualization charts |
| Lucide React | Modern icon system |
| Axios | HTTP client with interceptor support |
| Socket.IO Client | Realtime WebSocket communication |
| React Router v7 | Client-side routing with protected routes |
| Zod | Runtime schema validation |
| Technology | Purpose |
|---|---|
| Node.js | JavaScript runtime |
| Express.js | REST API framework |
| TypeScript | Server-side type safety |
| MongoDB + Mongoose | Document database with compound indexes |
| JWT (jsonwebtoken) | Stateless authentication tokens |
| Socket.IO | Realtime bidirectional event communication |
| Redis (ioredis) | High-performance caching layer |
| BullMQ | Background job queue for click telemetry |
| Helmet | HTTP security headers |
| Cookie Parser | Secure cookie management |
| Express Rate Limit | DDoS and abuse protection |
| bcryptjs | Password hashing with salt rounds |
| node-cron | Background scheduled maintenance tasks |
| qrcode | QR code generation library |
| geoip-lite | MaxMind GeoIP database integration |
| esbuild | Ultra-fast production bundler |
| Technology | Purpose |
|---|---|
| Google Gemini API | gemini-3.5-flash model for traffic intelligence |
| @google/genai | Official Google GenAI SDK |
| Platform | Use |
|---|---|
| Vercel | Frontend hosting + serverless functions |
| Railway / Render | Backend + WebSocket hosting |
| MongoDB Atlas | Managed cloud database |
| Upstash / Redis Cloud | Managed Redis instances |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLIENT BROWSER โ
โ React 19 + Redux Toolkit + Socket.IO โ
โ Tailwind CSS + Recharts โ
โโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
REST API WebSocket
(Axios) (Socket.IO Client)
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ
โ EXPRESS SERVER (Node.js) โ
โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Helmet โ โ CORS โ โ Cookie Parser โ โ
โ โ Security โ โ Policy โ โ + CSRF Shield โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ RATE LIMITERS (Per-Route Granularity) โ โ
โ โ Global: 200/15m โ Auth: 15/15m โ AI: 10/15m โ 300/15m โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ Auth โ โ Links โ โ Campaign โ โ Admin โ โ
โ โ Routes โ โ Routes โ โ Routes โ โ Routes โ โ
โ โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ โ
โ โ โ โ โ โ
โ โโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโ โ
โ โ CONTROLLER LAYER โ โ
โ โ Auth โ Links โ Campaigns โ Analytics โ Admin โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ SERVICE LAYER โ โ
โ โ AI Service โ Redis โ Queue (BullMQ) โ Cron โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ MongoDB โ โ Redis โ โ Gemini AI โ
โ Atlas โ โ Cache โ โ Engine โ
โ โ โ + BullMQ โ โ โ
โ โข Users โ โ โข Link โ โ โข Traffic โ
โ โข Links โ โ Cache โ โ Analysis โ
โ โข Analyticsโ โ โข AI Cache โ โ โข Growth โ
โ โข Campaignsโ โ โข Pub/Sub โ โ Tactics โ
โ โข ApiKeys โ โ โข Socket โ โ โข Peak โ
โ โข AuditLog โ โ Adapter โ โ Times โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
User clicks /r/:shortCode
โ
โผ
Rate Limiter Check (300/15min)
โ
โผ
Redis Cache Lookup (<4ms) โโโโ Cache Miss โโโโถ MongoDB Query
โ โ
โผ โผ
Extract Visitor Metadata Cache Result in Redis
(IP, User-Agent, GeoIP, Referrer) โ
โ โ
โผ โ
BullMQ Queue โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
(Async Click Telemetry)
โ
โผ
MongoDB Analytics Insert
โ
โผ
Socket.IO Broadcast
โ "click_registered" event
โ Link room + Campaign room
โ Active visitor count update
โ
โผ
Dashboard Charts Update (Realtime)
Register/Login โโโถ Generate JWT Pair โโโถ Set HttpOnly Cookies
(access: 15m) (Secure, SameSite)
(refresh: 7d)
โ
โผ
Protected Request โโโถ Verify Access Token
โ โ
โ Token Expired?
โ โ โ
โ Yes No
โ โ โ
โ โผ โผ
โ Verify Refresh Proceed
โ Token โ
โ โ โ
โ Rotate Pair โ
โ Set New Cookies โ
โ โ โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโ
Add screenshots of the running application here.
| View | Preview |
|---|---|
| Dashboard | ![]() |
| Link Analytics | ![]() |
| Campaign Manager | ![]() |
| Admin Panel | ![]() |
| Mobile View | ![]() |
- Node.js v18+ and npm v9+
- MongoDB (Atlas cloud or local instance)
- Redis (optional โ enables caching, BullMQ queues, and Socket.IO scaling)
- Gemini API Key (optional โ enables AI traffic insights)
# 1. Clone the repository
git clone https://github.com/yourusername/linkmind-ai.git
cd linkmind-ai
# 2. Install dependencies
npm install
# 3. Configure environment variables
cp .env.example .env
# Edit .env with your credentials (see Environment Variables section)
# 4. Seed the admin user (optional)
npm run seed:admin
# 5. Start the development server
npm run devThe application will launch at http://localhost:3000 with Vite's hot-reload development middleware enabled.
# Compile frontend (Vite) and backend (esbuild โ CJS)
npm run build
# Launch the production server
npm run startCreate a .env file in the project root with the following variables:
| Variable | Description | Example |
|---|---|---|
MONGODB_URI |
MongoDB connection string | mongodb+srv://user:pass@cluster.mongodb.net/linkmind |
JWT_SECRET |
Secret key for signing JWT tokens | your-super-secure-jwt-secret-key-2026 |
| Variable | Description | Example |
|---|---|---|
NODE_ENV |
Environment mode | production |
APP_URL |
Public application URL | https://linkmind.ai |
GEMINI_API_KEY |
Google Gemini API key for AI insights | API KEY |
REDIS_URI |
Redis connection URL (enables caching, BullMQ, Socket.IO adapter) | redis://user:pass@host:6379 |
# โโโ Server โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
NODE_ENV=production
APP_URL=https://linkmind.ai
# โโโ Database โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
MONGODB_URI=mongodb+srv://user:password@cluster.mongodb.net/linkmind
# โโโ Authentication โโโโโโโโโโโโโโโโโโโโโโโโโโโ
JWT_SECRET=your-super-secure-jwt-secret-key-2026
# โโโ AI Engine โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
GEMINI_API_KEY=AIzaSy...
# โโโ Redis (Optional) โโโโโโโโโโโโโโโโโโโโโโโโโ
REDIS_URI=redis://default:password@redis-host:6379
# โโโ Frontend โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
VITE_API_URL=https://api.linkmind.aiNote: If
MONGODB_URIis not set, the app automatically falls back to an in-memory MongoDB instance viamongodb-memory-serverfor development. IfREDIS_URIis not set, the app gracefully falls back to direct database queries and memory-based batch processing.
LinkMind AI implements multi-layer security designed for production SaaS environments:
- HttpOnly Cookies โ JWT tokens stored in HTTP-only cookies, preventing XSS token theft
- Secure Flag โ Cookies marked
Securein production (HTTPS-only transmission) - SameSite Policy โ
Nonein production for cross-origin support,Laxin development - Token Rotation โ Automatic access token refresh using long-lived refresh tokens
- Password Hashing โ bcrypt with 10 salt rounds for all stored passwords
- CSRF Protection โ Double-submit cookie pattern validates
XSRF-TOKENheaders on all mutations (POST/PUT/DELETE) - Helmet Headers โ Comprehensive HTTP security headers (X-Frame-Options, X-Content-Type-Options, etc.)
- CORS โ Configurable cross-origin resource sharing policy
- Input Validation โ Zod schemas for request payload validation
| Endpoint Group | Limit | Window |
|---|---|---|
| Global API | 200 requests | 15 minutes |
| Auth (Login/Register) | 15 requests | 15 minutes |
| Gemini AI Analytics | 10 requests | 15 minutes |
| Link Redirects | 300 requests | 15 minutes |
- RBAC Middleware โ Role-based route protection (
user,admin) - Admin Route Guard โ Server-side
authorize("admin")middleware + client-side redirect - API Key Auth โ SHA-256 hashed developer keys with expiration support
- Account Suspension โ Suspended users are blocked at the middleware level
LinkMind AI integrates Google Gemini (gemini-3.5-flash) to transform raw click data into actionable intelligence:
- Data Collection โ The analytics engine aggregates click metrics including device profiles, geographic data, referral channels, and hourly activity patterns
- AI Analysis โ Gemini processes the anonymized dataset through a specialized marketing analysis prompt
- Insight Generation โ The AI produces a structured report with four key sections:
- Traffic Summary โ Current performance assessment and trajectory analysis
- Audience Demographics โ Geographic and device ecosystem breakdown
- Peak Time Detection โ Optimal posting windows based on hourly click distribution
- Growth Tactics โ Three concrete, data-driven marketing recommendations
- AI responses are cached in Redis for 30 minutes using a compound hash of analytics properties
- Cache keys incorporate click totals, unique visitors, and data dimensions to auto-invalidate when metrics change meaningfully
- If the Gemini API key is not configured, a heuristic analytics engine generates insights using statistical analysis of available data
- Heuristic results are cached for 5 minutes and provide the same structured format
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ Browser 1 โ โ Browser 2 โ โ Browser N โ
โ Dashboard โ โ LinkDetail โ โ Campaign โ
โโโโโโโโฌโโโโโโโ โโโโโโโโฌโโโโโโโ โโโโโโโโฌโโโโโโโ
โ โ โ
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโ
โ WebSocket
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Socket.IO Server โ
โ โ
โ Rooms: โ
โ โข link:{linkId} โ
โ โข campaign:{campId} โ
โ โ
โ Events: โ
โ โข click_registered โ
โ โข active_visitors โ
โ โข join_link โ
โ โข join_campaign โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโผโโโโโโโโโโโโโ
โ Redis Pub/Sub Adapter โ
โ (Horizontal Scaling) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
| Event | Direction | Description |
|---|---|---|
click_registered |
Server โ Client | New click telemetry data broadcast |
active_visitors |
Server โ Client | Updated global connected user count |
join_link |
Client โ Server | Subscribe to a specific link's room |
join_campaign |
Client โ Server | Subscribe to a campaign's room |
- The
@socket.io/redis-adapterenables multi-instance deployment where Socket.IO events sync across distributed server containers via Redis Pub/Sub
- GeoIP Dashboard Maps โ Interactive world map visualization of visitor locations
- AI Anomaly Detection โ Automated alerts for suspicious traffic spikes or bot activity
- CDN Edge Caching โ Cloudflare Workers for sub-millisecond global redirections
- Team Workspaces โ Multi-user organizations with shared link management
- Webhook Integrations โ Real-time click notifications to Slack, Discord, and custom endpoints
- A/B Link Testing โ Split traffic between destination URLs with statistical analysis
- Custom Domains โ Branded short domains with automatic SSL provisioning
- Link Scheduling โ Publish links at specific future dates/times
- Advanced API Rate Tiers โ Usage-based API plans with quota management
Naresh Kamarthy
MERN Stack Developer โข AI Systems Engineer โข React.js Developer
This project is licensed under the MIT License โ see the LICENSE file for details.
Built with โค๏ธ and โ by Naresh Kamarthy
If you found this project useful, consider giving it a โญ on GitHub!




