cross icon

NextJS vs RemixJS: How do they compare?

Updated on:Dec 7, 2023Read time: 4 min
mainImg

The web has become the topic of conversation in today's world. Likewise, there are web2.0 and web3.0, and so on. But what exactly is web2.0? An example of Web 2.0 is a website that highlights user-generated content, ease of use, and participatory culture for its users. In late 2004, Tim O'Reilly and Dale Dougherty popularized the term at the first Web 2.0 Conference, which was coined by Darcy DiNucci in 1999.

We live in a world that is dominated by the internet today. Whenever we search for a website, we expect it to appear immediately. We don't have time for patience. According to Amazon

It would cost Amazon $1.6 billion in sales if it had a one second lag in loading

So what made the website so fast? Which technology is most effective for making the browser load faster and more responsive?

For more than 5 years, Next.JS has been the first choice for developers because of its key benefits including its SEO-friendly nature and its fast speed. It is reliable and fast not only on the server-side or to serve static data but also in deploying the website as compared to other platforms like Firebase. 

But the creators of React Router- Ryan Florence and Michael Jackson, officially announced that their framework (REMIX) is much more faster and reliable than Next. JS. This statement attracted a no. of developers around the Globe. 

In this article, we are going to explain the accuracy of the above statement and try to conclude which one is best

Understanding Remix framework

With Remix, you get quickly rendered pages and instant transitions by providing distributed systems and native browser features instead of heavy static builds. This application runs anywhere using the Web Fetch API instead of Node. In addition to supporting serverless and traditional Node.js environments, it already works natively on Cloud-flare Workers. Cloud-flare Workers are a platform for enabling server-less functions to run as close as possible to the end user. Basically, the serverless code itself is cached on the network and is executed when it receives the correct type of request.

Let's also introduce Next JS

On the other hand, Next.js has SSG and SSR. SSR is already on Remix, so let's talk about SSG whenever there are more than 10 pages that contain data provided by API. API values do not change every time, or whenever Next JS creates static pages containing all API values. During build time, it takes more time to build as compared to when we are using SSR. But our request arrived much faster than server-side rendering.

Both Remix and Next JS have the backbone of React JS. Next, JS has its own routing system and an easy development and deployment system. Remix JS, however, has not. In this article, we compare Remix and Next frameworks on multiple parameters and give you insights to help you better decide which one to use for your next project.

If you’re a developer or a company or a business you want to create a website. From your perspective, your website loads in one or two seconds. If your website does not open within ten seconds, the user has left the website. In this article, we discuss 2 experiments made by the Remix community. Let's get into it in detail and try to explain it.

How do they differentiate?

First, we discuss a few points between Next JS and Remix.

  • Remix is as fast as Next.js at serving static content. This will enable a website to provide a high-quality experience for users.
  • Remix is faster than Next.js at serving dynamic content. We get rid of a boring spinning loader.
  • Remix enables smooth user experiences even on slow networks. E.g. Remix loads a page faster on a 3G device than Next.js.
  • Remix automatically handles errors, interruptions, and race conditions, Next.js doesn't.
  • Next.js encourages client-side JavaScript for serving dynamic content, Remix doesn't.

Performance test

Comparing Next JS & Remix to some experiments, what are the differences?

  • Let's take the example of radial code. We made the website in Next JS and deployed using vercel which is the co. that developed Next JS framework. Next JS works faster with Vercel only.
  • In the first test, we copied the exact code and pasted it on remix. Hosting was done on Vercel. The website took 1 seconds to load whereas Next JS take 1.2 seconds to load.
  • In second scenario, when re-write the entire code from scratch, the website only takes 0.7 seconds.
  • Remix chooses an e-commerce app implemented with Shopify API, and Remix uses 2 test cases for comparing the difference. It is interesting to see what happens when the experiment is in progress.

Deliver Static content

Next.js officially released their app using static and server-side rendering apps deployed on Vercel. Check out some examples created by the official Next JS Team. https://nextjs.org/examples  So, in these examples: In this test, it will clear that, when the first time you load or visit a Remix or Next JS website. which one is more fast for render static pages.

Minimal Port - They simply copied/pasted/tweaked the Next.js code to run on Remix instead of Next.js. This is deployed to vercel just like the Next.js Demo. This is a very thorough comparison of frameworks because everything but the framework is the same. Because the components are the same in React. The backbone of both Frameworks in One #React.

Rewrite - The two frameworks don't have much API overlap, and Remix can run on a different infrastructure than Next.js. To really exercise Remix's design, They rewrote the example into idiomatic Remix and even built a quick image optimization route into the app so it's 100% Remix. And you can check the result in the image below.

Gif compare

Basically, all three are loaded too quickly,
1.2s, too fast to capture by human eyes, then take a look at slow motion version as well;

