Headless Webflow with Next.js: building next-webflow

Published on

Until September 2026, Webflow wasn't on my radar.

But that changed at Nerdearla. I stopped by the Webflow booth and ended up chatting with some members of the team about the product and how they work.

That same day, Utkarsh Sengar (Webflow's CTO) gave a talk about Source, an agentic marketing and web development platform.

After all that, I was curious to learn more about the Webflow ecosystem.

Could I use Webflow's CMS as the backend for nnaro.dev (Next.js)?

I started digging into Webflow's API. Getting content into Next.js was easy enough, but I quickly realized there was more to it: types, caching, webhooks, and previews.

That curiosity ended up as my first npm package: next-webflow. It's out as a beta with a live demo powered by Webflow CMS. Even the post you're reading right now comes from Webflow.

What it does

  • Types from your site. Generate types from your Webflow CMS, so you can work without guessing field names.
  • Cached until you publish. Content is cached by Next.js and refreshed when you publish changes in Webflow. No need to rebuild or wait for the cache to expire.
  • Draft previews. See unpublished content on your site before making it public.
  • Components for Webflow content. Display rich text and images from Webflow using components built for Next.js.

Works with Next.js 15 and 16 (App Router).

Design decisions

No TTL. Instead of expiring after a set time, the cache is invalidated when content is published in Webflow. Publishing a post refreshes the affected pages, while publishing the entire site refreshes everything.

Names, not IDs. Webflow stores dropdown values as IDs. The library returns names too, and a rename shows up on the next publish.

Previews by item, not by URL. Preview links keep working even if an editor changes a post's URL while working on it.

Fewer API requests. Webflow has API rate limits, so the library fetches each collection only once during a build instead of making a request for every page.

Why not the official SDK?

Webflow already has an official SDK, webflow-api, that covers its entire API.

next-webflow focuses specifically on using the Webflow CMS with Next.js, handling things like types, caching, webhooks, and previews.

If you need to write data to Webflow, use the official SDK. You can also use both: the SDK to create content, next-webflow to show it.

What I learned about Webflow's API

Since I was new to Webflow, I tested everything against the actual API using a free test site. Most things worked as documented, but I found a few surprises:

  • Rich Text comes back exactly as it was saved. Scripts included, so clean it before showing it outside Webflow. The library does that for you.
  • The "item published" webhook sends a list of items. The docs show a single item.
  • Video fields come back with extra data. The docs describe just the URL.
  • Deleted items keep showing up. They stay in published lists until the whole site is published again.
  • Code blocks come back empty. That's why this post has no code samples.

The library handles the first three. You can find workarounds for the others in the known limitations.

Webflow Cloud

Webflow Cloud lets you host a Next.js app on your Webflow domain, so I wanted to see if next-webflow would work there too.

It does, but caching needs some extra setup. By default, the cache doesn't persist between requests, so automatic updates won't work. A small configuration file that keeps the cache in Cloudflare's storage solves this, and in my tests, changes showed up about a second after publishing.

I've documented the setup in the Webflow Cloud guide, and official support is planned for version 0.2.

Security

  • Signed webhooks. Only requests verified as coming from Webflow can trigger content updates.
  • Secure previews. Preview links are signed and expire automatically, without exposing secrets in the URL.
  • Safe Rich Text. HTML content is sanitized before being rendered.
  • Verified releases. Every version is automatically built and tested, but publishing to npm requires my approval with two-factor authentication. Releases also include a signed record of how they were built.

How I built it

I built next-webflow using an AI coding agent, inspired by Utkarsh's talk. The agent wrote most of the code and tested it against the real API, while I made the design decisions and reviewed every change.

From the beginning, I kept a file with rules for the agent: check the documentation and the real API before making assumptions, never commit secrets, and ask me before making design decisions.

Rules and passing tests weren't enough, though. I still had to make sure the architecture made sense, especially around caching, security, and API limits.

Using an AI coding agent? Add the next-webflow skill with npx skills add crashncrow/next-webflow so it follows the same setup and rules.

Try it

Install it with npm install next-webflow and follow the quick start. You can also check out the example blog, which powers the live demo.

It's still in beta, so some things may change before the first stable release. If you use Webflow with Next.js, I'd love your feedback in the issues.

I'm looking forward to exploring Source. After building with Webflow from the outside, I'd love to see what it's like from the inside.

And if you were at the Webflow booth at Nerdearla, thanks for the conversation.

Need a Senior Software Engineer?

I'm open to new roles. Let's talk about what your team is building.