The Customer Engagement Dashboard provides insights into user activity, engagement metrics, retention, and churn risk. It includes AI-powered recommendations and filtering options for improved analysis.
Screenshots are attached in the EngageIt.pdf
Ensure you have the following installed:
- Node.js (v16+ recommended)
- MongoDB (running locally or using a cloud instance)
- TypeScript (
npm install -g typescript) - Nodemon (for development mode,
npm install -g nodemon)
-
Clone the Repository
git clone https://github.com/your-repo/customer-engagement-dashboard.git cd customer-engagement-dashboard -
Install Dependencies
npm install
-
Set Up Environment Variables Create a
.envfile in the project root and configure the following:MONGO_URI=mongodb://localhost:27017/customer-engagement PORT=5000 AI_API_KEY=your-ai-api-key
-
Build the Project
npm run build
-
Run the Project
- Development Mode (auto-restart on file changes)
npm run dev
- Production Mode
npm run start
- Development Mode (auto-restart on file changes)
-
Database Seeding (Optional: Populate database with mock data)
npm run mock-seed
| Script | Description |
|---|---|
npm run dev |
Starts the server in development mode with Nodemon |
npm run start |
Starts the server in production mode |
npm run build |
Compiles TypeScript to JavaScript |
npm run seed |
Seeds the database with predefined data |
npm run generate-mock |
Generates mock data for testing |
npm run mock-seed |
Generates and seeds mock data |
http://localhost:PORT/api/user
Endpoint:
GET /api/user/processed-data
Description:
Retrieves pre-processed user engagement data stored in processedData.json. This includes calculated engagement scores, churn risk, retention category, and AI-generated individual and collective recommendations.
Response:
{
"overviewMetrics": {
"dailyActiveUsers": 0,
"weeklyActiveUsers": 9,
"monthlyActiveUsers": 38,
"retentionRate": 13,
"collectiveEngagementScore": 29,
"churnPredictionList": [
{
"id": 1,
"name": "User 1",
"email": "user1@email.com",
"last_login_date": "2024-12-26",
"engagementScore": 31,
"retentionCategory": "Low",
"churnRisk": true,
"aiRecommendation": "Personalized Onboarding Session, Incentivized Feature Exploration, Regular Check-Ins."
}
]
}
}Errors:
500 Internal Server Error: If processed data cannot be read.
Endpoint:
GET /api/user/getUsers
Description:
Fetches all users along with calculated engagement metrics, retention categories, churn risk, and AI-generated recommendations. The response is enriched with insights based on user activity from initialData.json.
Response:
{
"overviewMetrics": {
"dailyActiveUsers": 0,
"weeklyActiveUsers": 9,
"monthlyActiveUsers": 38,
"retentionRate": 13,
"collectiveEngagementScore": 29,
"churnPredictionList": [
{
"id": 1,
"name": "User 1",
"email": "user1@email.com",
"last_login_date": "2024-12-26",
"engagementScore": 31,
"retentionCategory": "Low",
"churnRisk": true,
"aiRecommendation": "Personalized Onboarding Session, Incentivized Feature Exploration, Regular Check-Ins."
}
]
},
"users": [
{
"id": 1,
"name": "User 1",
"email": "user1@email.com",
"last_login_date": "2024-12-26",
"number_of_logins": 152,
"number_of_features_used": 2,
"time_spent_on_platform": 487,
"features_used": ["Feature N", "Feature N", "Feature R"],
"engagementScore": 31,
"retentionCategory": "Low",
"churnRisk": true,
"aiRecommendation": "Personalized Onboarding Session, Incentivized Feature Exploration, Regular Check-Ins."
}
]
}Errors:
500 Internal Server Error: If there is an issue fetching user data.
engagementScore = (logins * 0.2) + (featuresUsed * 0.3) + (recencyScore * 0.5)- Score capped between
0and100.
- Users who haven't logged in for 30+ days and have engagementScore < 40 are marked as at-risk.
High→ Engagement Score > 70Medium→ Engagement Score > 40Low→ Engagement Score <= 40
- AI-generated recommendations are based on engagement scores, feature usage, and churn risk analysis.
| Error Code | Meaning |
|---|---|
| 500 | Internal Server Error |
| 404 | Resource Not Found (if applicable) |
Feel free to open issues or submit pull requests to enhance the dashboard.
This project is licensed under the MIT License.