Gif compare

With Deliver Dynamic data

Above we discuss how fast remix and next js have loaded the static pages. so, here we discuss Which framework is better for delivering dynamic content.

Remix uses the same example of an e-commerce app made by the vercel team. they did the same with minimal port and rewrite. and both used the Shopify app to get data from the server. when the user searches how many seconds user get results?

Gif compare

Normal APIs, that are made by the developer are not fast as Shopify APIs are fast because they are well-optimized for the API so it's really quick.

remix rewrite is also won here to get results it took 0.8 seconds to make the user interact with the page. it sends data very quickly on the other hand next took 1.9 seconds means the remix is 2.3X faster for serving dynamic content.

but take a look on the Next JS side. Next, JS sends the HTML very quickly and then shows some loader animation then shows the data image, etc.

Remix requests all API at once while Next JS calls some APIs, waits, and then calls again.

Also, take a look at what is happening behind the scene in network calls when users search data.

The Network waterfall is a 2D visual representation of the sequence of network events happening over a timeline. You can check on the Dev Tools tab of any browser. 

If you don't know what Dev Tools is. I have written a brief article on Dev Tools. Please take a look at the article ➝

RC webflow blog SC

REMIX NETWORK WATERFALL

responsive-web

NEXT.JS NETWORK WATERFALL

responsive-web

We have attached the network waterfall for Remix.JS and NEXT.JS,

In the Next JS App, it will first send static data to the browser and then render images. When images are sent there is some lazy loading while they are downloaded, then NextJS makes an API call on the Client side. You can see the network calls of Next.js while this stuff happens behind the scene.
Next.js Hold Other API calls, when the above request is done.

But Remix said we don't wait for others' things we do everything simultaneously,
In the remix app, the static data, and images + API calls are called together. This is why Remix apps are fully loaded on the browser but Next still loading images.
You can take a look at the above images to see how Remix handles network calls.

In this case Why Next.js is slower?

As part of Next.js, we introduced what we call a "network waterfall request chain". Due to the fact that SSG cannot be used here, the app fetches the search results from the user's browser. Images can't be loaded until data is downloaded, and data can't be fetched until the JavaScript has been loaded, parsed, and evaluated.

In addition to more JavaScript over the network, fetching in the client also means more time spent parsing and evaluating. Parse/Eval can sometimes go unnoticed, but you can see that the JS execution on the 15th request took longer than downloading the document! Compared to Remix, Next.js sends 1.5x more JavaScript, 566 kB to 371 kB unpacked. The network packet is 50 kB smaller (172 kB vs. 120 kB) because it is 50 kB more compressed.

Architecture and specialty

1. Why Next.js is Fast: Next.js uses SSG and SSR. But before we dive into this part we should know about these 2 words. If you’re familiar with SERVER SIDE RENDERING AND STATIC SITE GENERATION. You can skip this part if you wish.

2. Explain SSG: Static site generation. If the website contains 1 page and 10 details pages of a particular product and the data for those details pages came from the API, then those details pages are created by Next.js one by one. 

3. Explain SSR: Server-side rendering means the API call to the landing page is not called on the client side. It is already fetched on the server side. As there is no API call on the client side, we do not have to wait for data to arrive to show data loading. This will create a website fast.

Which one is best for your Next | New Project?

In the IT field, there are numerous excellent frameworks and technologies emerging every year. But what matters for Developers? Consider learning the most recent technology, or what has just been introduced in the past 5 to 10 years. This is if you are a business owner or a newbie in the IT industry. When you're already a developer and want to test and create something for your upcoming portfolio project to enhance your knowledge, then you should take a look at the remix and explore it.

But if you're a business, you have to stick with NextJS. Because NextJS has a huge community. If you have to create a social media app or e-commerce or other larger platform then you have to continue with Next JS. Since the remix is brand-new in the field, it takes a few years for the developers to make it a bug-free product. We cannot say Remix is bug-free. If we create a product, there will be many issues. If we get stuck on any issue and there is no problem in the Remix community, then we will have to solve the issue ourselves, or we will hold to stop letting others solve the issue. 

Conclusion

Yeah, we can say Remix is faster than Next.js. We have discussed more than 2 experiments. They conduct more than 5 experiments, however, so I can't cover them here.  It must have been tedious for you to read the article, but I have covered the main points.  This topic demonstrates that nextJS is not the most appropriate framework.

Although Next .js has a larger community than Remix because it has been around for 5 years it takes time for developers to learn and adapt to something so different. In the IT industry, every day a brand new framework and library enters the game and competes with each other to create a better community. 

Contact Us

Keep reading

Stay up to date with all news & articles.

Email address

Copyright @2024 Radial Code Pvt. Ltd. All rights reserved | RadialCode