Framer CMS to Next.js: what happens to your collections, and how to move them to a database

Framer CMS collections in Next.js become JSON files with a schema. Edit records, add items, then move them to a database or headless CMS.

Published
Updated
Reading time
11 min
Deframer cover: “Every collection, now a JSON file.” Beside it, two cards, Framer CMS to JSON, with JSON selected
On this page9 sections

When you move a Framer site to Next.js with Deframer, each Framer CMS collection becomes two files: src/cms/<collection>.json with the records and src/cms/<collection>.ts with a typed schema. Detail pages are prerendered from those records, so content ships with your code. You can edit the JSON directly, or later move the records into a database or headless CMS and keep the same shape. The CMS files are the same if you convert to TanStack Start, Astro, React Router or Vite instead.

That trade-off suits many sites well, and it is worth understanding before you start editing. This guide walks through the files and the detail routes, then shows how to change a record, add a new item, work with rich text and images, handle several languages, and finally move the collection into a database or headless CMS without changing your URLs.

The two files per collection

A collection called "Blog" in Framer becomes src/cms/blog.json and src/cms/blog.ts. Field names are readable (title, slug, publishedDate, thumbnail) and appear in the same order as in the CMS.

Here is one record (real output from a converted template, shortened):

json
{
  "id": "cImcpXX5N",
  "title": "How to Create a Lasting Impression",
  "slug": "how-to-create-a-lasting-impression",
  "publishedDate": "2025-02-28T00:00:00.000Z",
  "category": "Branding & Identity",
  "thumbnail": {
    "src": "https://framerusercontent.com/images/….jpg",
    "srcSet": "… 512w, … 810w",
    "pixelWidth": 810,
    "pixelHeight": 790,
    "alt": "Blog Image"
  }
}

The .ts file describes the field types and wraps the records in a JsonCollection from the project's runtime kit (@/deframer). Shortened, it looks like this:

ts
import { JsonCollection } from "@/deframer";
import records from "./blog.json";

const schema = {
  id: { type: "string" },
  title: { type: "string" },
  slug: { type: "string" },
  publishedDate: { type: "date" },
  thumbnail: { type: "responsiveimage" },
  content: { type: "richtext" },
};

// Records live in ./blog.json; edit them there.
const Blog = {
  collectionByLocaleId: {
    default: new JsonCollection({ schema, records /* … */ }),
  },
  displayName: "Blog",
  id: "blog",
};
export default Blog;

Pages and components query the collection through the kit, the same way the Framer design filtered, sorted and paginated it. You rarely need to touch the .ts file; the JSON is where content changes happen. For the wider folder layout, see what you get in a converted Next.js project.

A Framer CMS collection called Blog becomes two files: src/cms/blog.json with the records, and src/cms/blog.ts with the field types, wrapped in a JsonCollection
Each collection becomes its records and a typed module that reads them.

How are Framer CMS detail pages built in Next.js?

Each CMS detail page becomes a dynamic route with generateStaticParams, so every item is prerendered at build time. A Framer page at /blog/:slug becomes src/app/blog/[slug]/page.tsx, and the parts that matter look like this (shortened):

tsx
// The full published item list also validates on-demand requests in live previews.
const publishedItemParams: Array<{ slug: string }> = [{ slug: "how-to-create-a-lasting-impression" } /* … */];

// Title, description and social image of every CMS item, evaluated at conversion time.
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
  const values = await params;
  assertPublishedItem(values);
  return Object.hasOwn(itemMetadata, values.slug) ? (itemMetadata as Record<string, Metadata>)[values.slug] : {};
}

// Every CMS item is prerendered; other URLs answer with the 404 page.
export const dynamicParams = false;

export function generateStaticParams() {
  return publishedItemParams;
}

publishedItemParams lists every item at conversion time, generateStaticParams returns it, and dynamicParams = false means any slug not in that list gets the 404 page (assertPublishedItem calls notFound() for the same reason). generateMetadata reads metadata.json in the same folder, which holds each item's title, description, Open Graph and Twitter data. In Next.js 16, params is a Promise, which is why it is awaited. The Next.js docs on generateStaticParams describe the API itself.

