Skip to content

ashish-code6/CRM-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

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

Repository files navigation

πŸš€ CRM System

A full-stack Customer Relationship Management (CRM) application built using React, Node.js, Express.js, PostgreSQL, and Prisma ORM.

The application helps organizations manage customer leads, assign them to sales representatives, track user activities, and monitor business performance through a secure role-based system.


πŸ“Œ Features

πŸ” Authentication

  • JWT Authentication
  • Password hashing using Bcrypt
  • Protected Routes
  • Secure Login

πŸ‘₯ Role-Based Authorization

The application supports three different user roles.

Admin

  • Create Admin, Manager, and Sales users
  • Delete users
  • Create, update, assign, and delete leads
  • Upload CSV files
  • Send test emails
  • View dashboard
  • View audit logs

Manager

  • Create Sales users
  • Create, update, and assign leads
  • Upload CSV files
  • Send test emails
  • View dashboard

Sales

  • View assigned leads
  • Update assigned lead status
  • Cannot create users
  • Cannot assign leads
  • Cannot delete leads

πŸ“‹ Lead Management

The CRM provides complete Lead Management functionality.

  • Create Lead
  • View All Leads
  • View Lead Details
  • Update Lead
  • Delete Lead
  • Assign Lead to Sales Users

πŸ“Š Dashboard

The dashboard provides real-time statistics including:

  • Total Leads
  • New Leads
  • Assigned Leads
  • Converted Leads

πŸ“§ Email Notifications

Whenever a Manager or Admin assigns a lead to a Sales user, the system automatically sends an email notification using Nodemailer.


πŸ“‚ CSV Import

Bulk lead import is supported using CSV files.

The uploaded CSV is parsed and all valid records are stored in PostgreSQL.

Expected CSV format:

name,email,phone,company

πŸ“ Audit Logs

Every important action performed in the system is stored in the Audit Log.

Logged activities include:

  • CREATE Lead
  • UPDATE Lead
  • DELETE Lead
  • ASSIGN Lead

Only Admin users can access Audit Logs.


πŸ— Tech Stack

Frontend

  • React
  • Vite
  • React Router
  • Axios
  • Tailwind CSS
  • React Hot Toast
  • Lucide React

Backend

  • Node.js
  • Express.js
  • PostgreSQL
  • Prisma ORM
  • JWT
  • Bcrypt
  • Nodemailer
  • Multer
  • CSV Parser

πŸ—„ Database Models

The application uses three main database models.

User

  • id
  • name
  • email
  • password
  • role

Lead

  • id
  • name
  • email
  • phone
  • company
  • status
  • assignedToId

AuditLog

  • id
  • action
  • entity
  • entityId
  • userId
  • createdAt

πŸ”„ Project Workflow

Admin creates users
        β”‚
        β–Ό
User Login
        β”‚
        β–Ό
JWT Authentication
        β”‚
        β–Ό
Protected API Access
        β”‚
        β–Ό
Lead Management
        β”‚
        β–Ό
Lead Assignment
        β”‚
        β–Ό
Email Notification
        β”‚
        β–Ό
Audit Log Created
        β”‚
        β–Ό
Dashboard Updated

πŸ“‚ Folder Structure

crm-system

β”œβ”€β”€ client
β”‚   β”œβ”€β”€ src
β”‚   β”œβ”€β”€ public
β”‚   └── package.json
β”‚
β”œβ”€β”€ server
β”‚   β”œβ”€β”€ prisma
β”‚   β”œβ”€β”€ src
β”‚   β”‚   β”œβ”€β”€ config
β”‚   β”‚   β”œβ”€β”€ controllers
β”‚   β”‚   β”œβ”€β”€ middleware
β”‚   β”‚   β”œβ”€β”€ routes
β”‚   β”‚   β”œβ”€β”€ utils
β”‚   β”‚   └── app.js
β”‚   └── package.json
β”‚
└── README.md

βš™ Installation

Clone Repository

git clone https://github.com/your-username/crm-system.git

Backend

cd server

npm install

npx prisma generate

npx prisma migrate dev

npm run dev

Frontend

cd client

npm install

npm run dev

πŸ”‘ Environment Variables

Frontend (.env)

VITE_API_URL=http://localhost:5000/api

πŸ“‘ API Modules

  • Authentication
  • User Management
  • Lead Management
  • Dashboard
  • CSV Upload
  • Email
  • Audit Logs

πŸš€ Future Improvements

  • Socket.IO Real-time Notifications
  • Docker Support
  • Refresh Token Authentication
  • Advanced Search & Filtering
  • Analytics Dashboard
  • Deployment

πŸ‘¨β€πŸ’» Author

Ashish Kumar

MERN Stack Developer


⭐ If you found this project useful, consider giving it a star on GitHub! for Teting API use POsTMAN image Login image Dashboard image Leads deatils image csv file and sending mail image create a user and deatils of user image Audit logs image profile image

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages