Skip to content

Case file 17

Slack desktop: a rewrite shipped piece by piece

Slack replaced the whole of its desktop application without ever shipping a big replacement. New code went into the existing app one feature at a time, and by the time the old code was removed, most users had been running the new code for months.

Slide: the original Slack desktop app rebuilt one feature at a time into the app released on July 22, 2019.

The engineers who did this work titled their account "When a rewrite isn't." It opens by agreeing with the rule that came out of the Netscape case: "Conventional wisdom holds that you should never rewrite your code from scratch, and that's good advice." Then it describes replacing all of the code anyway.

Gen 1

The desktop app was Slack's oldest product. It grew out of what its engineers called a period of rapid development and experimentation in the company's earliest days, on the tools chosen in late 2012: jQuery, Signals and direct manipulation of the page.

By the late 2010s three parts of that design had become real problems.

  • The interface was updated by hand. It was built from HTML templates that had to be rebuilt manually whenever the underlying data changed.
  • Data was loaded eagerly. The app fetched a workspace's data up front, which became prohibitively expensive for large workspaces.
  • Each workspace was a separate copy. A person signed in to several workspaces ran a stand-alone copy of the app for each, in its own process. Memory use climbed quickly with every workspace added.

Each of these was a property of the architecture, not a bug in it. The engineers concluded that solving the last one properly meant rewriting the desktop app.

The decision

They did not stop and build a replacement. The plan was to keep the existing codebase and modernize it "bit by bit, replacing existing code with modern code incrementally."

Inside the same codebase, the team set aside a place for modern code and gave it three rules:

  • "All UI components had to be built with React."
  • All data access had to assume a lazily loaded and incomplete data model.
  • "All code had to be 'multi-workspace aware.'"

Each rule answers one of the three problems above. Together they meant that anything written as modern code would be correct for the final architecture, even while it was running inside the old one.

Inside Slack the effort was known as the Sonic project.

What happened

The interesting engineering is in how the two generations of code shared one application.

The team built a layer for it, called legacy-interop, and it enforced a boundary in both directions. In their words, "old code cannot directly import new code" and "new code cannot directly import old code." Old code could use only what the modern side deliberately exported. Modern code could reach old code only through an adapter, and that adapter fell back to doing nothing when the old code was not present.

That last detail is what made the ending possible. Because modern code never depended directly on legacy code, the legacy code could eventually be left out altogether, and the modern code would still run.

Meanwhile the work shipped. As code was modernized and features were rebuilt, they were released to customers inside the existing app. The first was small on purpose: "The first 'modern' piece of the Slack app was our emoji picker, which we released more than two years ago." The channel sidebar and the message pane followed, then dozens of other features.

The alternative was on the engineers' minds. Had they waited until all of Slack was rewritten before releasing any of it, customers would have gone without those improvements for the whole period, and everything would have arrived at once in a single unproven release.

When enough had been rebuilt, the team produced a version of the app containing only modern code. They used it inside the company for much of a year before giving it to anyone else.

On July 22, 2019, Slack announced the result. The company said the desktop app now launched 33% faster, used up to 50% less memory, and joined calls up to 10 times faster, with the caveat that results depend on network, workspace size and the age of the device. Memory use, which had grown with every workspace a person joined, was now close to constant.

Even then there was no single cutover. The update rolled out gradually over the following weeks, and users did not have to do anything to receive it.

What made it work

  • Nothing waited for the end. Every rebuilt feature went to customers when it was ready. The business got a return on the work for the full two years, and no competitor was handed a quiet period.
  • Each release was a small bet. A problem with the new emoji picker is a problem with an emoji picker. The engineers wrote that releasing incrementally "de-risked the release of the new client" by keeping the amount of completely new code in any one release low.
  • The boundary was a rule, not a habit. Old and new code could not import each other directly. Without that, modern code would have picked up dependencies on legacy code, and the old system could never have been removed.
  • The rules described the destination. Modern code had to satisfy the final architecture from its first line, so finishing the migration did not require rewriting the new code a second time.
  • The final form was proven in private. The modern-only app ran inside Slack for much of a year. By public release it was the least surprising version of the product the company had.
  • The last step was gradual too. A staged rollout meant that even the removal of the old code could be watched and paused.

This is the strangler fig pattern applied inside a single application, the same shape as the engine work in Firefox Quantum. The interop layer is a form of branch by abstraction.

What it cost

It took about two years, and for all of that time the team carried both generations of code in one product. Those are the costs described in running two systems, in a compact form.

The interop layer was itself work that no customer ever saw: adapters, export rules and tooling whose only purpose was to be deleted later. The rules also constrained every engineer on the app. A new feature had to be written to the modern standard, even when the legacy way would have been quicker that week.

And the biggest gain came last. Running every workspace in one process depended on all of the code being multi-workspace aware. That benefit could not be delivered a feature at a time, so users waited for it until the modern-only version shipped.

The verdict

It worked. The old architecture is gone, the product never stopped shipping, and the public release was close to an anticlimax, which is the best thing that can be said about a release of this size.

It is also a fair example of what the rule against rewrites does and does not forbid. All of the code was replaced. What the team avoided was the gap: the period in which the old system is frozen and the new one is not ready.

What to take from it

  • Replace the code, not the product. A complete rewrite and a from-scratch rewrite are different things. Only the second one stops you shipping.
  • Write the rules for new code before you write the code. Decide what the final architecture requires and hold every new piece to it from the start.
  • Build the wall between old and new, and enforce it. If new code may depend on old code freely, Gen 1 can never be removed.
  • Start with something small and visible. An emoji picker proved the whole method at almost no risk.
  • Run the finished system yourself before anyone else does. Months of internal use cost little and turn launch day into a formality.

Sources

  1. Mark Christian and Johnny Rodgers - When a rewrite isn't: rebuilding Slack on the desktop (Slack Engineering, July 22, 2019) - the engineers' account: the old architecture, the rules for modern code, the interop layer and the incremental releases
  2. Slack - Introducing a snappier, more efficient Slack desktop experience (July 22, 2019) - the launch, memory and call figures, and the gradual rollout
  3. Bruno Couriol - Successful Software Rewrites: The Slack for Desktop Case (InfoQ, July 30, 2019) - independent summary; memory use across workspaces before and after
  4. Tracy Stampfli and Bryan Stern - Stabilize, Modularize, Modernize: Scaling Slack's Mobile Codebases (Slack Engineering, January 12, 2022) - names the desktop rewrite as the Sonic project

Last updated November 28, 2026.