---
title: "Framer CMS to Next.js: JSON, Database or CMS | Deframer"
description: "Framer CMS to Next.js: collections become JSON with a schema. Edit and add items, build detail routes, then move records to a database or headless CMS."
url: https://deframer.co/blog/framer-cms-to-json-in-nextjs
---

# 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.

Deframer

**Published**

26 September 2026

**Updated**

1 November 2026

**Reading time**

11 min

- [CMS](https://deframer.co/blog?tag=cms)
- [JSON](https://deframer.co/blog?tag=json)
- [Next.js](https://deframer.co/blog?tag=nextjs)
- [Migration](https://deframer.co/blog?tag=migration)

![Deframer cover: “Every collection, now a JSON file.” Beside it, two cards, Framer CMS to JSON, with JSON selected](https://deframer.co/_next/image?url=%2Fapi%2Fcms%2Fmedia%2Ffile%2Fframer-cms-to-json-in-nextjs.webp&w=3840&q=75)

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](https://deframer.co/framer-to-tanstack-start), [Astro](https://deframer.co/framer-to-astro), [React Router](https://deframer.co/framer-to-react-router) or [Vite](https://deframer.co/framer-to-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](https://deframer.co/blog/what-you-get-in-a-converted-nextjs-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](https://deframer.co/api/cms/media/file/collection-files.webp)

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`](https://nextjs.org/docs/app/api-reference/functions/generate-static-params) 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](https://deframer.co/blog/seo-when-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](https://deframer.co/blog/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](https://deframer.co/blog/multi-locale-framer-sites-in-nextjs) 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](https://deframer.co/blog/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](https://deframer.co/blog/seo-when-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`.

Note

With `dynamicParams = false`, a new row gets a page on the next build, and the build needs to reach the database. If you want new items to appear without a rebuild, allow dynamic params and set a revalidation policy instead; check the Next.js docs for the caching options in your version.

### 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](https://deframer.co/#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.

Deframer

## Move your Framer site to clean code.

Convert your site free, review the result, then download it as a TypeScript project you own: Next.js, Astro, React, TanStack Start, React Router, Nuxt or HTML.

[Convert your site](https://deframer.co/dashboard)[Pricing](https://deframer.co/pricing)

## Keep reading

[All posts](https://deframer.co/blog)

- ![Deframer cover: “Every problem, with a fix.” Beside it, four tiles, Layout, Animations, CMS and Builds, with Animations selected](https://deframer.co/_next/image?url=%2Fapi%2Fcms%2Fmedia%2Ffile%2Fframer-to-nextjs-migration-problems.webp&w=3840&q=75)

  Migration 25 Oct 2026 15 min read

  ### [Framer to Next.js migration problems: a database of real issues and fixes](https://deframer.co/blog/framer-to-nextjs-migration-problems)

  Real Framer to Next.js migration problems by category, each with symptoms, cause, fix and whether Deframer handles it, from our own test runs and code.
- ![Deframer cover: “Five sites, real results.” Beside it, a list of Landing, Agency, Portfolio, CMS blog and Multilingual with Multilingual selected](https://deframer.co/_next/image?url=%2Fapi%2Fcms%2Fmedia%2Ffile%2Fframer-to-nextjs-conversion-tests.webp&w=3840&q=75)

  Migration 25 Oct 2026 8 min read

  ### [Framer to Next.js: real conversion tests on five different websites](https://deframer.co/blog/framer-to-nextjs-conversion-tests)

  We converted five public Framer sites to Next.js and measured routes, builds, pixel differences and errors: what worked, what broke, what we fixed.
- ![Deframer cover: “Forms that post to your route.” Beside it, a list of Contact form, API route and Webhook or email with API route selected](https://deframer.co/_next/image?url=%2Fapi%2Fcms%2Fmedia%2Ffile%2Fforms-after-leaving-framer.webp&w=3840&q=75)

  Forms 24 Sep 2026 11 min read

  ### [How to migrate Framer forms to Next.js without losing submissions](https://deframer.co/blog/forms-after-leaving-framer)

  Migrate Framer forms to Next.js without losing submissions: route handlers, webhook mapping, a parallel run, spam protection and monitoring.
