Skip to main content

System Design Prompt: Real-Time Chat Application Like Slack

Design a scalable real-time chat system like Slack: WebSockets, delivery guarantees, presence, message history, and fanout strategy.

Vul de plaatshouders in

Edit the values, then copy your finished prompt.

Jouw Prompt
prompt.txt

                                

What this prompt does

This prompt asks the AI to design a Slack-style real-time chat system sized for [user_count] concurrent users. It covers ten requirements: real-time delivery over [transport_protocol], message persistence with [message_retention], at-least-once delivery, presence, group chat up to [max_group_size], file sharing, push notifications, search via [search_engine], read receipts, and optional end-to-end encryption — plus connection management, fanout, database choice, and scaling.

The structure works because the hard parts of chat aren't the features, they're connection management, message fanout, and presence at scale. Passing [user_count] forces the model to reason about how many concurrent connections a single node can hold and how to shard them. [transport_protocol] decides whether you build on WebSockets with an SSE fallback or another transport, and [max_group_size] directly changes the fanout strategy — broadcasting to 1,000 members is a different problem than to 5. Asking for sequence diagrams keeps the message flows explicit.

When to use it

  • You're designing a chat or messaging feature and need a real fanout strategy, not just a feature list
  • You're prepping for a system design interview on real-time systems
  • You need to reason about connection management for [user_count] concurrent sockets
  • You're choosing between delivery guarantees and want at-least-once spelled out
  • You need a presence system that holds up under load
  • You're sizing message persistence and search with [message_retention] and [search_engine]

Example output

Expect a structured design covering the transport choice, a connection-management and gateway layer, a fanout strategy tuned to [max_group_size], a database and message-store design, a presence subsystem, and sequence diagrams (described or ASCII) for sending a message, going online/offline, and delivering to offline users via push. It reads like a senior-level design doc with the tradeoffs called out.

Pro tips

  • Set [user_count] honestly — 5,000 concurrent users and 5,000,000 lead to completely different connection-sharding answers
  • Use [max_group_size] to stress the fanout section; large groups are where naive designs fall apart
  • If presence matters, ask the model to detail the heartbeat and timeout logic; it's easy to gloss over
  • Pin [transport_protocol] to what you can actually run; WebSockets need sticky sessions or a pub/sub backplane
  • Ask for the sequence diagrams explicitly per flow — they expose gaps the prose hides
  • Treat the end-to-end encryption step as optional scope; it complicates search and history, so only include it if you truly need it

Frequently Asked Questions

Does this design rely on WebSockets specifically?
The `[transport_protocol]` default is WebSocket with an SSE fallback, but you can change it. WebSockets are the standard choice for bidirectional chat, though they require sticky sessions or a pub/sub backplane to scale across nodes, which the prompt addresses.
Can it handle large group chats efficiently?
Yes — the `[max_group_size]` variable directly drives the fanout strategy. Broadcasting to a 1,000-member group is fundamentally different from a small DM, so set this value accurately to get a fanout design that matches your real groups.
Does it cover end-to-end encryption?
Encryption is included as an optional step. Be aware that true end-to-end encryption complicates server-side search and message history, so the prompt treats it as a tradeoff rather than a default, and you should only request it if it's a hard requirement.
Will it produce sequence diagrams?
It includes sequence diagrams for key flows like message delivery and presence changes, usually as ASCII or described steps rather than rendered images. Ask for them per-flow to make sure each critical path is fully specified.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Meer in System Design Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support