Loading…
Loading…
Coffee Tea is a production-focused software project built by Sadam Hussain using Next.js, TypeScript, Tailwind CSS, and related technologies.
Live interview coaching with human mentors over WebRTC: Firestore signaling, STUN/TURN fallback, Stripe booking, structured feedback dashboards. Human mentors: real video coaching with experienced interviewers. Outcome: production-grade real-time video that recovers instead of dropping.
Tech Stack


Status
Production Ready
Type
Enterprise platform
Architected a virtual interview preparation platform using Next.js and TypeScript, building a synchronous video session system that maintains stable peer-to-peer connections through WebRTC with Firebase-based signaling.
Implemented WebRTC peer connection management including ICE candidate exchange via Firestore, STUN/TURN server configuration for NAT traversal, and automatic fallback to relay mode when direct peer-to-peer connections fail.
Built real-time mentor matching and availability logic using Firestore's real-time listeners and Cloud Functions triggers, enabling candidates to discover available mentors, view their specializations, and book sessions that reflect live availability state.
Designed and implemented end-to-end Stripe payment flows - session pricing display, secure checkout with Stripe Elements, payment intent creation via Cloud Functions, and webhook-based confirmation that triggers session scheduling.
Developed a motion-rich, anxiety-reducing UI with Tailwind CSS and Framer Motion, using purposeful animations (smooth page transitions, gentle loading states, encouraging progress indicators) to create a coaching atmosphere rather than a testing environment.
Built post-session feedback and progress tracking dashboards where mentors submit structured evaluations and candidates track improvement across sessions with visual performance trends.
Leveraged Firebase Cloud Functions for serverless backend logic - Stripe webhook handling, session reminder notifications, mentor payout calculations, and scheduled cleanup of expired session offers.
Optimized WebRTC session reliability through connection health monitoring, automatic ICE restart on connectivity degradation, and graceful UI state management that keeps users informed of connection quality during live sessions.
Implemented session scheduling with timezone-aware booking that handles mentor availability windows, candidate time preferences, and automatic conflict detection for overlapping session requests.
Built a responsive, cross-device experience with mobile-optimized video layouts, adaptive grid systems for mentor browsing, and touch-friendly session controls for candidates joining from phones or tablets.
Coffee Tea is live interview coaching with human mentors, not an AI. Candidates book real video sessions, practice under realistic pressure, and get structured feedback after each one. WebRTC carries the media with STUN/TURN fallback and automatic reconnection; Firestore handles signaling and availability; Stripe handles booking and payout. The difference from Preplify: a person on the other side.
The product addresses a specific gap in interview preparation: static question banks and recorded content can't replicate the pressure, pacing, and interpersonal dynamics of a real interview. Coffee Tea creates a live coaching environment where candidates practice with experienced mentors who provide real-time feedback, structured evaluations, and longitudinal progress tracking.
A key design consideration was the psychology of the user experience. Interview preparation is inherently anxiety-inducing, and the platform's visual design and motion system are intentionally crafted to create an encouraging, professional atmosphere rather than amplifying stress.
Most interview preparation tools focus on content - question databases, answer frameworks, tips and tricks. But the actual challenge of interviewing is the live interaction: managing nerves, thinking on your feet, reading the interviewer's reactions, and maintaining composure under pressure. These skills can only be developed through practice with another person.
The core problem: Candidates can memorize answers to common questions, but they can't practice the conversational dynamics of a live interview without a live partner. Finding practice partners informally is unreliable - scheduling conflicts, inconsistent feedback quality, and no accountability.
Stakeholder perspective:
Constraints that shaped the architecture:
The architecture leverages Firebase as the "connective tissue" for real-time operations:
This architecture avoids the need for a traditional backend server for real-time operations. Firestore's real-time listeners handle the signaling and availability use cases that would typically require WebSocket servers, and Cloud Functions handle the event-driven server logic that would typically require an Express.js API.
Why Firebase over a custom backend: The real-time requirements (signaling, availability updates, session coordination) would require WebSocket infrastructure that needs to be highly available and low-latency. Firebase provides this out of the box with global distribution, automatic scaling, and managed infrastructure. Building equivalent real-time infrastructure from scratch would have been a significant engineering effort that diverts from the core product.
Video session reliability is the product - a dropped call during a mock interview destroys the value of the session. The connection management layer addresses the common failure modes:
NAT Traversal: Most users are behind NATs that prevent direct peer-to-peer connections. STUN servers discover the user's public IP/port mapping, enabling direct connections through common NAT types. For symmetric NATs (common in corporate networks), TURN relay servers route media through an intermediary.
Connection Recovery: Network conditions change during sessions (WiFi → cellular handoff, temporary packet loss, bandwidth fluctuation). The system monitors WebRTC connection statistics and triggers ICE restart when metrics degrade, re-establishing the optimal connection path without dropping the session.
Graceful Degradation: When bandwidth drops, the system can reduce video resolution or switch to audio-only mode rather than dropping the connection entirely. The UI communicates the current quality level so users understand any visual degradation is intentional quality management, not a malfunction.
Payment processing follows a serverless pattern:
Framer Motion animations in Coffee Tea aren't decorative - they serve specific UX functions:
The most architecturally challenging aspect of Coffee Tea is the WebRTC session management layer - establishing, maintaining, and recovering peer-to-peer video connections in the unreliable conditions of real-world internet connectivity.
The Problem: WebRTC provides the browser APIs for peer-to-peer media streaming, but it doesn't provide the infrastructure or logic for session management. The developer is responsible for signaling (how peers discover each other and exchange connection metadata), NAT traversal configuration (how to establish connections through firewalls), connection monitoring (detecting degradation before it causes visible quality issues), and recovery (re-establishing connections when they fail).
The Architecture:
Signaling Layer (Firestore-based): When a session begins, the initiating peer (candidate) creates a Firestore document containing their SDP offer - a description of their media capabilities and connection preferences. The receiving peer (mentor) listens for this document, processes the offer, generates an SDP answer describing their own capabilities, and writes it back. Both peers then exchange ICE candidates (potential connection paths) through a Firestore subcollection, each listening for new candidates and adding them to their peer connection. Once a viable candidate pair is found, the media stream begins.
The elegance of using Firestore for signaling is that it provides exactly the semantics needed: write a document, listen for changes, exchange data between two parties - all with built-in real-time synchronization and security rules.
ICE Candidate Strategy: The system configures multiple ICE server types in priority order:
The ICE framework automatically discovers the best available path and negotiates the connection, but configuration matters - TURN servers must be geographically close to users to minimize relay latency.
Connection Health Monitoring:
After the connection is established, the system polls WebRTC's getStats() API at regular intervals, tracking:
When metrics cross thresholds, the system takes progressive action: first attempt ICE restart (re-negotiate the connection path), then reduce video resolution, then switch to audio-only, and finally notify users of persistent issues.
Session Recovery: If the connection drops entirely (both peers lose the media stream), the system initiates an automatic reconnect sequence: a new SDP offer/answer exchange through the existing Firestore document, with fresh ICE candidate gathering. The UI shows a "Reconnecting..." state with a progress indicator. If reconnection succeeds within 30 seconds, the session continues. If not, both users are offered the option to retry or reschedule.
Fallback to Server-Relayed Communication: For environments where even TURN relay fails (extremely restrictive corporate proxies), the system provides a text-based chat fallback with audio via a phone bridge as a last resort. While not the full video experience, it preserves the session's value rather than canceling entirely.
Why this matters: Most WebRTC tutorials show the happy path - two peers on good connections establishing a direct stream. Production video calling requires handling the unhappy paths: NATs that reject direct connections, bandwidth that drops mid-session, users on mobile networks that hand off between towers. The difference between a demo and a product is the quality of the failure handling.
Challenge: WebRTC peer-to-peer connections fail silently behind certain NAT configurations (symmetric NATs, enterprise firewalls) without informing the application why. Approach: Configured TURN relay servers as mandatory fallback candidates in the ICE configuration. The system attempts direct connections first (STUN-based) but automatically falls back to relay when direct paths fail. Connection path selection is logged for debugging. Why: Requiring direct peer-to-peer connections would exclude users behind corporate networks and certain mobile carriers. TURN relay adds slight latency but ensures universal connectivity.
Challenge: Payment confirmation and session scheduling must be atomic - a paid session must result in a booked time slot, and a cancelled session must result in a refund. But the client, Stripe, and Firebase are separate systems with no shared transaction. Approach: Used Stripe webhooks processed by Cloud Functions as the source of truth for payment status. The webhook handler atomically updates Firestore (mark session as confirmed, update mentor availability) within a Firestore transaction. Refunds follow the same pattern - Stripe webhook triggers the Cloud Function that reverses the booking state. Why: Client-side payment confirmation is unreliable (browser can disconnect). Server-side webhook processing ensures consistency regardless of client state, and Firestore transactions ensure the booking state update is atomic.
Challenge: Real-time mentor availability must reflect actual current state - if a mentor starts a session, they should immediately disappear from search results for other candidates. Approach: Mentor availability is stored as a Firestore document that updates in real-time. When a session begins, a Cloud Function updates the mentor's availability document. All candidates browsing the mentor directory receive this update through Firestore's real-time listeners within seconds. Why: Polling-based availability checks would show stale data during the poll interval, leading to frustrating double-booking scenarios. Firestore's real-time synchronization ensures availability state is always current across all connected clients.
Challenge: The interview preparation context creates user anxiety - aggressive loading spinners, abrupt transitions, and clinical UI language amplify stress rather than facilitating productive practice. Approach: Designed a motion and visual language system specifically for the coaching context - gentle loading animations, smooth page transitions, warm color palette, encouraging microcopy, and a deliberate "breathing" transition before video sessions activate. Why: In a coaching product, the UI is part of the coaching experience. Motion design and visual language that reduce anxiety directly improve the quality of practice sessions. This isn't aesthetic preference - it's functional UX that serves the product's core goal of building candidate confidence.
Coffee Tea demonstrated the technical challenges of synchronous product design. When the core product is a live session, reliability and latency aren't just metrics - they are the user experience. A dropped frame during a mock interview has more impact than a slow page load on an e-commerce site.
Patterns I'd reuse:
What I'd reconsider:
Trade-offs acknowledged: