Facilitating the spread of knowledge and innovation in professional software development



Choose your language

InfoQ Homepage News Migrating Medium to React.js and GraphQL

Migrating Medium to React.js and GraphQL

Leia em PortuguÃªs


Medium migrated their existing system to a new architecture based on React.js and GraphQL. Two major goals of their endeavour, as Medium engineer Sasha T. Solomon explained, were making the new system incrementally available to users while not hindering development of new features.

Migrating off of an existing code base that is using somewhat older tech is not an easy decision to take. Besides the costs, you have to take into account how long it will take before your users see the benefits of the new system in place, and possibly you do not want to have to wait for the whole migration before that happens. Additionally, you want to make sure your service remains stable across the journey and that it can evolve, either by fixing bugs or implementing new features.

Five years after the initial development of their platform, that was exactly the case for Medium, as Solomon explains,

Migrating an entire system to new tools and frameworks isn’t an easy task. And doing that while not impacting feature development? That’s even harder

The Medium engineering team devised a path forward to the migration of their service that aimed to let people start using the new system as soon as possible, and at the same time not hinder changes to the existing system.

The first step of the migration was rewriting Medium’s client app with React.js and relying on GraphQL as an interface layer to the existing API. As a GraphQL client-side framework, Medium is using Apollo Client.

In this phase, both the old and the new system coexisted, with each serving a different set of pages. This approach had the benefit of not requiring a full server-side rewrite and not affecting the development of new features for the old system. A key decision the Medium team took was using protocol buffers to describe the legacy API as a schema for interfacing with GraphQL.

In a second phase of the migration, which according to Solomon is starting soon, server-side code will be refactored into services to feed the GraphQL layer, which will use Sangria as its GraphQL server-side framework.

The use of GraphQL is expected to bring here a big advantage, since its more granular structure maps directly into more modular and simpler services, which in turns is expected to improve their performance as well. The new services, that will use gRPC to talk to the GraphQL service, can be built in a totally independent way from the old services, while the old services are kept in places to power the old API.

Rate this Article


Hello stranger!


Get the most out of the InfoQ experience.


Community comments






Company name:
Company role:
Company size: