Skip to content

kajal19803/AgentManagement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

βœ… Project Title: CSTech Admin Panel – Agent Management and CSV Distribution (MERN Stack)

🎯 Objective
To build a secure and scalable MERN stack admin panel that allows:
Admin login with CSRF protection
Agent creation, management, soft deletion & restoration
Upload and structured distribution of contact lists from CSV/XLSX files
Full login analytics and geoIP tracking
Dark/light mode and branded dashboard UI

βš™οΈ Implemented Features

πŸ” 1. Admin Authentication

  • Secure login using Email & Password
  • CSRF token protection with SameSite cookie handling
  • JWT stored in HttpOnly cookies
  • Rate limiting to prevent brute-force
  • Location-based login alerts sent on new IP
  • Protected routes via middleware (auth, isAdmin)
  • Logout and current user fetch (/me)
  • Login history analytics (/login-analytics)

πŸ‘₯ 2. Agent Management

  • Create agent with: Name, Email, Mobile Number, Country Code, Password
  • Strict validations (e.g., password strength, mobile format based on country)
  • Soft delete an agent
  • Restore a deleted agent
  • Search, pagination, and inclusion of deleted agents
  • Clear feedback messages on success/error

πŸ“ 3. CSV/XLSX Upload & Distribution

  • Upload files: .csv, .xlsx, .xls (max 5MB)
  • Client-side & server-side file format validation
  • Data must include: FirstName, Phone, Notes
  • Tasks distributed evenly among 5 agents
  • Remainders handled sequentially
  • Data saved in MongoDB under timestamped batches
  • History of uploaded batches retrievable with pagination, search, filters
  • Each agent’s share displayed clearly

πŸŒ™ 4. Dark/Light Mode Toggle

  • Global ThemeContext via React
  • Toggle on Login & Dashboard pages
  • Tailwind darkMode: 'class' setup
  • Smooth transition animation

πŸ–ΌοΈ 5. Branding & UI Polish

  • Custom CSTech favicon and page title
  • Removed default React branding
  • Responsive layout and smooth UI interactions
  • Alerts and modals (e.g., file validation, confirm deletion)

πŸ› οΈ Tech Stack

Layer Technology
Frontend React.js + TailwindCSS
Backend Node.js + Express.js
Database MongoDB (Mongoose)
Auth JWT + HttpOnly Cookies
Upload Multer + Express Validator
Security Helmet, mongoSanitize, Rate Limit, CSRF
Analytics IP-based login history, location detection

πŸ§ͺ Tested Scenarios
βœ… Invalid login: shows proper message
βœ… Invalid email/password: handled
βœ… New IP: triggers geoIP email alert
βœ… Token tampering: access denied
βœ… Upload invalid file: error shown
βœ… File > 5MB: upload rejected
βœ… Less than 5 agents: distribution still succeeds
βœ… Agent with duplicate email: error shown
βœ… Restore deleted agent: success confirmed
βœ… Dark/light mode persists across pages

πŸ“ How to Run Locally

πŸ”„ Backend
cd backend
npm install
npm run dev πŸ’» Frontend

cd frontend
npm install
npm start
πŸ“ .env File (backend)

env Copy Edit PORT=5000
MONGO_URI=your_mongo_uri
JWT_SECRET=your_secret
NODE_ENV=development

About

A secure MERN stack admin panel built for managing agents and distributing CSV/XLSX data among them.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors