A secure, flexible, and auditable payout automation platform for EdTech mentors and administrators.
As EdTech platforms scale, managing mentor payouts across diverse session types and time zones becomes complex. PayoutPilot automates the entire workflow:
- Collect session data (manual or CSV uploads)
- Calculate custom payout breakdowns with fees, taxes, and deductions
- Generate and share receipts
- Provide a secure chat (human & AI modes)
- Maintain full audit logs
This full-stack app uses Next.js and Tailwind CSS on the frontend, and Node.js/Express, MongoDB, Firebase Admin, Socket.io, and OpenAI on the backend.
- Download/open video demo
- (If your browser supports it, you may also run/embed locally with
<video controls src="screenshots/4.mp4"></video>)
- Responsive UI with Tailwind CSS & DaisyUI themes
- Firebase Authentication (Email/password, Google OAuth)
- Role-based access (Admin vs. Mentor)
- Persistent sessions & token refresh
- Dashboard: Metrics cards & interactive charts
- Sessions: Manual entry & CSV upload
- Payouts: Filter, date ranges, export CSV
- Receipts: Generate, filter, search, download PDF
- Mentors: List, add/edit via modal, toggle active/inactive, delete
- Chat: Real-time WebSocket chat & AI assistant mode
- Audit Logs: View change history
- Simulation Mode: Dry runs before live payouts
- Exports: CSV downloads & webhook hooks
- Settings: Platform configurations
- Dashboard: Personal stats, charts, insights
- Sessions: History & clickable details
- Receipts: Downloadable receipts list
- Chat: Choosable Human vs. AI assistant
- Notifications: System alerts
- Earnings: Detailed breakdown & trends
- Profile & Settings: Edit profile, change password, preferences
- Request Payout: Submit manual payout requests
| Layer | Technology |
|---|---|
| Frontend | Next.js 14 • React • Tailwind CSS • DaisyUI |
| Backend | Node.js • Express • Socket.io |
| Database | MongoDB • Mongoose |
| Authentication | Firebase Auth • Firebase Admin SDK |
| AI Chat | OpenAI API |
| DevTools & Utilities | ESBuild, Prettier, ESLint |
/web # Next.js frontend
├─ app # App Router pages
│ ├─ admin # Admin layouts & pages
│ ├─ mentor # Mentor layouts & pages
│ ├─ api # Edge / API routes (OpenAI chat)
│ ├─ login/page.tsx
│ ├─ register/page.tsx
│ └─ layout.tsx # Root layout
├─ src
│ ├─ components # Reusable components (Header, Sidebar, Modal…)
│ ├─ lib
│ │ ├─ firebaseClient.ts # Client-side auth hooks
│ │ └─ firebaseAdmin.ts # Server-side auth
│ └─ styles # globals.css
│
/api # Express + Socket.io + REST API
├─ src
│ ├─ routers # auth.js, chat.js,
│ ├─ models # Mongoose schemas
│ ├─ lib # Firebase Admin setup, OpenAI config
│ └─ index.js # Server entrypoint
├─ serviceAccountKey.json # Firebase Admin credentials
└─ .env # env vars
- Node.js v18+ (or latest LTS)
- npm or Yarn
- MongoDB Atlas or local instance
- Firebase project with Auth enabled & Web SDK config
- OpenAI API key
git clone https://github.com/your-org/payoutpilot.git
cd payoutpilotCopy and rename .env.example to .env in both /web and /api directories, filling in your keys:
# /web/.env
NEXT_PUBLIC_FIREBASE_API_KEY=...
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=...
NEXT_PUBLIC_FIREBASE_PROJECT_ID=...
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=...
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=...
NEXT_PUBLIC_FIREBASE_APP_ID=...
NEXT_PUBLIC_ADMIN_EMAIL=admin@yourdomain.com
NEXT_PUBLIC_SOCKET_URL=http://localhost:4000
# /api/.env
MONGODB_URI=mongodb+srv://...
CLIENT_ORIGIN=http://localhost:3000
OPENAI_API_KEY=sk-...Place serviceAccountKey.json (downloaded from Firebase Console) into /api/src/.
# in root
yarn # or npm install
# or install individually
yarn workspace web install
yarn workspace api install# Start backend (port 4000)
cd api && npm run dev
# In new terminal, start frontend (port 3000)
cd web && npm run devNavigate to http://localhost:3000.
- Register:
/registerallows new Admin, EdTech Admin, or Mentor sign-up. - Login:
/loginwith email/password or Google OAuth. - Role-based redirects to
/admin/dashboardor/mentor/dashboard. - Protected routes via custom middleware on both client & server.
Access via /admin:
- Dashboard: Key metrics & charts
- Sessions: Add/edit sessions, CSV upload
- Payouts: View/filter payouts, export CSV
- Receipts: Generate/download PDFs
- Mentors: CRUD mentors with modal dialogues
- Chat: Real-time chat (Human & AI)
- Audit Logs: View historical changes
- Simulation: Dry-run mode
- Exports: CSV export & webhooks
- Settings: Platform-level config
Access via /mentor:
- Dashboard: Personal stats & insights
- Sessions: History with filters
- Receipts: Downloadable PDF receipts
- Chat: Switch between AI assistant & Admin
- Notifications: Alerts & updates
- Earnings: Detailed payout analysis
- Profile & Settings: Manage account
- Request Payout: Submit custom requests
- Socket.io for bidirectional messaging
- Human Chat: Direct admin <→ mentor communication
- AI Mode: Integration with OpenAI GPT for instant responses
- Toggle UI: Pills to switch between modes
- Typing Indicator: Loader until AI reply
| Route | Method | Description |
|---|---|---|
/auth/register |
POST | Persist Firebase ID token & role |
/auth/login |
-- | Handled client-side by Firebase |
/chat |
POST | OpenAI conversational AI gateway |
| Socket.io events | emit/on | mentorMessage, adminMessage, aiMessage |
- Feature Branch:
git checkout -b feat/your-feature - Lint & Format: ESLint, Prettier run pre-commit
- Push & PR: Review & merge
- Testing: Add unit/ integration tests as needed
- Frontend: Vercel or Netlify (Next.js optimized)
- Backend: Render, Vercel
- Environment vars set in host
- MongoDB Atlas for production
Contributions are welcome! Please open issues or pull requests for bug fixes and feature suggestions.
This project is licensed under the Masai License. See LICENSE for details.
- Frontend Repo: https://github.com/yourusername/payoutpilot-frontend
- Backend Repo: https://github.com/yourusername/payoutpilot-backend

