Skip to content

srivathsav999/crm-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CRM Integration System

A modern, full-stack Customer Relationship Management (CRM) system built with Node.js, MongoDB, and React. This system allows you to efficiently manage leads and contacts with a clean, intuitive interface.

✨ Features

Lead Management

  • βœ… Complete Lead Lifecycle: Track leads from initial contact to conversion
  • βœ… Advanced Search & Filtering: Find leads by name, company, status, or source
  • βœ… Lead Sources Tracking: Monitor where your leads come from
  • βœ… Priority Management: Set and track lead priorities
  • βœ… Sales Pipeline: Track estimated values and probabilities
  • βœ… Follow-up Scheduling: Set next follow-up dates
  • βœ… Bulk Import: Import multiple leads at once

Contact Management

  • βœ… Customer Database: Manage existing customers and prospects
  • βœ… Company Information: Track job titles, departments, and company details
  • βœ… Contact Types: Categorize as customers, prospects, vendors, or partners
  • βœ… Account Management: Assign account managers to contacts

Dashboard & Analytics

  • βœ… Real-time Statistics: View lead counts, pipeline value, and conversion rates
  • βœ… Source Analytics: See which channels generate the most leads
  • βœ… Recent Activity: Quick overview of new leads and updates
  • βœ… Performance Metrics: Track your CRM performance

Technical Features

  • βœ… Modern UI: Clean, responsive design with smooth interactions
  • βœ… Real-time Updates: Live data updates across the application
  • βœ… Data Validation: Comprehensive input validation and error handling
  • βœ… Search & Pagination: Efficient data browsing for large datasets
  • βœ… API Documentation: RESTful API with proper error responses

πŸ› οΈ Tech Stack

Backend:

  • Node.js with Express.js
  • MongoDB with Mongoose ODM
  • Joi for data validation
  • CORS, Helmet for security
  • Rate limiting for API protection

Frontend:

  • React 18 with modern hooks
  • React Router for navigation
  • React Query for state management
  • React Hook Form for form handling
  • Lucide React for icons
  • Custom CSS with modern design

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (local installation or cloud instance)
  • Git

Installation

  1. Clone the repository

    git clone <your-repo-url>
    cd CRM
  2. Install dependencies

    # Install root dependencies and all sub-dependencies
    npm run install:all
  3. Set up environment variables

    # Copy the example environment file
    cp server/.env.example server/.env
    
    # Edit the .env file with your MongoDB connection string
    # Default: MONGODB_URI=mongodb://localhost:27017/crm_database
  4. Start MongoDB

    • If using local MongoDB: mongod
    • If using MongoDB Atlas: Ensure your connection string is in .env
  5. Run the application

    # Development mode (runs both client and server)
    npm run dev
  6. Access the application

πŸ“ Project Structure

CRM/
β”œβ”€β”€ package.json                 # Root package.json with scripts
β”œβ”€β”€ README.md                   # This file
β”œβ”€β”€ server/                     # Backend Node.js application
β”‚   β”œβ”€β”€ package.json           # Server dependencies
β”‚   β”œβ”€β”€ index.js               # Main server file
β”‚   β”œβ”€β”€ models/                # MongoDB models
β”‚   β”‚   β”œβ”€β”€ Lead.js           # Lead model
β”‚   β”‚   └── Contact.js        # Contact model
β”‚   β”œβ”€β”€ routes/               # API routes
β”‚   β”‚   β”œβ”€β”€ leads.js          # Lead endpoints
β”‚   β”‚   β”œβ”€β”€ contacts.js       # Contact endpoints
β”‚   β”‚   └── pipeline.js       # Pipeline analytics
β”‚   └── .env.example          # Environment variables template
└── client/                   # Frontend React application
    β”œβ”€β”€ package.json          # Client dependencies
    β”œβ”€β”€ public/
    β”‚   └── index.html        # Main HTML file
    └── src/
        β”œβ”€β”€ App.js            # Main App component
        β”œβ”€β”€ App.css           # Global styles
        β”œβ”€β”€ index.js          # React entry point
        β”œβ”€β”€ components/       # Reusable components
        β”‚   └── Layout.js     # Main layout with sidebar
        β”œβ”€β”€ pages/            # Page components
        β”‚   β”œβ”€β”€ Dashboard.js  # Dashboard with statistics
        β”‚   β”œβ”€β”€ Leads.js      # Lead listing page
        β”‚   β”œβ”€β”€ LeadForm.js   # Lead create/edit form
        β”‚   β”œβ”€β”€ Contacts.js   # Contact listing page
        β”‚   └── ContactForm.js # Contact create/edit form
        └── utils/
            └── api.js        # Axios API configuration

