BACK TO SELECTED WORK
CASE STUDYReal-Time Systems

Fenix

Real-Time Video Collaboration Platform

ROLEReal-Time Systems...
CORE STACKNext.js / React /...
YEAR2024
STATUSProduction
EST. READ38 MIN READ

Real-time video calling platform engineered around authenticated meeting lifecycle management, room access, device state, participant presence, media controls, and responsive call layouts using Next.js, Clerk, and Stream Video SDK.

Core Challenge: Building a video calling interface is not only about rendering a video grid. The application must coordinate authentication, meeting creation, room access, device state, participant presence, call lifecycle, and real-time media while remaining responsive across devices.

Next.jsReactTypeScriptTailwind CSSClerkStream Video SDKStream Node SDKRadix UILucideFramer MotionVercel

THE PROBLEM

Building a video calling interface is not only about rendering a video grid. The application must coordinate authenticated user identity, meeting creation, room membership verification, camera and microphone hardware setup, participant presence, dynamic call layouts, and real-time media transport while remaining responsive across devices.

Cryptographically verified Clerk user sessions and access tokens.

Pre-join hardware evaluation with camera and microphone controls.

Seamless in-call switching between Grid and Speaker presentation modes.

Real-time presence tracking, speaking indicators, and call statistics.

KEY CONSTRAINTS & COORDINATION PROBLEMS4 VECTORS
  • ▸IDENTITY: Cryptographically verified Clerk user sessions and access tokens.
  • ▸DEVICE STATE: Pre-join hardware evaluation with camera and microphone controls.
  • ▸CALL TOPOLOGY: Seamless in-call switching between Grid and Speaker presentation modes.
  • ▸PARTICIPANTS: Real-time presence tracking, speaking indicators, and call statistics.
MEETING LIFECYCLE & COORDINATION PIPELINE
AUTHENTICATE
↓
CREATE / JOIN ROOM
↓
VERIFY ACCESS
↓
DEVICE SETUP
↓
JOIN CALL
↓
MANAGE PARTICIPANTS
↓
CONTROL MEDIA
↓
END / EXIT SESSION

Fig 1.1: Multi-stage pipeline coordinating identity validation, pre-join device configuration, active call management, and graceful session termination.

HORIZONTAL SCROLL ON MOBILE ↔

THE APPROACH

Fenix structures real-time communication by isolating identity, application routing, media transport, and server-side token generation into distinct operational boundaries.

Clerk handles authenticated user identity and session persistence across the application.

Next.js provides the application routing layer, layout structures, and server action infrastructure.

Stream Video manages real-time media transport, peer connections, and participant presence state.

The server generates cryptographically signed Stream tokens using the Stream Node SDK without leaking master API secrets.

React components coordinate device previews, active room controls, dynamic layouts, and participant dialogs.

RESPONSIBILITY DECOUPLING WORKFLOW
IDENTITY
Clerk
↓
APPLICATION
Next.js / React
↓
VIDEO SESSION
Stream Video SDK
↓
SERVER TOKEN ISSUANCE
Stream Node SDK
↓
REAL-TIME CALL
Participants / Media / State

Fig 2.1: Separation of responsibilities across Clerk identity, Next.js application layer, Stream Node SDK token signing, and Stream Video real-time transport.

HORIZONTAL SCROLL ON MOBILE ↔

ARCHITECTURE & DATA FLOW

The system unifies Clerk session identity with the Stream Video React SDK. Rather than embedding credentials in the browser, a custom Stream provider initializes the client with the authenticated Clerk user and a secure token provider. Server actions use the Stream Node SDK to issue short-lived cryptographic tokens, granting authenticated entry to the active meeting room.

Wraps the application tree in StreamVideoProvider, configuring the client only when the Clerk user is fully loaded and verified.

Instantiates StreamClient with secret API credentials on the server to sign user tokens with an expiration timestamp.

SYSTEM ARCHITECTURE & SESSION TOPOLOGY
┌──────────────────────┐
│ USER │
│ Browser / Client │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ NEXT.JS │
│ App Router / React │
└───────┬───────┬──────┘
│ │
┌───────────┘ └────────────┐
▼ ▼
┌─────────────┐ ┌──────────────┐
│ CLERK │ │ STREAM VIDEO │
│ AUTH │ │ CLIENT │
└──────┬──────┘ └──────┬───────┘
│ │
▼ ▼
authenticated real-time session
identity state
│ │
└──────────────┬─────────────────┘
▼
┌─────────────────┐
│ MEETING ROOM │
│ │
│ Participants │
│ Media Controls │
│ Layout │
│ Call State │
└─────────────────┘

