← Teardowns

How Is Slack Built? Real-Time Messaging Infrastructure and Clone Difficulty

A deep, honest look at Slack's real-time architecture, why the hard parts aren't the chat UI, and whether an AI coding tool could actually clone it.

The part everyone gets wrong: Slack is not 'a chat UI'

Every few months someone ships a weekend clone of Slack's interface — channel sidebar, message list, a textbox with an emoji picker — and calls it a Slack killer. It looks right in a screenshot. It falls over the moment two people are typing in the same channel at once, or someone loses wifi on a train, or a workspace has 4,000 members and 10 years of message history. The UI is maybe 5% of the actual engineering effort. The other 95% is distributed systems problems that only show up at scale: ordering guarantees, presence at scale, search over billions of messages, and reconnection logic that has to be bulletproof because business communication cannot silently drop messages.

This distinction matters a lot for how you should think about cloneability. An AI coding tool can generate a very convincing chat UI in an afternoon — React components, websocket hookup, optimistic message sends. What it can't generate in an afternoon is the operational maturity that makes that chat UI trustworthy for a company running its business through it. That gap is where Slack's real moat lives, and it's mostly invisible until you try to operate it at scale.

The real-time backbone: persistent connections at massive scale

Slack's real-time layer is built around long-lived WebSocket connections between clients and a fleet of gateway servers, historically built on Erlang for the connection-handling tier because Erlang's actor model and lightweight processes are extremely good at holding millions of concurrent, mostly-idle connections cheaply. Each client connects to a gateway, which subscribes it to the channels and DMs it cares about, and the gateway fans out events — new messages, reactions, typing indicators, presence changes — to every connected client that needs them.

The hard problem isn't 'send a message and show it on screen.' It's: what happens when a client disconnects mid-conversation and reconnects three minutes later on a different network? Slack has to replay missed events in order, deduplicate against what the client already has, and reconcile local optimistic state (the message you sent before your wifi died) against server truth. This reconciliation logic is where most amateur real-time apps quietly break — messages appear twice, arrive out of order, or vanish. Getting this right requires a message sequence/cursor model per channel, idempotent event delivery, and a client that's genuinely designed around eventual consistency rather than assuming a permanent open pipe.

Storage: it's a database problem disguised as a chat app

Slack messages live in a sharded MySQL architecture (with plenty of caching in front via Memcached and later other layers), not some exotic messaging-specific datastore. The sharding key is typically the workspace/team, which is a clever choice: most queries — 'give me the last 50 messages in this channel' — are naturally scoped to one team, so you can shard by team ID and keep almost every query within a single shard. This is the kind of decision that looks obvious in hindsight and is actually the product of hard-won operational experience about which access patterns actually happen in production.

Search is its own beast entirely. Full-text search over a workspace's entire message history, with permission filtering (a search must never surface a message from a private channel you're not in), at low latency, is a genuinely hard indexing and access-control problem, not a 'add Elasticsearch' problem. The permission-aware filtering has to happen at or before the search layer, correctly, every time, or you have a security incident. This is the sort of requirement that's trivial to skip when you're prototyping and catastrophic to get wrong in production.

Presence, typing indicators, and why 'small' features are deceptively expensive

Presence — the green dot showing someone's online — sounds trivial and is actually one of the more expensive features to run at scale, because it's a write-heavy, fan-out-heavy, constantly-changing piece of state that a huge number of clients are watching simultaneously. Every status change has to propagate to everyone who shares a channel with that person, continuously, for the entire time both are online. Multiply that by workspaces with thousands of members and you get a genuinely large amount of chatter that has to be batched, debounced, and made eventually-consistent (nobody notices if your dot is 2 seconds stale) rather than strictly real-time, because strict consistency here is not worth the infrastructure cost.

Typing indicators are the same story at smaller scale: ephemeral, high-frequency, low-value-per-event data that still needs delivery infrastructure. The lesson for anyone sizing up 'how hard would this be to clone': the features that look cosmetic are frequently the ones that require the most infrastructure discipline to run cheaply, because they're the ones generating constant background traffic across every active user.

Integrations and the App Directory: the actual moat

Here's where oneprompt's two axes really diverge for Slack. Technical cloneability of the chat mechanics is moderate-to-hard but very doable for a competent team — the concepts (websockets, sharded relational storage, search indexing, presence fan-out) are all well understood, well documented, and have open-source references. An AI coding tool could get you a working real-time chat app with channels, threads, and reactions in a reasonable amount of time. What it cannot get you is Slack's business moat: thousands of third-party integrations (Google Drive, Salesforce, GitHub, Jira, PagerDuty, hundreds more), a mature Slack API and app platform, Slack Connect for cross-company channels, and — most importantly — the fact that ripping Slack out of an organization means ripping out every workflow, bot, and notification pipeline wired into it.

This is a textbook example of switching cost as moat. The chat itself is a commodity — Teams, Discord, Mattermost, and a dozen startups all do 'real-time channels' fine. What keeps enterprises on Slack is that their CI/CD pipeline posts to #deploys, their support tool posts to #customer-alerts, their calendar bot DMs people about meetings, and untangling all of that is a multi-month project nobody wants to own. A clone can match the UI and even match the infrastructure. It cannot match ten years of accumulated integration lock-in without the same ecosystem of third-party developers choosing to build for it — and they won't build for a workspace with zero users.

Threads, edits, and message ordering: the deceptively hard product decisions

Threads look like a UI feature but they're actually a data-modeling decision with huge downstream consequences: is a thread reply also a channel message? Does it need its own ordering sequence? How do unread counts work when someone reads the channel but not a thread inside it? Slack's answer required real backend modeling, not just a nested comment component. Message editing and deletion add another layer: every client needs to know an edit happened, in order, without breaking the illusion of a stable message log, and without letting a client that missed the edit event show stale content indefinitely.

None of this is impossible to clone — it's just the kind of design work that only becomes obvious after you've shipped the naive version and watched it break at scale. An AI-generated clone will nail the demo (send message, see message) and quietly get all of this wrong, because the failure modes only appear under real concurrent load, not in a single-user test.

So: how cloneable is Slack, honestly?

On the technical axis, Slack sits in the middle: the concepts are public knowledge, the infrastructure choices (sharded relational DB, actor-model connection handling, search with permission filtering) are documented in engineering blog posts, and a strong team — or a strong team with AI-assisted scaffolding — can build a real-time chat app that works for a few hundred concurrent users without heroic effort. Getting it to work reliably for tens of thousands of concurrent users across flaky mobile networks, with correct message ordering, presence, and search-with-permissions, is a much bigger and less glamorous lift that most clones never finish.

On the business-moat axis, Slack is hard, and that's the axis that actually matters for whether cloning it is a good idea. The moat isn't the websocket server, it's the integration graph and the switching cost it creates. If you're evaluating whether to build a Slack competitor, the honest oneprompt verdict is: the chat engine is a solvable engineering problem, but you're not really competing on chat — you're competing on whether developers will build 3,000 integrations for your app store instead of Slack's, and that's a network-effects problem no amount of AI-generated code will solve for you.

Want the same teardown for any site?

Analyze a site →