A premium, real-time Sales CRM dashboard built with Next.js, Tailwind CSS v4, and Socket.io. This application provides a high-performance interface for lead ingestion, sales team management, and automated lead assignment with manual overrides.
- Real-Time Dashboard: Live stats and activity feed powered by WebSockets (Socket.io).
- Pure API Architecture: No dummy data; all leads and callers are fetched from the PostgreSQL backend.
- Dual Assignment System:
- Automated: Backend automatically assigns leads on ingestion based on state matching and caller capacity.
- Manual Override: Managers can manually assign or reassign any lead directly from the dashboard.
- Enhanced Lead Tracking: Detailed leads table with real-time status updates and unassigned lead monitoring.
- Glassmorphism Design: Sleek, modern dark-themed UI with subtle animations (Framer Motion) and premium glows.
-
Install dependencies:
npm install
-
Configure environment: Create a
.env.localfile with:NEXT_PUBLIC_API_URL=http://localhost:5000/api NEXT_PUBLIC_SOCKET_URL=http://localhost:5000 NEXT_PUBLIC_API_KEY=your_secret_api_key
The frontend is now configured to interact with the backend's protected management routes. An x-api-key header is automatically attached to all requests via the central Axios instance (src/lib/api.ts).
The dashboard and lead processing logic are aligned with India Standard Time (IST). Lead limits and daily counts reset at 00:00 IST to match business operational hours.
Data structures have been updated to support the AssignmentHistory model, ensuring every automated and manual assignment event can be tracked for accountability.
- Run the development server:
npm run dev
page.tsx: The Dashboard. Displays real-time metrics (Total Leads, Revenue, Active Callers) and a live activity feed.leads/page.tsx: Leads Page. Comprehensive table for tracking leads with Source, City, and Manual Reassignment capabilities.callers/page.tsx: Callers Page. Manages the sales team with status indicators and daily capacity tracking.
dashboard/StatsCard.tsx: Reusable card for displaying KPIs with trends and icons.ui/ManualAssignModal.tsx: Interface for manually overriding lead assignments.ui/CallerModal.tsx: Form for adding or editing sales caller details.
useLeads.ts: Custom hook for fetching real-time lead data and handling WebSocket updates.useCallers.ts: Manages live caller statuses and capacity tracking.useLiveFeed.ts: Derives a human-readable activity feed from incoming system events.
index.ts: Centralized TypeScript interfaces forLeadandCaller, replacing legacy mock data structures.
api.ts: Axios instance for secure API communication.socket.ts: Socket.io client for real-time synchronization.
- Next.js 15: App Router architecture.
- Tailwind CSS v4: Advanced CSS-first styling.
- Framer Motion: Smooth interface transitions and micro-interactions.
- Socket.io Client: Real-time synchronization with the Sales CRM backend.
- Axios: Promised-based HTTP client for API requests.