Skip to content

Bachelor's Thesis: Remix.run and Next.js for E-Commerce Platforms

TypeScript LaTeX
Written Report Next.js Codebase Remix.run Codebase

Warning

Keep in mind this Thesis was written in 2023. The frontend world moves fast, and results from 2023 will not represent the current states of either Remix (React Router v7+) or Next.js

For my Bachelor's Thesis, I tackled the question of what criteria a Frontend Framework must meet to be a viable option for use in E-Commerce Platforms. This thesis acts as follow-up to developing a reference-implementation of a headless E-Commerce platform as part of a student employment.

While my previous work focused on the backend part and Nuxt, the thesis takes aim at the React ecosystem and compares the de-facto standard, Next.js, to the emerging Remix.run.

To make meaningful comparisons, the same minimal E-Commerce Frontend was implemented in both Next.js and Remix.run. Both implementations tried to stick to the same set of libraries and tooling while diverging in the Framework-specific paradigms for Routing and Data handling.

The thesis set forth the following criteria that are important for an E-Commerce Platform:

  • There are mechanisms in place to enable a secure connection, or more concrete: The Platform must support TLS. As this is primarily handled by a reverse proxy in most setups, it was deemed irrelevant for evaluating Remix and Next.
  • Time to first byte and First contentful paint are important in keeping a user engaged with the site. If the site takes too long to load, search engines will deprioritize the platform and users will move to other platforms if they feel like the site is stuck.
  • Developer Experience and Adoption is also tangentially important as it becomes more costly to implement a Platform using the technology if the documentation is poor, paradigms unintuitive, or if the talent pool is too small.

That second criteria resulted in a deeper analysis of the Lighthouse metrics, server response times and bundle sizes of both implemented reference implementations. You can find it in Chapter 7 in the PDF.

Using Locusts, requests were made against both implementations. The results showed that Next.js has a considerably worse cold start. After the initial requests, Next.js requires a bit longer to respond to requests under load. However, this delta is minimal and not conclusive.

One finding of note is the transport compression and bundle size. Remix's JS Bundle managed to be significantly smaller than Next.js' while uncompressed, going as far as being only 61% the size of Next. However, this gap closed to only 43% when compressed. This implies that Next.js' bundle is either in a shape that can be compressed more effectively, or that Remix is using a worse, but potentially faster, compression strategy.

Another interesting finding is that Remix's Lighthouse Metrics are considerably worse. This however appears to be a bug where Lighthouse does not treat the server-rendered initial HTML to stipulate first contentful paint, first meaningful paint, Speed Index or Time to Interactive requirements, causing the metric to only be met once the client hydrates. On the one page where this does not happen, Next.js slightly beats Remix for FCP, FMP and SI, while losing for TTI and LCP. You can find the relevant graph on Page 31. The deviation in the Lighthouse metrics seems to be tied to the use of lazy-loaded images.

The thesis concludes that both frameworks are valid options for E-Commerce platforms and that the performance difference between both frameworks is negligible. The main difference is the Developer Experience, where Next.js scores with a more mature ecosystem, while Remix.run has the advantage of a more DRY approach.