Fig 3.1: Dual-track integration: Clerk provides authenticated user context while Stream Video Client maintains real-time participant and media states.

HORIZONTAL SCROLL ON MOBILE ↔
SYSTEM SUBSYSTEMS & RESPONSIBILITIES2 SUBSYSTEMS SPECIFIED
01STREAM CLIENT PROVIDER

Wraps the application tree in StreamVideoProvider, configuring the client only when the Clerk user is fully loaded and verified.

02TOKEN ISSUANCE ACTION

Instantiates StreamClient with secret API credentials on the server to sign user tokens with an expiration timestamp.

CRYPTOGRAPHIC STREAM TOKEN FLOW
USER
│
▼
Clerk Authentication
│
▼
Server Action (tokenProvider)
│
▼
Stream Node SDK (StreamClient)
│
▼
Signed Stream Token (JWT)
│
▼
Stream Video Client
│
▼
Authenticated Call

Fig 3.2: Authenticated token generation: Clerk user identity triggers server action tokenProvider, issuing a signed Stream token for call admission.

HORIZONTAL SCROLL ON MOBILE ↔
SYSTEM SUBSYSTEMS & RESPONSIBILITIES2 SUBSYSTEMS SPECIFIED
01STREAM CLIENT PROVIDER

Wraps the application tree in StreamVideoProvider, configuring the client only when the Clerk user is fully loaded and verified.

02TOKEN ISSUANCE ACTION

Instantiates StreamClient with secret API credentials on the server to sign user tokens with an expiration timestamp.

MEETING LIFECYCLE

Fenix manages the meeting lifecycle through explicit setup and active stages. Calls are initialized with the Stream client, generating unique meeting IDs, shareable meeting URLs, and scheduled start times. Before entering the room, access permissions and device hardware are validated, enabling seamless entry into active call layouts.

Users can toggle on the fly between equal-weight grid tiles and speaker-focused layouts with participant sidebars.

Displays connected users, active speaking indicators, individual mute states, and connection quality indicators.

Surfaces real-time network latency, video bitrate, frame rates, and packet loss metrics directly within the UI.

MEETING LIFECYCLE & ACTIVE CALL PHASES
CREATE
│
▼
GET / CREATE CALL
│
▼
MEETING ID
│
▼
MEETING URL
│
▼
ACCESS CHECK
│
▼
DEVICE SETUP
│
▼
JOIN
│
▼
ACTIVE CALL
│
├── GRID
├── SPEAKER LEFT
├── SPEAKER RIGHT
├── PARTICIPANTS
└── CALL STATS
│
▼
LEAVE / END

Fig 4.1: End-to-end meeting lifecycle from initial call creation, URL generation, and device setup through dynamic active layouts to graceful exit.

HORIZONTAL SCROLL ON MOBILE ↔

DYNAMIC LAYOUTS

Users can toggle on the fly between equal-weight grid tiles and speaker-focused layouts with participant sidebars.

Keys:PaginatedGrid & SpeakerLayout

PARTICIPANTS PANEL

Displays connected users, active speaking indicators, individual mute states, and connection quality indicators.

Keys:CallParticipantsList

CALL DIAGNOSTICS

Surfaces real-time network latency, video bitrate, frame rates, and packet loss metrics directly within the UI.

Keys:CallStatsButton

ENGINEERING CHALLENGES

Real-time collaborative applications require engineering solutions for asynchronous connection states, hardware permission lifecycle, access control, and dynamic multi-participant UI presentation.

01 CHALLENGE

AUTHENTICATED REAL-TIME ACCESS

IDENTITY & MEMBERSHIP GATING
PROBLEM

A meeting URL should not unconditionally expose video streams. Fenix verifies Clerk authentication before initializing the Stream Video client and evaluates call membership permissions to ensure only authorized participants enter invited meetings.

02 CHALLENGE

DEVICE STATE BEFORE JOIN

PRE-CALL HARDWARE PREVIEW
PROBLEM

Entering meetings with hot microphones or unverified cameras creates user friction. Fenix enforces a dedicated pre-join setup screen featuring camera preview, microphone mute toggles, and device selection dialogs before connecting to the call.

03 CHALLENGE

REAL-TIME CALL STATE SYNCHRONIZATION

LIFECYCLE AVAILABILITY
PROBLEM

