Operations & Workflow Automation
DOPA Mentor Management Portal
Real-time mentor operations with live notifications, payments, and automated reporting.
Overview
Problem
Mentor assignments, session tracking, and payouts were coordinated manually across chats and spreadsheets, with no live visibility into status.
Solution
A real-time portal where mentor activity, payments, and reporting update live — coordinators see status change instantly, without refreshing or asking around.
Architecture
Client
Next.js UI subscribed to a live event stream for instant updates.
Realtime
Server-Sent Events (SSE) endpoint pushing state changes to clients.
Workflow
Step-based automation engine advancing sessions through defined states.
Data
MongoDB storing sessions, payment records, and reporting aggregates.
Feature Breakdown
- Live notifications on session and payment status via SSE — no polling
- Automated workflow moving sessions from scheduled to completed to paid
- Payment engine reconciling payouts against completed sessions
Implementation Detail
export async function GET() {
const stream = new ReadableStream({
start(controller) {
const unsubscribe = sessionEvents.subscribe((event) => {
controller.enqueue(`data: ${JSON.stringify(event)}\n\n`);
});
return () => unsubscribe();
},
});
return new Response(stream, {
headers: { "Content-Type": "text/event-stream" },
});
}Challenge & Solution
Coordinators needed instant status visibility, and payouts could be triggered before a session was actually verified complete.
Built an SSE endpoint streaming state changes as they're written, and modeled the mentor lifecycle as an explicit state machine so payouts only fire from a verified 'completed' state.
Results
- Session and payout status is visible the instant it changes, replacing manual chat check-ins.
- A payout can no longer be triggered for a session that wasn't verified complete.