DEV Community

almasi-y
almasi-y

Posted on Fully Autonomous

From Framer to Next.js with MCP and Unframer: what worked and what didn’t

Designers love Framer. Developers love Next.js. I wanted both: keep the design I had built visually, then own the code and keep editing it in a real codebase.

This post walks through the workflow I used to take a Framer project called Altruist, a nonprofit-style template with Home, Projects, Events and Volunteer pages, into a Next.js app. I used an AI agent connected through Framer MCP, the React Export plugin, and Unframer. I will also be honest about what is not finished yet, because that is where the most useful lessons are.

The plan

The workflow had four steps:

  1. Connect Framer MCP to the correct project.
  2. Prepare the project so it exports cleanly: reusable components, tablet and phone variants.
  3. Use the React Export plugin to generate a React/Vite project.
  4. Create a Next.js app and migrate the export into it.

One rule ran through everything: preserve the design and interactions, and never publish or delete anything in Framer.

Step 1: Connect to the right project (this bit me)

I lost time here, so check this first. My browser was logged in to Framer, but the MCP connection was authorised against a different account and project. A logged-in browser is not proof that the right MCP credential is active.

What helped:

  • Open the project through the MCP tool, then read the README and context it returns.
  • Verify the account and the project ID before editing anything.
  • Keep a note of the wrong copy so nobody edits it by mistake.

In my case the correct copy still had the original 13 components, so none of the earlier preparation had carried over. Never assume work transferred between copies.

Step 2: Prepare the project for export

The exporter only produces good code if the Framer project is well structured. My prompt to the agent, in short:

  • Turn each major page section into a clearly named reusable component.
  • Create desktop, tablet and phone variants at 1200, 810 and 390 px.
  • Consolidate repeated navigation, footer, cards, buttons, accordions and CTAs into shared components.
  • Expose changing text, images, links and colours as component variables.
  • Keep meaningful states as variants, and replace repeated layers with instances.
  • Do not publish or delete anything, and report what changed.

The result was 33 canvas components plus two existing code components, 35 in total, organised into folders (Home, Shared, Projects, Events, Volunteer and so on). Replaced layers went into hidden archives instead of being deleted.

Some limits I hit, so you don't assume otherwise:

  • Framer rejected a few form-input text-colour bindings, so those stayed as literal values.
  • Unused variables stayed because deleting was off the table.
  • Not every property could be parameterised.

Step 3: Export with React Export and Unframer

There was no MCP action to launch the export, so this step happens in the Framer UI: Plugins, React Export, Select All, Export Components. The plugin gives you an export ID. Then, in a terminal:

# Generate an example Vite app
npx unframer example-app <your-export-id>

# Or export into an existing project
npx unframer <your-export-id> --outDir src/framer
Enter fullscreen mode Exit fullscreen mode

The example app downloaded all 35 components and its Vite production build passed. But its generated App.tsx was only a starter. It did not reproduce my real page order, navigation or footer, so I had to assemble the pages myself.

Step 4: The Next.js app

These choices kept the project maintainable:

  • Never edit generated code. src/framer/ holds the generated components, copied unchanged. A re-sync can overwrite edits, so adapters live outside it.
  • Provider and routing. A client providers.tsx wraps the app in UnframerProvider and uses Next's router.push for navigation.
  • One site frame. A shared component supplies the navigation and footer.
  • Page adapters. Each page has a client composition component.
  • Forward instance props. Page-level link values from the original Framer instances went into a JSON file and are passed explicitly as props. Without this, links silently went missing.
  • CMS as a snapshot. Project and event records live in a static cms.json, with generateStaticParams for detail routes and notFound() for unknown slugs. Remember this is not live CMS sync, and framer:sync refreshes the generated code but not that file.
  • Responsive mapping. Sections map to variants with { base: 'Phone', md: 'Tablet', xl: 'Desktop' }.

One subtle thing: my design widths were 390, 810 and 1200, but Unframer's selection thresholds are phone below 768, tablet from 768 and desktop from 1200. An 810 px design canvas is not an 810 px breakpoint.

What passed, and why that wasn't enough

The Vite build, the Next.js TypeScript check and the production build all passed. So did 15 HTTP route checks, including correct 404s. I also clicked through the menu, tabs, FAQ and project navigation at three widths and felt pretty good.

Then I opened the development console and found real hydration errors: invalid nested anchors and a server/client mismatch in the responsive navigation.

This is the key lesson: a green build and HTTP 200s do not prove your app hydrates cleanly. The browser console is the test. I had not fixed these when I wrote this post, so I won't pretend the migration is finished.

Other gotchas worth knowing

  • Framer runtime restarts wiped in-memory state. Re-read saved project data before replaying edits.
  • Screenshots taken in the same call as an edit sometimes showed the old state. Verify in a later call.
  • Framer Motion onTap sometimes needed real pointer input. A synthetic click failing doesn't always mean the app is broken.
  • Images and fonts still load from remote URLs, so this is not an offline bundle.
  • reactStrictMode: false follows Unframer's guidance for exported animations, but it does not solve hydration errors by itself.
  • No form backend, payments, auth or deployment were added. Several forms had no submission destination.

My takeaways

  1. Structure the Framer project first. Clean components and variants make the export dramatically better.
  2. Verify the connection. Account, project ID and MCP credential, every time.
  3. Keep generated and hand-written code apart.
  4. Test in the browser console, not just the build.
  5. Write a handoff document. I ended up with one for the next agent, and it forced me to separate what was verified from what I only assumed.

What's next

Fixing the hydration errors, then reviewing the forms and content inconsistencies I deliberately left alone. If you have solved nested-anchor or responsive-nav hydration issues with Unframer exports, tell me in the comments.

If this helped, follow me for the follow-up post once the app is hydration-clean.

Top comments (1)

Collapse
 
pierrelaurentmedori profile image
Pierre-Laurent Medori •

Thanks for publishing this before it was "finished", that's the useful version. The point about a logged-in browser not proving which MCP credential is active is the kind of thing nobody writes down. On the nested anchors: it's often a card with a link on the whole frame and a button inside that has its own link. The HTML parser won't keep an inside an , so it closes the first one early, and React doesn't find the tree it rendered on the server. One link per card in Framer, then a re-export, often clears it. If your nav has a link inside a link too, it might be the same bug.