ChurnGuard is an automated notification-based system that detects inactive users and sends personalized engagement messages (Email, SMS, or Push). It helps businesses retain users by analyzing engagement metrics and recommending personalized retention strategies.
- Zomato – Push notifications for inactive users.
- Spotify – Personalized emails to re-engage users.
- Amazon – Cart reminders to boost conversions.
✅ Tracks user activity – Clicks, time spent, last visit, pages viewed, and interaction score.
✅ Identifies at-risk users – Users with Interaction Score < 0.5 and inactive for 3+ days.
✅ Sends personalized notifications – Automated retention messages via Email, SMS, or Push.
✅ Machine Learning Integration – Predicts interaction scores based on past user behavior.
✅ Admin Dashboard – Visual representation of user engagement using charts and tables.
hardiklovestech-churnguard/
├── app/
│ ├── api/ # API routes for user engagement & notifications
│ │ ├── send-notification/route.ts # Handles notification sending
│ │ ├── users/route.ts # Fetches all users
│ │ ├── users/at-risk/route.ts # Fetches at-risk users
│ ├── notifications/page.tsx # Displays notification history
│ ├── settings/page.tsx # User engagement settings page
│ ├── users/
│ │ ├── page.tsx # Displays all users
│ │ ├── at-risk/page.tsx # Displays at-risk users
│ ├── layout.tsx # Main layout component
│ ├── page.tsx # Dashboard homepage
├── components/
│ ├── overview.tsx # User engagement dashboard
│ ├── churn-risk-chart.tsx # Churn prediction visualization
│ ├── at-risk-users.tsx # Displays at-risk users in dashboard
│ ├── notification-settings.tsx # Notification settings UI
│ ├── user-table.tsx # User data table
│ ├── theme-provider.tsx # Manages dark/light mode
├── lib/
│ ├── MOCK_DATA.csv # Sample user engagement dataset
│ ├── churn-detection.ts # Churn risk analysis logic
│ ├── ml-churn-prediction.ts # ML model for interaction score
│ ├── ml_model_Logistic.ts # Logistic regression ML model
│ ├── ml_model_logistic_python_code.py # Python ML model
├── styles/globals.css # Global CSS styles
├── next.config.mjs # Next.js configuration
├── tailwind.config.ts # Tailwind CSS setup
├── tsconfig.json # TypeScript configuration
├── package.json # Project dependencies
└── README.md # Project documentationgit clone https://github.com/hardiklovestech/churnguard.git
cd churnguardpnpm install # Or use npm installCreate a .env file and add your MongoDB, SMTP, and other credentials:
MONGODB_URI="your-mongodb-connection-string"
SMTP_SERVER="your-email-server"
TWILIO_SID="your-twilio-sid"
TWILIO_AUTH_TOKEN="your-twilio-auth-token"pnpm dev # Or npm run dev| Method | Endpoint | Description |
|---|---|---|
GET |
/api/users |
Fetch all users |
GET |
/api/users/at-risk |
Fetch at-risk users |
POST |
/api/send-notification |
Send personalized notifications |
- User Engagement Overview – Visualize user activity trends.
- Churn Prediction Graphs – Predict and display churn risk.
- Notification History – View sent engagement messages.
- At-Risk User Table – See users who are likely to leave.
The project includes a Logistic Regression ML model to predict user interaction scores and classify at-risk users. The model is implemented in:
ml_model_logistic_python_code.py(Python)ml_model_Logistic.ts(TypeScript for Next.js)
✅ Add support for WhatsApp notifications
✅ Implement A/B Testing for message effectiveness
✅ Improve ML model with deep learning
✅ Deploy on Vercel or AWS
- Fork the repository 🍴
- Create a new branch (
git checkout -b feature-branch) - Commit changes (
git commit -m "Added feature") - Push to the branch (
git push origin feature-branch) - Open a pull request 🔥
This project is licensed under the MIT License.
🔥 Built with ❤️ by Hardik & Team