The client cannot assume a meeting room is immediately available or active. The application inspects call state to cleanly handle loading states, future scheduled meetings, already-ended calls, and unauthorized access before rendering the room interface.

04 CHALLENGE

MULTIPLE CALL LAYOUTS

IN-CALL TOPOLOGY ADAPTATION
PROBLEM

Different collaboration scenarios demand different presentation modes. Fenix enables in-flight switching between Paginated Grid, Speaker Left, and Speaker Right layouts, adjusting video tile aspect ratios without dropping media connections.

TECHNICAL RIGOR

The technology stack strictly reflects verified dependencies declared in the Fenix package manifest. Stream Video SDK provides battle-tested real-time media transport, while Next.js App Router and Clerk enforce server/client isolation.

Relies directly on @stream-io/video-react-sdk rather than claiming unverified raw WebRTC transport layers.

Stream API secrets and token signing keys are isolated within server action boundaries (actions/stream.actions.ts).

Meeting controls and modal dialogs leverage Radix UI primitives for keyboard navigation and screen reader support.

PRODUCTION DEPENDENCY & ARCHITECTURE MATRIX
┌──────────────────────┬─────────────────────────────┐
│ AUTHENTICATION │ Clerk │
│ VIDEO TRANSPORT │ Stream Video SDK │
│ SERVER TOKEN │ Stream Node SDK │
│ ROUTING │ Next.js App Router │
│ UI STATE │ React state + SDK state │
│ STYLING │ Tailwind CSS │
│ COMPONENT SYSTEM │ Radix UI │
│ ICON SYSTEM │ Lucide │
│ MOTION │ Framer Motion │
│ DEPLOYMENT │ Vercel │
└──────────────────────┴─────────────────────────────┘

Fig 6.1: Technical boundary matrix matching packages declared and implemented in the repository.

HORIZONTAL SCROLL ON MOBILE ↔

ZERO FAKE WEBRTC CODE

Relies directly on @stream-io/video-react-sdk rather than claiming unverified raw WebRTC transport layers.

SECRETS ISOLATION

Stream API secrets and token signing keys are isolated within server action boundaries (actions/stream.actions.ts).

ACCESSIBLE PRIMITIVES

Meeting controls and modal dialogs leverage Radix UI primitives for keyboard navigation and screen reader support.

ENGINEERING CHALLENGES & SOLUTIONS

Examining how core product requirements were broken down from architectural constraints into concrete implementations within the Fenix codebase.

01 CHALLENGE

AUTHENTICATED CALL ACCESS

PROBLEM

Public meeting URLs must not automatically expose video streams or admit unverified users.

CONSTRAINT

The application requires verified user identity and call membership state before allowing entry.

SOLUTION

Clerk user identity is evaluated alongside Stream call state in `app/(root)/meeting/[id]/page.tsx`, redirecting unauthenticated users and validating invited-member access.

RESULT

Meeting access is cryptographically evaluated before any media track connects or renders.

02 CHALLENGE

PRE-JOIN DEVICE CONTROL

PROBLEM

Users entering meetings without testing cameras or microphones cause awkward disruptions.

CONSTRAINT

Device permissions must be queried and configured prior to joining the active call session.

SOLUTION

A dedicated `MeetingSetup` component provides a live `VideoPreview`, `DeviceSettings` dialog, and mic/camera toggles connected to Stream media controls.

RESULT

Users configure their audio/video hardware and join on their terms with clear visual confirmation.

03 CHALLENGE

DYNAMIC CALL PRESENTATION

PROBLEM

A rigid video layout fails in diverse scenarios (team roundtables vs 1-on-many presentations).

CONSTRAINT

Layout changes must occur in-call without reconnecting media tracks or triggering layout thrashing.

SOLUTION

The `MeetingRoom` component maintains a layout state toggle, switching seamlessly between `PaginatedGridLayout`, `SpeakerLayout` (speaker-left), and `SpeakerLayout` (speaker-right).

RESULT

Participants change video topologies dynamically during an active call without media interruption.

TECHNICAL DECISIONS

Key engineering decisions focused on delegating complex infrastructure primitives (identity, real-time media transport) so engineering effort could be directed toward meeting lifecycle management, device controls, and call UX.

DECISION 01 • ARCHITECTURAL DECISION

CLERK AUTHENTICATION

WHY / RATIONALE

Delegates user identity, session management, and social logins rather than implementing custom credential databases and session refresh flows.The platform becomes dependent on an external identity provider and its token lifecycles.

TRADE-OFF ACCEPTED

The platform becomes dependent on an external identity provider and its token lifecycles.

OUTCOME / IMPACT

CLERK AUTHENTICATION

DECISION 02 • ARCHITECTURAL DECISION

STREAM VIDEO SDK

WHY / RATIONALE

Leverages specialized real-time media infrastructure rather than building WebRTC signaling, STUN/TURN traversal, and SFU selective forwarding from scratch.The application architecture and meeting state models are coupled to the Stream Video SDK API contracts.

TRADE-OFF ACCEPTED

The application architecture and meeting state models are coupled to the Stream Video SDK API contracts.

OUTCOME / IMPACT

STREAM VIDEO SDK

DECISION 03 • ARCHITECTURAL DECISION

NEXT.JS 14 APP ROUTER

WHY / RATIONALE

Consolidates page routing, layout nesting, server actions for token issuance, and client React trees in a single unified TypeScript framework.Requires explicit management of 'use client' directives and boundary isolation for real-time components.

TRADE-OFF ACCEPTED

Requires explicit management of 'use client' directives and boundary isolation for real-time components.

OUTCOME / IMPACT

NEXT.JS 14 APP ROUTER

DECISION 04 • ARCHITECTURAL DECISION

COMPONENTIZED CALL ARCHITECTURE

WHY / RATIONALE

Isolates meeting setup (`MeetingSetup`), room orchestration (`MeetingRoom`), layout selectors, participant drawers, and modal dialogs into modular components.Requires careful coordination of multi-level component state and SDK hook subscribers.

TRADE-OFF ACCEPTED

Requires careful coordination of multi-level component state and SDK hook subscribers.

OUTCOME / IMPACT

COMPONENTIZED CALL ARCHITECTURE

SYSTEM INTERACTION STATES

The meeting room is modeled as an explicit state machine that steps from authentication verification through call discovery, access validation, and hardware configuration into the active meeting session before exiting cleanly.

MEETING STATE MACHINE
┌─────────────┐
│ AUTHENTICATE│
└──────┬──────┘
▼
┌─────────────┐
│ CALL LOADING│
└──────┬──────┘
▼
┌────────────────────┐
│ ACCESS VALIDATION │
└─────────┬──────────┘
▼
┌─────────────┐
│ SETUP │
└──────┬──────┘
▼
┌─────────────┐
│ JOIN │
└──────┬──────┘
▼
┌─────────────┐
│ ACTIVE │
└──────┬──────┘
│
┌──────────┴──────────┐
▼ ▼
LEAVE END
│ │
└──────────┬──────────┘
▼
EXIT

Fig 9.1: Deterministic state progression: enforcing authentication and hardware setup before transitioning to active media streams.

HORIZONTAL SCROLL ON MOBILE ↔
ACTIVE STATE CONTROL GRAPH
ACTIVE CALL SESSION
├── Video (Camera toggle & preview feed)
├── Audio (Microphone mute & speaking indicator)
├── Participants (Drawer list & member presence)
├── Layout (Grid, Speaker Left, Speaker Right)
├── Statistics (Bitrate, latency, resolution stats)
└── End Call (Leave room or terminate for all)

Fig 9.2: Sub-state controls available once the call enters the ACTIVE state.

HORIZONTAL SCROLL ON MOBILE ↔

WHAT THE SYSTEM ACTUALLY DOES

The meeting management interface supports four primary home actions (New Meeting, Join Meeting, Schedule Meeting, View Recordings) paired with an active in-call suite of controls.

Generates an immediate call with a unique UUID, initializes Stream state, and routes directly to setup.

Accepts a shareable link or meeting ID input, queries call availability, and checks user authorization.

Configures start time, date, and description, saving the meeting to the user's scheduled dashboard list.

Live camera video preview, device selection, and mic/camera toggle before joining the active call.

Interactive real-time media streams with automatic speaking indicators and active participant tracking.

Toggles live between equal-weight Grid view, Speaker Left view, and Speaker Right view without reconnecting.

Opens a sidebar listing all connected participants with mute indicators and membership status.

Provides network latency, resolution, bitrate, and packet loss diagnostics for technical troubleshooting.

Surfaces past meeting recordings stored via Stream Video for asynchronous review.

CREATE

Generates an immediate call with a unique UUID, initializes Stream state, and routes directly to setup.

JOIN

Accepts a shareable link or meeting ID input, queries call availability, and checks user authorization.

SCHEDULE