This is the key point for editors: a record in the JSON alone does not create a page. The route needs to know about the slug too.

Editing an existing record

  1. Open src/cms/blog.json and find the record by its slug or title.
  2. Change the field values. Keep the types the schema expects: dates as ISO strings ("2025-02-28T00:00:00.000Z"), images as objects, rich text as a JSON tree (below).
  3. If you changed the title or summary that appears in search results and social cards, update the matching entry in src/app/blog/[slug]/metadata.json as well. It was evaluated at conversion time and doesn't read the JSON record.
  4. Run npm run dev and check both the list page and the detail page.
  5. Commit, rebuild and redeploy.

Changing a slug changes a URL. If the old URL was indexed or linked, add a redirect for it; the SEO guide for moving off Framer covers redirects in next.config.ts.

Adding a new item

Adding an item touches four places. Follow them in order.

  1. Add the record. Copy an existing record in blog.json, give it a new unique id (any string not already used in the file) and a new slug, then fill in the fields. Some collections have fields that hold another item's id, such as a "next post" link; check whether your neighbors need updating.
  2. Add the slug to the published list that generateStaticParams returns, publishedItemParams in src/app/blog/[slug]/page.tsx:
tsx
   const publishedItemParams: Array<{ slug: string }> = [
     { slug: "how-to-create-a-lasting-impression" },
     // …
     { slug: "my-new-post" },
   ];
  1. Add its metadata to src/app/blog/[slug]/metadata.json, keyed by slug, following the shape of the existing entries:
json
   "my-new-post": {
     "title": "My New Post",
     "openGraph": { "type": "website", "title": "My New Post", "description": "…", "images": ["…"], "url": "/blog/my-new-post" },
     "twitter": { "card": "summary_large_image", "title": "My New Post", "description": "…", "images": ["…"] },
     "alternates": { "canonical": "/blog/my-new-post" }
   }

A top-level "description" is also valid here if you want a specific summary for search results.

  1. Add the URL to public/sitemap.xml. The sitemap is a copy of the one the site published, so it doesn't update itself.

Then run npm run build. A slug missing from step 2 shows up as a 404, which makes the mistake easy to spot. Removing an item is the same list in reverse.

If you'd rather derive generateStaticParams from the JSON instead of listing slugs by hand, that is a reasonable refactor. Keep the output the same and test the build.

Rich text

Rich text fields become a readable JSON tree that the kit renders. A paragraph with bold text looks like this:

json
[
  { "type": "h6", "children": ["Understanding Branding in Business"] },
  { "type": "p", "children": ["Branding is more than just a logo."] },
  { "type": "p", "children": [{ "type": "strong", "children": ["Recognition"] }] }
]

Links point at paths, and components embedded in rich text are referenced by name. The collection's .ts file maps those names to components, for example a YouTube embed:

ts
const YouTube = lazy(() => import("@/vendor/you-tube"), "Youtube");
const richTextComponents = { YouTube };

For long edits, it is often easiest to write the text elsewhere and convert it to this tree with a small script you add, rather than hand-typing nested arrays.

Images

Image fields hold src, srcSet, pixelWidth, pixelHeight and alt. By default the URLs point at Framer's CDN (framerusercontent.com). If you converted with "Assets in the project", they point at files in public/images/ instead.

For a new image you supply yourself:

  1. Add the file to public/images/, for example public/images/my-new-post.jpg.
  2. Set src to /images/my-new-post.jpg, and pixelWidth and pixelHeight to the file's real dimensions so layouts reserve the right space.
  3. Write a meaningful alt.
  4. For srcSet, list the sizes you actually have. With one file, a single entry such as "/images/my-new-post.jpg 1200w" is valid.

The trade-offs between CDN and local files are covered in Framer fonts and assets: CDN vs local.

Sites with several languages

