September 26, 2022

Robotic Notes

All technology News

Let’s bring the Jamstack to SaaS: introducing Rainbow Rendering | by Eric Burel

6 min read


Eric Burel

The Jamstack is a way to structure web applications, using JavaScript, APIs and “Markup”. See a more complete definition at Jamstack.org if you are not familiar with the concept.

“What if I told you you can actually statically render SaaS application with private data”

There is definitely an intermediate between a page that strongly relies on user data, and thus needs client-side rendering or request-time rendering (aka SSR), and a totally public page that allows build-time rendering (aka static rendering or SSG) .

“What if I told you you don’t have to bloat the URL for Static Site Generation”

I’ve made up a word to describe a new pattern that will solve those issues: Rainbow Rendering. Why Rainbow? Because it means you can render the same page in multiple colors.

“What if I told you static rendering is implicitly relying on the existence of an incoming request since it uses the URL”

I’ve described Rainbow Rendering from the developer standpoint. There is a small condition for it to work in practice: you need a micro-server to process the request, so that cookies and headers are set correctly.

  • redirecting to the right variation of the page.
The Unicorn of Rainbow Rendering, seen from above. Rainbow rendering works in 3 steps: 1. Parsing and securing the request using a micro-server (static server like Apache, Nginx, or a small Node server) 2. Rendering different variations of the pages based on the secure request (normally, it’s done at build-time) 3. Return the right variation.

Ahem… Rainbow Rendering is currently theoretical. I believe implementation in Next.js would become possible provided that:



Source link