People sometimes get confused about how NitroPack compares to Cloudflare’s Automatic Platform Optimization (APO) service.
To start, let’s clear up the biggest misconception on the topic:
NitroPack and APO don’t do the same thing.
Both services help with site speed but do so in entirely different ways. That’s why you can use them simultaneously, as long as you configure NitroPack and Cloudflare to work together.
Next, let’s talk about what APO actually does.
This service caches dynamic content with the help of Cloudflare Workers.
The benefit of using it is that your HTML can be cached and served from Cloudflare’s edge network. This mechanism removes unnecessary trips to the origin server. As a result, metrics like Time to First Byte (TTFB) and First Contentful Paint (FCP) may improve.
There’s a whole process that goes on behind the scenes here. We won’t go into it, as it’s not important right now. If you’re interested, check out Cloudflare’s article, specifically the section on how APO works.
For now, just remember that APO’s only purpose is to deliver content to client devices faster. It does that by caching and providing the HTML from the edge location nearest to the client.
However, the bigger challenge with site speed is actually visualizing pages on client devices. If you deliver the page structure to the client but can’t visualize it fast, your website is still slow. This is where NitroPack offers a ton of other benefits.
For example, here are three crucial performance problems that APO doesn’t solve:
- Unoptimized images. Often the biggest reason for slow load times, images must be resized, compressed and converted to the right type;
- Render-blocking resources. Browsers must load, parse and execute all CSS and JS files before rendering a page. Without a resource loading mechanism, this process takes tons of time, hurting the visitor’s experience;
- Lazy load offscreen images. Lazy loading helps the browser load only the images that visitors are currently looking at. Without this technique, browsers load all images on the page, regardless if the user actually wants to see them.
NitroPack deals with these and all other site speed issues automatically.
Here’s a screenshot of our current feature set for a bit more context on what our service actually does:
If you want a more technical deep dive, check out our article on How NitroPack Works.
- NitroPack and Cloudflare’s APO do very different things. They can work together, as long as you go through the configuration process;
- APO lets you cache dynamic content on Cloudflare’s edge locations. This removes trips to the origin server, improving metrics like TTFB and possibly FCP;
- APO does not help with visualizing pages on client devices;
- NitroPack solves many other complex performance issues beyond just delivering page structure to client devices.
Cloudflare offers many valuable products, some of which are a great addition to NitroPack. That's why we've made our service compatible with them. Since each website is different, this decision depends entirely on your personal needs and preferences.
Let us know if there's anything else we can help you with.
Good article, but I still wonder if it would not be best to simply remove Cloudflare and use NitroPack. Unless we are using it for security issues.
Article is closed for comments.