ScoreStream is a real-time, scalable application designed to evaluate and rank sales leads based on their interactions. Built with an Event-Driven Architecture, it ensures high performance, idempotency, and immediate feedback via WebSockets.
- Event-Driven Core: Decoupled processing using BullMQ and Redis.
- Real-Time Updates: Live score changes pushed to the frontend via Socket.IO.
- Dynamic Scoring Rules: Configure points for events (e.g., Email Open = +5, Purchase = +100) on the fly.
- Idempotency & Ordering: Guarantees unique event processing and handles out-of-order delivery.
- Score Cap & Decay: Implements a hard score cap (1000) and automatic time-based decay for inactive leads (Bonus).
- Analytics: Visual score trends, full event audit history, and CSV export.
- Backend: Node.js, Express.js
- Database: MongoDB (Mongoose)
- Queue System: BullMQ, Redis
- Real-Time: Socket.IO
- Frontend: React, Vite, Recharts, CSS Modules (Glassmorphism UI)
- Testing: Jest, Supertest
- Node.js (v16+)
- MongoDB (Running locally on 27017)
- Redis (Running locally on 6379)
-
Clone the repository
git clone https://github.com/Archisman-NC/ScoreStream.git cd ScoreStream -
Backend Setup
cd backend npm install # Create .env (Optional, defaults provided in code) # PORT=5001 # MONGO_URI=mongodb://localhost:27017/scorestream # REDIS_HOST=localhost # Start Server (Development) npm run dev
-
Frontend Setup
cd ../frontend npm install npm run dev -
Access the App Open http://localhost:5173 in your browser.
The project includes a comprehensive Unit and Integration test suite.
cd backend
npm test| Method | Endpoint | Description |
|---|---|---|
POST |
/api/events/manual |
Submit a single event (Real-time). |
POST |
/api/events/webhook |
High-throughput webhook ingestion. |
POST |
/api/events/batch |
Upload CSV/JSON batch files. |
GET |
/api/leads |
Retrieve all leads. |
GET |
/api/leads/leaderboard |
Get top leads sorted by score. |
PUT |
/api/scoring-rules |
Update scoring logic. |
GET |
/api/utils/export/leads |
Download Leads CSV. |
- Score Decay: A background worker runs every minute to deduct points from inactive leads.
- CSV Export: One-click data export from the Dashboard.
- Negative Scores: Fully supported in the scoring rules engine.
This project is licensed under the MIT License.