On a multi-locale site, records that differ by language get their own file per locale, such as src/cms/blog.ja-jp.json, next to the default blog.json. A locale file exists only when its content differs. Edit each language in its own file and keep id and field names aligned across them. Per-locale titles and descriptions for detail pages live in the route's metadata.json. The multi-locale guide explains the [locale] route tree.

When should you move Framer CMS content to a database?

Move it when the JSON workflow starts to slow people down: non-developers publish often, you need drafts, scheduled posts or editorial review, or a collection grows to hundreds of items that nobody wants to review as one file. Until then, JSON in the repository is versioned, reviewable in pull requests and free to host.

JSON in the repo (as converted)

Your own database

Headless CMS

Who edits

Developers, through Git

Your app or an admin you build

Editors, in the CMS's interface

Drafts and scheduling

By branch, by hand

You build them

Usually built in

New item goes live

Commit, rebuild, redeploy

Rebuild (or on-demand rendering)

Rebuild on publish (webhook)

Extra running cost

None

Database hosting

CMS plan

The safest migration keeps two things fixed: the record shape the views already read, and every published URL. Do both, and the generated components and pages barely change. If you are choosing a headless CMS, adding a headless CMS to a converted Framer site walks through a build-time sync and a fetch-in-server-components approach in detail; the steps below are the parts every target shares, plus a small database example.

1. Map the schema field by field

The collection's .ts file is your source of truth for types. Map each field before you create tables or content models:

Field in src/cms/<collection>.ts

In a SQL database

In a headless CMS

id (string)

Primary key, keep the existing value

A text field holding the old id

slug (string)

Unique text column

Slug field, marked unique

string, enum

Text (with a check constraint for enums)

Text, or a select with the same options

date

timestamptz

Date-time field

number, boolean

Numeric, boolean

Number, boolean

responsiveimage

JSON column, or src, width, height, alt columns

Asset or image field

richtext

JSON column holding the existing tree

The CMS's rich text field, after conversion

Reference to another collection

Column holding the other item's id (a join table for lists)

Reference field

Keep the old id values. Reference fields in the JSON hold another item's id, so changing ids breaks those links unless you remap every reference in the same import.

2. Keep slugs exactly as they are

A slug is a URL. Import every slug unchanged, and make it unique in the new store, so /blog/how-to-create-a-lasting-impression stays where it is. If you want to clean slugs up, do it later as a separate change with a redirect for each old path; the SEO guide for moving off Framer covers redirects in next.config.ts.

3. Decide what to do with rich text

The rich text tree shown above is plain JSON, which gives you two options:

  • Store the tree as it is (a JSON column, or a JSON field in the CMS). The kit's renderer keeps working and nothing visual changes. This is the low-risk choice for a database.
  • Convert it to the CMS's format (Portable Text, Lexical, Markdown and so on) with a one-off script. Editors then get a real editor, but you also need to render that format, so test headings, links, lists and embedded components such as the YouTube example.

4. Move or keep the images

Image fields point at Framer's CDN unless you converted with "Assets in the project". Before relying on a new store, download every image the records reference and upload it to your CMS's asset storage or your own bucket, then rewrite src, keeping pixelWidth, pixelHeight and alt. Files already in public/images/ can stay there.

5. Read from the database in server code, then build

The generated views query collections through the kit in client components, so database credentials must never reach them. Keep the views reading the record shape they know, and do the database work on the server: in the route files, and in a small script that writes the JSON before each build.

Here is a minimal module using the postgres package (npm install postgres) and a blog_posts table; any database client works the same way. This is code you add:

ts
// src/lib/blog-db.ts (added). Import it only from route files and scripts, never from client components.
import postgres from "postgres";

const sql = postgres(process.env.DATABASE_URL!);

type ImageValue = { src: string; srcSet?: string; pixelWidth: number; pixelHeight: number; alt: string };

type BlogRow = {
  id: string;
  slug: string;
  title: string;
  published_date: Date;
  category: string;
  thumbnail: ImageValue;
  content: unknown; // the rich text tree, stored as JSON
};

