All Architectures
    Real-TimeIntermediate

    Real-Time Chat App

    A real-time messaging platform with WebSocket connections, Redis Pub/Sub for multi-instance message fanout, PostgreSQL for message persistence, and S3 for file/media sharing. Supports direct messages, group channels, presence indicators, and read receipts.

    500 – 50Kusers supported
    $100 – $1,000/month infrastructure

    Architecture Diagram

    Interactive — hover over any node to see its role and description.

    User AUser BReact UISocket.io ClientWS ServerSocket.ioMsg WorkerNode.jsRedis Pub/SubPostgreSQLAWS S3MediaUserFrontendBackendQueueCacheDatabaseStorage

    Use Cases

    In-app customer support live chat
    Team collaboration tool (Slack-style)
    Gaming community chat system
    Live event Q&A platform
    Embedded chat widget for SaaS products

    Technology Stack

    frontend

    ReactTypeScriptSocket.io-client

    backend

    Node.jsSocket.ioExpress

    database

    PostgreSQLRedis Pub/Sub

    infrastructure

    AWS EC2AWS S3NginxDocker

    Scalability Roadmap

    Stage 10 – 1K users· Single Node server

    Single Node.js instance with Socket.io. Works well for up to ~10K concurrent connections on a large EC2.

    Stage 21K – 10K users· Multi-instance + Redis Pub/Sub

    Multiple WS servers sharing Redis Pub/Sub for message fanout. Sticky sessions via load balancer.

    Stage 310K – 100K users· ECS + ElastiCache + Aurora

    Containerised WS servers on ECS. Aurora PostgreSQL with read replicas. ElastiCache Redis cluster.

    Stage 4100K+ users· Dedicated WS clusters + Kafka

    Replace Redis Pub/Sub with Kafka for guaranteed delivery. Dedicated WS cluster per region. Message archival to S3.

    Cost Breakdown

    Development Cost

    $10,000 – $25,000 (6–12 weeks)

    Infrastructure Cost

    $100 – $1,000/month (scales with concurrent connections)

    Maintenance Cost

    $1,000 – $3,000/month for scaling, push notification management, and compliance

    Security Considerations

    JWT authentication before WebSocket upgrade — no anonymous connections
    Channel-level permission checks on every message event
    Rate limiting per connection to prevent spam floods
    End-to-end encryption option for direct messages using client-side keys
    Media upload scanning for CSAM and malware before storage

    More Architectures

    Need This Architecture Built?

    Get a detailed architecture plan, technology recommendations, development roadmap, and infrastructure estimation for your project.