Server-side rendering tactics for federated applications

Zack Jackson
7 min readJul 31, 2021

What are the available techniques for SSR applications powered by Module Federation? There are a few to choose from, let’s list them.

I’ve written and spoken about some tactics in varying degrees. But up until now, this information has never been centralized or easily discovered. It’s time to consolidate this information and get it out of my head once and for all.

There are vendors that could possibly help, like ESI — but third-party dependency isn’t going to be part of this discussion. I’m interested in at-runtime options that leverage webpack mechanics.

File collocation

Arguably the most simple.

You can use a docker shared volume or lambda layer as a way to keep files “on disk”

As such, webpack can simply drill into and require the needed files as if it were a node_module

In AWS, updating a lambda layer causes new lambdas to be created or recreated — so the problem of “stuck” code isn’t an issue. There are limitations on the number of layers and the amount of storage these layers can hold. But it should be more than enough for many.

For docker containers, you’d need to perform a rolling restart when updating the shared volume with accessible code.

--

--

Zack Jackson

Infra Architect @ ByteDance. Creator of Module Federation. Specializing in Bundler and Javascript Orchestration at scale.