export async function listBlogSlugs(): Promise<Array<{ slug: string }>> {
  return sql<Array<{ slug: string }>>`select slug from blog_posts where published order by published_date desc`;
}

export async function getBlogPost(slug: string): Promise<BlogRow | undefined> {
  const [row] = await sql<BlogRow[]>`select * from blog_posts where slug = ${slug} and published`;
  return row;
}

export async function listBlogRecords() {
  const rows = await sql<BlogRow[]>`select * from blog_posts where published order by published_date desc`;
  // The shape src/cms/blog.json already uses, so the views don't change.
  return rows.map((row) => ({
    id: row.id,
    title: row.title,
    slug: row.slug,
    publishedDate: row.published_date.toISOString(),
    category: row.category,
    thumbnail: row.thumbnail,
    content: row.content,
  }));
}

The detail route then takes its slugs and metadata from the database instead of the lists written at conversion time:

tsx
// src/app/blog/[slug]/page.tsx (edited: replaces publishedItemParams and the metadata.json lookup)
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { getBlogPost, listBlogSlugs } from "@/lib/blog-db";

export const dynamicParams = false;

export async function generateStaticParams() {
  return listBlogSlugs();
}

export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
  const post = await getBlogPost((await params).slug);
  if (!post) notFound();
  const url = `/blog/${post.slug}`;
  return {
    title: post.title,
    openGraph: { type: "website", title: post.title, images: [post.thumbnail.src], url },
    twitter: { card: "summary_large_image", title: post.title, images: [post.thumbnail.src] },
    alternates: { canonical: url },
  };
}

And a script refreshes the JSON the views read, run before every build:

ts
// scripts/export-blog.ts (added)
import { writeFileSync } from "node:fs";
import { listBlogRecords } from "../src/lib/blog-db";

const records = await listBlogRecords();
writeFileSync("src/cms/blog.json", JSON.stringify(records, null, 2) + "\n");
console.log(`src/cms/blog.json: ${records.length} records`);
process.exit(0);

Add "prebuild": "tsx scripts/export-blog.ts" to package.json (with tsx as a dev dependency), so npm run build always starts from current data. Copy the title format from the old metadata.json (a site-name suffix, for example) so pages don't change in search results, and keep public/sitemap.xml in step or replace it with a generated app/sitemap.ts.

6. Check the switch like a migration

  1. Run npm run build against the new store and compare the number of prerendered detail pages with the number of records you started with.
  2. Diff the regenerated src/cms/blog.json against the converted one. Apart from ordering and image URLs you moved on purpose, it should match.
  3. Request every old detail URL on a preview deployment and expect 200; request a made-up slug and expect 404.

Deframer is an independent tool and is not affiliated with, endorsed or sponsored by Framer. It reads the CMS content your published site already serves and needs no access to your Framer editor. More on what Deframer reads and keeps is in the FAQ.

FAQ

Does the converted site still read from Framer's CMS?

No. The records are copied into src/cms/*.json at conversion time, and the project needs nothing from Framer to run. Images may still load from Framer's CDN unless you converted with "Assets in the project".

Why does my new CMS item show a 404?

Its slug is missing from the list generateStaticParams returns (publishedItemParams in the route file). Detail routes use dynamicParams = false, so only listed slugs are prerendered; add the slug and its metadata.json entry, then rebuild.

Can I add a new field to a collection?

Yes. Add the field to every record in the JSON and to the schema in the collection's .ts file, then use it in the view or component that renders the item. Keep the type consistent with existing fields of that kind.

Do I need to redeploy after editing content?

Yes. The JSON is part of the build, so content changes ship with your next deployment, just like code changes.

How do I move Framer CMS collections to a database?

Map each field in the collection's .ts schema to a column, import the JSON records with their existing id and slug values, and keep rich text as a JSON tree at first. Then read slugs and metadata from the database in the detail route, and regenerate src/cms/<collection>.json from it before each build so the views don't change.

Will moving to a headless CMS change my URLs?

Only if the slugs change. Import every slug unchanged and keep the same route folder, and each item stays at the URL Framer published; add redirects for any slug you rename later.