πŸ”— API Endpoints

Leads API

  • GET /api/leads - Get all leads (with pagination, search, filtering)
  • GET /api/leads/:id - Get specific lead
  • POST /api/leads - Create new lead
  • PUT /api/leads/:id - Update lead
  • DELETE /api/leads/:id - Delete lead (soft delete)
  • POST /api/leads/bulk - Bulk import leads
  • GET /api/leads/stats/summary - Get lead statistics

Contacts API

  • GET /api/contacts - Get all contacts
  • GET /api/contacts/:id - Get specific contact
  • POST /api/contacts - Create new contact
  • PUT /api/contacts/:id - Update contact
  • DELETE /api/contacts/:id - Delete contact

Pipeline API

  • GET /api/pipeline - Get pipeline overview

Health Check

  • GET /api/health - Server health status

πŸ’‘ Usage Examples

Adding a Lead via API

curl -X POST http://localhost:5000/api/leads \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "company": "Acme Corp",
    "source": "website",
    "status": "new",
    "estimatedValue": 5000
  }'

Searching Leads

curl "http://localhost:5000/api/leads?search=acme&status=new&page=1&limit=10"

πŸ”§ Configuration

Environment Variables (server/.env)

PORT=5000                                          # Server port
MONGODB_URI=mongodb://localhost:27017/crm_database # MongoDB connection
NODE_ENV=development                               # Environment

Available Scripts

# Root level commands
npm run dev           # Start both client and server in development
npm run install:all   # Install all dependencies
npm run start         # Start server in production

# Server commands
npm run server:dev    # Start server with nodemon
npm run server:start  # Start server in production

# Client commands
npm run client:dev    # Start React development server
npm run client:build  # Build React for production

🎨 UI Features

  • Modern Design: Clean, professional interface with consistent styling
  • Responsive Layout: Works perfectly on desktop, tablet, and mobile
  • Dark Sidebar: Professional navigation with active state indicators
  • Status Badges: Color-coded status and priority indicators
  • Form Validation: Real-time validation with helpful error messages
  • Loading States: Smooth loading indicators and skeleton screens
  • Toast Notifications: User-friendly success and error messages
  • Empty States: Helpful guidance when no data is available

πŸ”’ Security Features

  • Rate Limiting: Prevents API abuse
  • Input Validation: Server-side validation with Joi
  • Helmet: Security headers for Express
  • CORS: Configured cross-origin resource sharing
  • Data Sanitization: Protection against injection attacks

πŸš€ Deployment

Production Build

  1. Build the React application:

    cd client && npm run build
  2. Start the server:

    cd server && npm start

Environment Setup

  • Set NODE_ENV=production in your environment
  • Use a production MongoDB instance
  • Configure proper CORS origins
  • Set up environment variables on your hosting platform

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Include error messages and steps to reproduce

🎯 Future Enhancements

  • User authentication and authorization
  • Email integration for lead communication
  • Advanced reporting and analytics
  • Task and activity management
  • Integration with external services (email marketing, etc.)
  • Mobile app development
  • Advanced pipeline management with drag-and-drop
  • Custom fields and lead scoring

Built with ❀️ for modern CRM needs

About

A modern, full-stack Customer Relationship Management (CRM) system built with Node.js, MongoDB, and React. This system allows you to efficiently manage leads and contacts with a clean, intuitive interface.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors