AI-Powered CRM System

Neeraj

Neeraj Jaiswal

Xeno CRM

A modern, AI-powered Customer Relationship Management system with advanced campaign management, intelligent customer segmentation, and real-time analytics.

πŸ—οΈ Architecture

The XENO CRM platform follows a modern, modular architecture designed for scalability and maintainability:
The architecture consists of three main tiers:
Frontend Layer: React-based UI with modular components
Backend Layer: Node.js/Express API server with RESTful endpoints
Data & External Services Layer: MongoDB database and Groq AI integration

🌟 Features

πŸ”Ή Customer Management

Comprehensive customer profiles with detailed information
Customer activity tracking and history
Advanced search and filtering capabilities
Customer tagging and categorization

πŸ”Ή Segmentation

AI-powered segment creation using natural language
Rule-based customer segmentation
Dynamic segment updates based on customer behavior
Real-time audience preview

πŸ”Ή Campaign Management

Multi-channel campaign creation
Campaign performance tracking and analytics
Automated campaign scheduling
A/B testing capabilities
Modern UI with enhanced visual elements:
Key statistics dashboard cards (total campaigns, audience, success rate, segments)
Campaign avatars and visual identifiers
Colorized segment labels with chips
Interactive progress bars for success metrics
Intuitive icon-based action buttons
Helpful empty state guidance for new users
Improved delete confirmation with safety warnings

πŸ”Ή Analytics & Reporting

Real-time dashboard with key performance indicators
Campaign success metrics and delivery statistics
Customer growth and engagement analytics
Exportable reports and data visualization

πŸ”Ή Notifications System

Real-time notifications for important events
Customizable notification preferences
Notification history and management

πŸ”Ή AI-Powered Features

Natural language segment creation
AI-generated messaging suggestions
Intelligent campaign performance insights
Automated customer behavior analysis
Predictive campaign success modeling
Content optimization recommendations
Customer engagement predictions
Churn risk identification
Personalized communication suggestions

πŸ” Security Features

Authentication & Authorization

JWT-Based Authentication
Secure Token Generation: Uses JSON Web Tokens (JWT) signed with a secure secret key
Token Structure: Contains user ID, email, and other essential claims
Token Storage: Securely stored in localStorage as 'xeno_auth_token'
Expiration: Tokens expire after 30 days for enhanced security
Authorization Flow:
Tokens are generated during login/OAuth authentication
Attached to all API requests in the Authorization header
Verified on the backend with the JWT secret
Failed verification triggers automatic logout
Authentication Middleware
Token Verification: Validates signature, expiration, and required fields
Request Context: Adds authenticated user data to request context (req.user)
Response Headers: Adds user ID to response headers (X-User-ID) for frontend validation
Comprehensive Error Handling: Different error responses for missing, invalid, or expired tokens

Multi-Tenant Data Isolation

Robust Tenant Isolation Strategy
User-Based Data Separation: All data (customers, segments, campaigns, orders) is strictly segregated by user ID
Mandatory Filtering: Every database query includes userId filters to prevent data leakage
Deep Integration: Tenant isolation enforced at every data access point:
MongoDB schemas include userId fields with appropriate indexing
Database query construction consistently applies userId filters
Complex queries (with AND/OR logic) are carefully constructed to maintain isolation
Frontend-Backend Validation
Double-Check Mechanism: Frontend validates that response data belongs to the authenticated user
Cross-Verification: User ID in JWT token is verified against user ID in response headers
Automatic Security Response: Detects and handles potential tenant isolation breaches by:
Clearing invalid tokens
Redirecting to login
Preventing display of unauthorized data
Segment & Campaign Isolation
Segmented Data Access: Users can only access and manipulate their own customer segments
Preview Protection: Audience previews and campaign targeting strictly limited to user's own customers
Logical Query Construction: Complex segment conditions combined with userId filters using MongoDB's $and and $or operators

πŸ› οΈ Technology Stack

Frontend

React.js: Modern UI framework
Material-UI: Component library for consistent design
Context API: State management
Axios: API communication
React Router: Navigation and routing
React Toastify: Notification system
Chart.js: Data visualization
React Hook Form: Form validation and handling
MUI X Data Grid: Advanced data table functionality

Backend

Node.js: JavaScript runtime
Express: Web framework
MongoDB: NoSQL database
Mongoose: MongoDB object modeling
JWT: Authentication
Groq AI: Advanced AI capabilities

πŸš€ Getting Started

Prerequisites

Node.js (v14 or higher)
npm or yarn
MongoDB (local or Atlas)
Git

Cloning the Repository

# Clone the repository
git clone https://github.com/SuccessNEERAJ/Full-Stack-CRM-Platform.git

## βš™οΈ Environment Setup

### Frontend Setup

