Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ SmartLeads β€” Lead Management Dashboard

Live Demo

TypeScript React Node.js MongoDB TailwindCSS Docker Vercel Render


A full-stack Lead Management Dashboard built with the MERN stack (MongoDB, Express.js, React.js, Node.js) using TypeScript throughout. Features JWT authentication, role-based access control, advanced filtering, CSV export, and a premium glassmorphism UI.


🌐 Live Demo

Service URL
Frontend smart-lead-client.vercel.app
Backend API Hosted on Render
Database MongoDB Atlas

πŸ’‘ Test Credentials β€” Register a new account directly on the live site.


✨ Features

Core

  • JWT Authentication β€” Secure register/login with bcrypt password hashing
  • RBAC β€” Admin and Sales User roles with permission-based access
  • Lead CRUD β€” Create, Read, Update, Delete leads with validation
  • Advanced Filtering β€” Filter by status, source, search by name/email β€” all combinable
  • Backend Pagination β€” Proper skip/limit with metadata (10 per page)
  • Debounced Search β€” 400ms debounce on search input
  • CSV Export β€” Export filtered leads as CSV
  • Dark Mode β€” System-preference-aware with manual toggle

UI/UX

  • Premium glassmorphism design with gradient accents
  • Responsive layout with collapsible sidebar
  • Loading skeletons, empty states, and error handling
  • Animated transitions and micro-interactions
  • Toast notifications for all actions

πŸ—οΈ Tech Stack

Layer Technology
Frontend React 19, TypeScript, TailwindCSS v4, Vite
Backend Node.js, Express.js, TypeScript
Database MongoDB + Mongoose
Auth JWT + bcrypt
Deployment Vercel (frontend) + Render (backend) + MongoDB Atlas
DevOps Docker + Docker Compose

πŸ“ Project Structure

β”œβ”€β”€ client/                    # React Frontend (Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ common/        # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/        # Layout component
β”‚   β”‚   β”‚   └── leads/         # Lead-specific components
β”‚   β”‚   β”œβ”€β”€ context/           # Auth & Theme contexts
β”‚   β”‚   β”œβ”€β”€ hooks/             # Custom hooks (useDebounce)
β”‚   β”‚   β”œβ”€β”€ pages/             # Page components
β”‚   β”‚   β”œβ”€β”€ services/          # API service layer
β”‚   β”‚   β”œβ”€β”€ types/             # TypeScript interfaces
β”‚   β”‚   └── App.tsx
β”‚   β”œβ”€β”€ vercel.json            # SPA routing config
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── nginx.conf
β”œβ”€β”€ server/                    # Express Backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/            # Database config
β”‚   β”‚   β”œβ”€β”€ controllers/       # Route controllers
β”‚   β”‚   β”œβ”€β”€ middleware/        # Auth, RBAC, error handling
β”‚   β”‚   β”œβ”€β”€ models/            # Mongoose models
β”‚   β”‚   β”œβ”€β”€ routes/            # API routes
β”‚   β”‚   β”œβ”€β”€ types/             # TypeScript interfaces
β”‚   β”‚   β”œβ”€β”€ validators/        # Request validators
β”‚   β”‚   └── server.ts
β”‚   └── Dockerfile
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ .env.example
└── README.md

πŸš€ Local Setup

Prerequisites

  • Node.js v18+
  • MongoDB (local or Atlas)
  • npm or yarn

1. Clone the repository

git clone https://github.com/Amcodeit/smart-lead.git
cd smart-lead

2. Setup Backend

cd server
cp ../.env.example .env    # Edit with your MongoDB URI & JWT secret
npm install
npm run dev

3. Setup Frontend

cd client
npm install
npm run dev

4. Docker Setup (Alternative)

docker-compose up --build
Service URL
Frontend http://localhost:3000
Backend http://localhost:5000
MongoDB localhost:27017

☁️ Deployment

This project is deployed using a split architecture:

Part Platform Notes
Frontend Vercel Root dir: client, auto-deploys on push
Backend Render Docker-based, root dir: server
Database MongoDB Atlas Free M0 cluster

Required Environment Variables

Backend (Render):

Variable Description
PORT 5000
NODE_ENV production
MONGODB_URI MongoDB Atlas connection string
JWT_SECRET Strong random secret
JWT_EXPIRES_IN 7d
CLIENT_URL Your Vercel frontend URL

Frontend (Vercel):

Variable Description
VITE_API_URL Your Render backend URL + /api

πŸ”‘ Environment Variables (Local)

Copy .env.example and configure:

Variable Description Default
PORT Server port 5000
MONGODB_URI MongoDB connection string mongodb://localhost:27017/smart-leads
JWT_SECRET JWT signing secret (change in production!)
JWT_EXPIRES_IN Token expiration 7d
CLIENT_URL Frontend URL for CORS http://localhost:5173

πŸ“‘ API Documentation

Auth Endpoints

Method Endpoint Description Access
POST /api/auth/register Register new user Public
POST /api/auth/login Login user Public
GET /api/auth/me Get current user profile Private

Lead Endpoints

Method Endpoint Description Access
GET /api/leads Get leads (paginated, filterable) Private
GET /api/leads/:id Get single lead Private
POST /api/leads Create new lead Private
PUT /api/leads/:id Update lead Private
DELETE /api/leads/:id Delete lead Admin only
GET /api/leads/export/csv Export leads as CSV Private
GET /api/leads/stats/overview Get dashboard stats Private
GET /api/health Health check Public

Query Parameters (GET /api/leads)

Param Type Description
status string Filter: New, Contacted, Qualified, Lost
source string Filter: Website, Instagram, Referral
search string Search by name or email
sort string latest (default) or oldest
page number Page number (default: 1)
limit number Records per page (default: 10)

Response Format

{
  "success": true,
  "message": "Leads retrieved successfully.",
  "data": {
    "records": [...],
    "pagination": {
      "currentPage": 1,
      "totalPages": 5,
      "totalRecords": 48,
      "limit": 10,
      "hasNextPage": true,
      "hasPrevPage": false
    }
  }
}

πŸ‘₯ Role-Based Access

Feature Admin Sales User
View all leads βœ… ❌ (own only)
Create leads βœ… βœ…
Update leads βœ… (all) βœ… (own only)
Delete leads βœ… ❌
Export CSV βœ… βœ… (own only)
Dashboard stats βœ… (all) βœ… (own only)

πŸ› οΈ Development

# Backend (hot reload with ts-node)
cd server && npm run dev

# Frontend (Vite dev server)
cd client && npm run dev

Built with ❀️ by Amcodeit

About

Full-stack Lead Management Dashboard built with MERN stack, TypeScript, JWT auth, RBAC, and a premium glassmorphism UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages