December 17, 2021 | 10 Min
Introducing Fresh API: Build Static Sites Faster
- Product updates
What is Fresh API?
It’s an API (application programming interface) profile designed for static site generation (see below), with a higher, burstable rate limit that always uses fresh data, that bypasses our content caching layer.
What is static site generation (SSG)?
It automates the task of coding individual HTML pages so they’re ready to serve to users ahead of time.
Why is SSG a good architectural approach for websites?
It allows you to build websites faster. It can handle higher volumes of traffic. And it’s more secure than other methods like server-side rendering.
Why is Fresh API better for SSG sites?
Fresh API skips our caching layer, allowing you to speed up the build process.
Rather than waiting up to five minutes for the cache to clear the build process starts immediately.
And because Fresh API has a higher, burstable rate limit you can build larger, more complicated static sites faster too. This is great for marketing teams as the public can see any website changes much more quickly after they’re published.
What are the alternatives to SSG?
Progressive web app (PWA)
A website that looks and behaves as if it is a mobile app. PWAs are built to take advantage of native mobile device features without the end user having to download an app. They remove the need for ecommerce merchants to develop native applications for multiple mobile operating systems.
Single page application (SPA)
They dynamically rewrite the current page rather than loading entire new pages from the server. In other words, a page refresh never occurs and content is dynamically requested and added to the page view. To make things extra confusing, A SPA can be a PWA, but a PWA does not have to be a SPA.
Server-side rendering (SSR)
Visitors request pages from the server and the server handles the query and assembles a page to respond with, typically via a model view controller (MVC) pattern. Servers handle logic and requests to databases and assemble content into page templates.
When is SSG relevant?
When you want to have a performant site that loads faster
If you’re running a small, content-driven website or blog
When you’re looking for a simple experience and you don’t need personalized, interactive, or frequently changing content
What if you’ve got a complex experience and/or large eCommerce website?
In this case it likely makes sense to adopt a hybrid approach for static vs dynamic content displayed on any given page.
You can load pages with static content first via SSG and then add specific dynamic elements to the page when it comes to more fluid information like price or stock availability.
If your site has 10s of 1000s of pages it’s best to use progressive build processes. Otherwise it could take minutes – even hours – to complete the build process every time your content changes.
Evaluating headless solutions?
Not all APIs are created equal.
We’ve put together a quick reference table below that quickly demonstrates the differences between Amplience, Contentful and Contentstack when it comes to rate limits and the ability to skip cached API responses.
This information is up to date as of the time this blog post was published to the best of our knowledge.
|Rate Limit (Cache)||Unlimited||Unlimited||Unlimited|
|Cache Control (Purge)||No||No||No|
|Specify whether you want a cached response or not||Yes (Content Delivery API vs Fresh API)||No||No|
|Base Line Rate Limit (Uncached)||100 RPS||55-72+RPS||100 RPS|
|Burst Limit||+100 RPS (200 RPS)||No Information Available||No Information Available|
Getting started with Fresh API
Using the Fresh API is simple; you authenticate with your Fresh API keys and then ensure you’re requesting your content from the Fresh URL endpoint. For more detailed instructions on how to get started with Fresh, Check out our Fresh API docs now.
if you’d like to discuss getting a set of Fresh API keys please get in touch with your customer success manager or contact firstname.lastname@example.org.