Newsround, nanoservices and serverless
Software Engineering Team Lead, BBC D&E
Newsround is one of the key propositions within BBC Children’s as a go-to news service for children.
Over the past 6 months we’ve transitioned Newsround away from a legacy, on-premise technical stack over to a serverless, cloud based infrastructure.
In this post I’m going to talk about the technical strategy behind migrating Newsround to the cloud and how we maximised re-use, reduced duplication, fostered collaboration, and shipped an entire product on a serverless platform from the ground up.
For the past 3 years Newsround has been operating as a site hosted on our World Service platform, a part of BBC Online which delivers news for 29 different languages.
Newsround operated as another “language” with a different look and feel to the other BBC News language sites.
Currently, the BBC is in the middle of a large scale migration away from our on premise hosting platform called Forge, where the World Service platform is currently hosted, and into the cloud. At the time of writing this almost all product teams are now solely building products in the cloud whilst Forge is due to be decommissioned over the forthcoming months.
Shipping value quickly
Most sites on bbc.co.uk/.com such as www.bbc.co.uk/arts, www.bbc.co.uk/cbbc and www.bbc.co.uk/news have independent tech stacks. Some components are re-used between sites, and a common platform layer provides the tools for creating and storing content. Neil Craig goes into that in more detail in his post “How we deliver BBC Web Pages to the Internet”.
The Newsround engineering team started to come together late September 2017 and were faced with an immediate challenge: “What technical strategy allows us to start delivering value quickly?”.
We had a few requirements for the newly migrated product, including being able to add new features, support all existing content types currently in use today, be a like-for-like replacement as well as maintaining backwards compability with the previous website.
In order to successfully migrate Newsround, we explored several technical solutions, including: spinning up a brand new application stack with cloud infrastructure and build servers, waiting for World Service to finish their migration out of Forge or re-build Newsround using our own in-house serverless platform.
We decided against spinning up a brand new cloud infrastructure, due to the amount of investment, development effort and on-going maintenance it would require. We also decided against waiting for the World Service migration, as ultimately it would prevent Newsround from being able to build any new features in the interim.
With this in mind it was clear we needed a technical strategy that allowed us to deliver value quickly, while still maintaining the level of quality the audience expects from the BBC — it was clear that choosing a serverless approach would enable us to do just that.
Reusable serverless nanoservices
BBC teams across Design + Engineering have been collaborating over the years on a serverless platform built on React and Node called Morph.
Morph allows teams to build small, self-contained React components, which are pushed to Git, built and autodeployed into Amazon Web Services.
Morph supports both server and client side renders of React components and makes them available on an API endpoint which can be consumed from other applications or directly from the audience behind the public bbc.co.uk/bbc.com domain.
Morph is asynchronous; it is backed by multiple message queues which render React components and fetch data, making Morph extremely efficient when under heavy load (millions of requests per second). Morph by default will serve cached versions of pages and asynchronously re-render them if the underlying data or component has changed.
We call each component within Morph a nanoservice as they’re very small, stateless, versioned and exposed over HTTPS. These components accept props as parameters on the URL and return a BBC-wide standardised payload envelope as the response body, which looks a little like this:
This envelope format gives other services, such as cloud applications hosted on EC2 or static webpages, across the BBC the ability to consume and share nanoservices served by Morph.
React ships with the ability to create higher order components, and that is no different on Morph. A higher order component is simply a component composed from one or more other components, which ultimately allows entire webpages to be built and served by Morph.
Morph has support for building JSON/XML/any other data format APIs too. Matthew Clark, our Head of Architecture covers Morph in more detail in his post on “Powering BBC Online with nanoservices”.
At the time of writing this Morph has over 1032 services currently deployed which are powering many parts of the BBC Online, that’s 1032 potential pieces of functionality we can re-use to build Newsround, and that’s exactly what we did.
Newsround has bet big on Morph —we’ve built our entire technical stack on the foundations of reuse and we’ve seen huge benefits from this approach.
Delivering value to our audience is at the heart of our team. Morph abstracts away many aspects of a team’s day to day concerns when building a new application, things like build pipelines, tooling and scalability have been taken care of by the core Morph team — leaving product teams like Newsround to solely focus our engineering efforts on the value we can deliver the audience.
Re-use on Morph
Re-use is the foundation of Morph and it can range from HTML button components all the way up to fully featured article layouts composed of many smaller components.
Morph tenants can choose to namespace their components if they wish indicating that this component may not be much use to other teams but many components are not namespaced. Each component is versioned using semantic versioning meaning teams can submit pull request and modify these shared components without breaking anybody else’s code who may be depending on them.
Composition of components allows teams to share and combine components, APIs and features across teams, significantly reducing the time required to develop features.
For a long time the BBC has standardised its user interfaces through our Global Experience Language, otherwise known as GEL — so most user interface layouts, designs and patterns are already well established. Morph takes this one step further and commoditises the code for teams to re-use too.
As well as code reuse, Morph out the box supports build pipelines, a full CDN, routing, autoscaling and sits on a fully event driven architecture.
Challenges along the way
This way of working doesn’t come without its challenges. Morph is a single platform for every team across the BBC who wish to use it, which means at times it doesn’t always work out the box for your usecase. When this happens collaboration is key and in order to facilitate this Morph has dedicated support engineers during office hours available on Slack to support teams with their live services, a Morph community usergroup has also emerged where tenants across the platform can provide support and guidance.
Newsround has no cloud tooling of its own — we rely on the infrastructure provided by Morph which means any bespoke tooling we require such as end to end test suites and dashboards can leave us a bit stuck, again collaboration is key. We often look to our colleagues and teams across the BBC to seek solutions to these problems, often these are problems that have already been solved and are available for us to re-use as part of a shared infrastructure.
Collaboration is a huge part of being a tenant on a platform like Morph. Every component pushed up to the platform has the potential to be used by any team within the organisation.
Throughout development of Newsround a common question we find ourselves asking is “Can we reuse, repurpose or do we need to build from scratch?”. At the front of our development effort we consciously decide whether or not to namespace a module or leave it open for all to use. A huge part of being a tenant is as much about giving back as it is about reuse.
Clearly serverless has huge benefits to organisations, whether you decide to build your own proprietary serverless platform like the BBC and Netflix or if you decide to use a service such as AWS Lambda you’ll find that the common things become easy whilst the difficult things become possible.
Driving variance out of features means teams can really begin to hone in on what makes their products unique and focus entirely on solving the needs their users have — everything else just becomes a commodity.
Where to next?
This is only the beginning of our new Newsround transformation, keep your eyes peeled for more blog posts along the way.
Oh, and don’t forget to check https://www.bbc.co.uk/newsround out!
Thanks to the entire Newsround team and everybody in the wider BBC for their support launching Newsround.