Configures start time, date, and description, saving the meeting to the user's scheduled dashboard list.

SETUP

Live camera video preview, device selection, and mic/camera toggle before joining the active call.

CALL

Interactive real-time media streams with automatic speaking indicators and active participant tracking.

LAYOUT

Toggles live between equal-weight Grid view, Speaker Left view, and Speaker Right view without reconnecting.

PARTICIPANTS

Opens a sidebar listing all connected participants with mute indicators and membership status.

STATS

Provides network latency, resolution, bitrate, and packet loss diagnostics for technical troubleshooting.

RECORDINGS

Surfaces past meeting recordings stored via Stream Video for asynchronous review.

MEASURABLE RESULTS

Fenix is evaluated on verifiable engineering deliverables rather than fabricated benchmark metrics. The outcomes demonstrate complete real-time capability coverage, device control, and authenticated access.

3
CALL MODES

Instant ad-hoc rooms, direct meeting link joins, and future scheduled calendar meetings.

3
CALL LAYOUTS

Dynamically switchable Paginated Grid, Speaker Left, and Speaker Right presentation modes.

100%
AUTHENTICATED ACCESS

All calls require verified Clerk sessions and cryptographically signed Stream tokens.

2-WAY
REAL-TIME MEDIA

Synchronized audio and video streams powered by Stream Video SDK with speaking indicators.

PRE-JOIN
DEVICE CONTROL

Live camera preview and microphone toggles verified before entering any active room.

RESPONSIVE
MULTI-VIEWPORT UI

Adaptive controls, mobile drawer navigation, and responsive participant grids.

ENGINEERING STRUCTURE

The Fenix codebase is structured as a modular full-stack application, cleanly separating route handlers, UI components, custom reactive hooks, server actions, and SDK providers rather than overloading single files.

REPOSITORY CODEBASE ORGANIZATION
Fenix
│
├── app/
│ ├── (auth)/ # Clerk sign-in & sign-up flows
│ ├── (root)/
│ │ ├── meeting/[id]/ # Core meeting route with access gates
│ │ └── (home)/ # Home dashboard, previous, upcoming, recordings
│ └── layout.tsx # Global StreamClientProvider & ClerkProvider
│
├── components/
│ ├── MeetingRoom.tsx # Active meeting room, layouts, & participants
│ ├── MeetingSetup.tsx # Pre-join camera/mic preview & setup
│ ├── MeetingModal.tsx # Reusable dialog for instant/scheduled calls
│ └── CallList.tsx # Tabbed previous, upcoming, and recording lists
│
├── hooks/
│ ├── useGetCalls.ts # Custom hook fetching previous, upcoming, & recorded calls
│ └── useGetCallById.ts # Custom hook fetching active call metadata & state
│
├── actions/
│ └── stream.actions.ts # Server action generating signed Stream tokens
│
├── providers/
│ └── StreamClientProvider.tsx # Injects StreamVideoClient into React context
│
└── lib/
└── utils.ts # Styling helpers and class merging

Fig 12.1: Codebase architecture: isolating authentication, meeting routes, custom call hooks, server actions, and provider contexts.

HORIZONTAL SCROLL ON MOBILE ↔

FROM IDENTITY TO REAL-TIME CALL

The complete architectural arc of Fenix spans user authentication through Clerk, application state management in Next.js, cryptographic Stream token signing via server actions, and active media coordination across video, audio, and participant streams.

END-TO-END IDENTITY & CALL ARCHITECTURE
USER
│
▼
┌─────────────┐
│ CLERK │
│ AUTHENTICATE│
└──────┬──────┘
│
▼
┌─────────────┐
│ NEXT.JS │
│ APPLICATION │
└──────┬──────┘
│
▼
┌─────────────┐
│ STREAM TOKEN│
│ PROVIDER │
└──────┬──────┘
│
▼
┌─────────────┐
│ STREAM VIDEO│
│ CALL │
└──────┬──────┘
│
┌────┼────┐
▼ ▼ ▼
VIDEO AUDIO USERS
│
▼
EXIT

Fig 13.1: Final architectural synthesis: seamless bridge from Clerk authentication to authenticated Stream Video call session.

HORIZONTAL SCROLL ON MOBILE ↔
NEXT PRODUCTION SYSTEM • CASE STUDY

Signifiya

Mobile Event Infrastructure, Native Payments & 120Hz Engine

EXPLORE SYSTEM
BACK TO SELECTED WORKENGINEERING DOSSIER • TUSHAR KANTI DEY