Skip to content

Episode Chat

show.fm provides a real-time chat system embedded in episode collaboration views. It supports both authenticated team members and guest portal users with @mentions, emoji reactions, typing indicators, and online presence tracking.

Architecture Overview

Key Components

ComponentLocationPurpose
EpisodeChatSidebarsrc/lib/components/chat/Main container managing messages, tabs, subscriptions
ChatMentionInputsrc/lib/components/chat/TipTap-based editor with @mention autocomplete
MessageContentsrc/lib/components/chat/Renders messages with URL linkification and mention highlighting
MessageReactionssrc/lib/components/chat/Emoji reaction buttons with counts and picker
ChatParticipantRostersrc/lib/components/chat/Online/offline participant list with role badges
TypingIndicatorsrc/lib/components/chat/Animated typing dots with user attribution
ChatPresenceAvatarssrc/lib/components/chat/Overlapping avatar circles for online users

Feature Summary

Messaging

  • Send and delete chat messages with optimistic UI updates
  • @mention participants with autocomplete (TipTap Mention extension)
  • URL auto-detection and linkification
  • 5,000 character limit enforced client and server-side
  • Rate limiting with retry-after feedback

Reactions

  • Six emoji options: thumbs up, heart, laugh, wow, party, fire
  • Optimistic toggle with rollback on failure
  • Real-time broadcast to all participants

Presence & Typing

  • Online/offline status tracking via Supabase Realtime Presence API
  • Typing indicators with 2-second auto-expiry
  • Participant roster sorted by role priority

Dual Auth Model

  • Authenticated users: Supabase Auth + RLS policies on episode_messages
  • Guests: Magic token validation via SECURITY DEFINER RPCs (bypasses RLS)

Usage in Routes

RouteContext
/p/[slug]/e/[episodeSlug]/show-notesSidebar alongside collaborative editor
/guest/e/[episodeId]Guest portal main view
/guest/e/[episodeId]/chatPop-out chat window for guests

Documentation

DocumentDescription
ComponentsProps, behavior, and relationships for all chat UI components
Service LayerBusiness logic, stores, and API functions
Real-Time ArchitectureSubscriptions, broadcasts, presence tracking
Database SchemaTables, RLS policies, RPCs, and migrations

Internal documentation - Not for public distribution