1. Navigate to the frontend directory:
```bash
cd xeno-crm-frontend
Copy the example environment file:
cp .env.example .env
Edit the .env file and fill in your actual values:
# API Configuration
REACT_APP_API_URL=http://localhost:5000

# Application Configuration
REACT_APP_NAME=Xeno CRM

# Authentication
REACT_APP_GOOGLE_CLIENT_ID=your_google_client_id_here
REACT_APP_GOOGLE_CLIENT_SECRET=your_google_client_secret_here

# AI Services
REACT_APP_GROQ_API_KEY=your_groq_api_key_here

Backend Setup

Navigate to the backend directory:
cd xeno-crm-backend
Copy the example environment file:
cp .env.example .env
Edit the .env file and fill in your actual values:
# Server Configuration
PORT=5000
NODE_ENV=development

# Database Configuration
MONGODB_URI=mongodb://localhost:27017/xeno-crm
DB_NAME=xeno-crm

# JWT Authentication
JWT_SECRET=your_jwt_secret_here
JWT_EXPIRES_IN=1d

# CORS Configuration
CORS_ORIGIN=http://localhost:3000

# Email Service (if applicable)
EMAIL_SERVICE=gmail
EMAIL_USER=your_email@gmail.com
EMAIL_PASSWORD=your_app_password_here
EMAIL_FROM=your_email@gmail.com

# AI Services - Groq API Keys
GROQ_API_KEY_SEGMENT_RULES=your_segment_rules_groq_api_key_here
GROQ_API_KEY_MESSAGE_SUGGESTIONS=your_message_suggestions_groq_api_key_here
GROQ_API_KEY_CAMPAIGN_SUMMARY=your_campaign_summary_groq_api_key_here

πŸ“¦ Installation & Running

Frontend

# Navigate to frontend directory
cd xeno-crm-frontend

# Install dependencies
npm install

# Start development server
npm start
The frontend will be available at http://localhost:3000

Development Build

# Build for production
npm run build

# Run the production build locally
serve -s build

Backend

# Navigate to backend directory
cd xeno-crm-backend

# Install dependencies
npm install

# Start development server
npm start
The API will be available at http://localhost:5000

πŸ”„ API Endpoints

Authentication

POST /api/auth/login - User login
POST /api/auth/register - User registration
GET /api/auth/me - Get current user
POST /api/auth/refresh-token - Refresh access token
POST /api/auth/forgot-password - Initiate password reset
POST /api/auth/reset-password - Complete password reset

Customers

GET /api/customers - Get all customers
GET /api/customers/:id - Get customer by ID
POST /api/customers - Create new customer
PUT /api/customers/:id - Update customer
DELETE /api/customers/:id - Delete customer

Segments

GET /api/segments - Get all segments
GET /api/segments/:id - Get segment by ID
GET /api/segments/:id/audience - Get segment audience
POST /api/segments - Create new segment
POST /api/segments/preview - Preview segment audience
PUT /api/segments/:id - Update segment
DELETE /api/segments/:id - Delete segment

Campaigns

GET /api/campaigns - Get all campaigns
GET /api/campaigns/:id - Get campaign by ID
POST /api/campaigns - Create new campaign
PUT /api/campaigns/:id - Update campaign
DELETE /api/campaigns/:id - Delete campaign
GET /api/campaigns/stats - Get campaign statistics
GET /api/campaigns/:id/analytics - Get detailed campaign analytics
POST /api/campaigns/:id/duplicate - Duplicate existing campaign
PUT /api/campaigns/:id/status - Update campaign status

🧠 AI Integration

Xeno CRM leverages Groq's powerful AI capabilities for several key features:

1. Natural Language Segment Creation

Users can describe their target audience in plain English, and the AI will convert it into segment rules.
Example: "Customers who spent more than 10000 AND their visits count is less than 3" gets converted to appropriate database queries.

2. Campaign Message Suggestions

AI generates personalized message templates based on campaign goals and target audience.

3. Performance Insights

AI analyzes campaign performance and provides actionable insights to improve future campaigns.

4. Customer Behavior Analysis

AI identifies patterns and trends in customer behavior to inform segmentation strategies.

5. Content Optimization

AI provides recommendations for optimizing campaign content based on historical performance data.

6. Predictive Analytics

AI forecasts campaign performance and customer engagement metrics to guide marketing strategy.

πŸ”’ Security

JWT Authentication: Secure user authentication
Environment Variables: All sensitive information stored in .env files
API Key Protection: Groq API keys and other credentials secured
Input Validation: Protection against malicious inputs
CORS Configuration: Controlled access to API endpoints

⚠️ Known Limitations & Assumptions

Browser Compatibility

Optimized for modern browsers (Chrome, Firefox, Safari, Edge)
Limited support for Internet Explorer 11 and below
Not fully responsive; optimized for desktop and tablet views (minimum 768px width)

AI Integration

Groq API has rate limits that may affect heavy usage scenarios
AI predictions are probabilistic and not guaranteed to be 100% accurate
Large language model responses may occasionally contain irrelevant suggestions

Performance

System is designed for up to 100,000 customers and 10,000 campaigns
Dashboard performance may degrade with extremely large datasets
Recommended maximum file upload size: 10MB

Data & Privacy

User data is stored according to the privacy policy and local regulations
Assumes compliance with GDPR, CCPA, and similar regulations for user implementations
No built-in data residency controls for specific geographic requirements

Connectivity

Requires stable internet connection for AI features
Offline functionality is limited to basic viewing of cached data

Localization

Primary language support for English
Limited localization for other languages
Date formats default to MM/DD/YYYY unless configured otherwise

πŸ§ͺ Testing

# Run frontend tests
cd xeno-crm-frontend
npm test

# Run backend tests
cd xeno-crm-backend
npm test

πŸ“ Contributing

Fork the repository
Create your feature branch (git checkout -b feature/amazing-feature)
Commit your changes (git commit -m 'Add some amazing feature')
Push to the branch (git push origin feature/amazing-feature)
Open a Pull Request

πŸ“„ License

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

πŸ‘₯ Team

Neeraj Jaiswal - Lead Developer - GitHub Profile

πŸ™ Acknowledgements

Material-UI for the UI components
Groq AI for AI capabilities
MongoDB for database services
React for the frontend framework
Like this project

Posted Jul 6, 2025

Developed an AI-powered Customer Relations Management System with advanced features.

Likes

0

Views

0

Timeline

May 31, 2025 - Jun 5, 2025

Clients

Xeno