/sample-relay-chat

Simple repo for the dev container development for the relay-chat repo

Primary LanguageTypeScriptMIT LicenseMIT

๐Ÿ’ฌ Relay-Chat Typescript/React

RTC Terminal is a modern real-time chat application that enables users to create or join chat rooms and communicate instantly with other participants. The application features a clean, responsive interface and supports real-time message delivery using WebSocket technology.


๐Ÿš€ Getting Started

Open Using Daytona

  1. Install Daytona: Follow the Daytona installation guide.

  2. Create the Workspace:

    daytona create https://github.com/yashksaini-coder/relay-chat-daytona
  3. Next start the application:

    npm run dev
    
  4. Click on the local deployment URL of the Application:

    https://localhost/5173

โœจ Features

๐Ÿ  Room Management

  • ๐Ÿ†• Create new rooms with auto-generated unique room IDs
  • ๐Ÿ”— Join existing rooms using room IDs
  • ๐Ÿ“‹ Copy room IDs to clipboard for easy sharing
  • ๐Ÿ‘ฅ Real-time user connection tracking

๐Ÿ’ฌ Chat Features

  • โšก Real-time message delivery
  • ๐Ÿ–ผ๏ธ User-friendly message interface with distinct styling for sent/received messages
  • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Support for multiple users in the same room
  • ๐Ÿ“ Username display for each message
  • โŽ Enter key support for sending messages

๐ŸŽจ UI/UX

  • ๐ŸŒ“ Clean, modern interface with dark theme
  • ๐Ÿ“ฑ Responsive design that works on mobile and desktop
  • ๐Ÿ”” Toast notifications for important actions
  • ๐ŸŽข Smooth transitions and hover effects
  • ๐Ÿ“œ Scrollable message history

๐Ÿ› ๏ธ Tech Stack

๐ŸŒ Frontend

React TypeScript Tailwind CSS Vite React Toastify Lucide React
React TypeScript Tailwind CSS Vite React Toastify Lucide React

๐Ÿ—๏ธ Architecture

๐ŸŒ Frontend Architecture

The frontend is built as a single-page application (SPA) with React. Key components include:

  • ๐Ÿ”— Connection management with WebSocket
  • ๐Ÿ—ƒ๏ธ State management using React hooks
  • ๐Ÿ“ Responsive UI components
  • โšก Real-time message handling and display

๐Ÿ–ฅ๏ธ Backend Architecture

The backend implements a WebSocket server that handles:

  • ๐Ÿ‘ฅ User connections and disconnections
  • ๐Ÿ  Room management
  • ๐Ÿ“ก Message broadcasting to room participants
  • ๐Ÿ”ข User count tracking

๐Ÿ“ก Communication Protocol

The application uses a simple message protocol over WebSocket:

๐Ÿšช Join Room Message

{
    "type": "join",
    "payload": {
        "roomid": "ROOM_ID"
    }
}

๐Ÿ’ฌ Chat Message

{
    "type": "chat",
    "payload": {
        "name": "USERNAME",
        "message": "MESSAGE_CONTENT"
    }
}

๐Ÿ”’ Security Features

  • ๐Ÿ” Secure WebSocket connections (WSS)
  • ๐Ÿ›ก๏ธ Input validation
  • ๐Ÿšช Room isolation (messages only broadcast to users in the same room)

๐ŸŒ Deployment

  • ๐ŸŒ Frontend deployed on Vercel
  • ๐Ÿ–ฅ๏ธ Backend deployed on Render
  • ๐Ÿ”ง WebSocket server configured for production use