Anticode Open builder

How to export an AI-built website to Next.js

Exporting gives you an ordinary Next.js project you own: the pages as React components, server routes for every form, a Postgres database through Prisma and an admin area. To run it you need Node, a Postgres database and five commands. This guide walks through the folders, the first run and what to change first.

Updated · By the Anticode team

When exporting makes sense

A hosted builder is the easy option while the site is mostly pages and forms. Export when you need something the hosted version doesn't do, such as real customer accounts, custom server logic or your own hosting, or when a developer is joining and wants a codebase in version control. You can keep building in Anticode and export again later; an export is a snapshot of the project at that moment.

Getting the code out of Anticode

  1. Open the project in the builder.
  2. In the console's Settings, under Your code, choose Download codebase. You get a zip of the whole project.
  3. Or, to put it straight into version control, connect GitHub in the same section and push to a repository; see how to push a website project to GitHub.
  4. Unzip it and open README.md first. It's written for this specific app.

Both page builds from the design engine and app builds written by the model can be exported this way. If you only need static hosting, the single HTML file export is simpler: one self-contained file you can upload anywhere.

What's in the project

app/
The pages and the API routes (app/api/) for bookings, contact messages, newsletter sign-ups and email sign-in links. Every form posts to one of these.
app/admin/
The admin area, where the owner and team see bookings and messages.
components/sections/
Your page, one typed React component per section, with the words written straight into the JSX.
app/globals.css
The design system: named colour, radius and type tokens at the top.
lib/
Authentication, database access, encryption, validation with Zod, email and site settings.
prisma/
The database schema, migrations (tables, then row-level security) and a seed script that creates the owner account.
tests/
Unit tests and guardrails that fail if a change breaks one of the app's safety promises.

The stack is Next.js with the App Router, TypeScript, and Postgres through Prisma. There's no Anticode runtime or library inside, so nothing stops working if you stop using Anticode.

Run it locally the first time

  1. Install Node (the README gives the minimum version) and check with node -v.
  2. Get a Postgres database. A free one from Neon or Supabase works, or run one locally in Docker; the README has the exact command.
  3. Install dependencies with npm install.
  4. Create your environment file by copying .env.example to .env, then fill in DATABASE_URL, ENCRYPTION_KEY, OWNER_EMAIL and OWNER_PASSWORD.
  5. Create the tables with npm run db:migrate, which also applies the row-level security policies.
  6. Create the owner account with npm run db:seed.
  7. Start it with npm run dev and open http://localhost:3000. The admin area is at /admin/login; owners and admins set up two-factor sign-in on their first visit.

Without an email API key, booking confirmations and sign-in links are printed in the terminal instead of sent. Add a Resend key when you want real email.

Roles and safety built in

The export adds customer and staff roles alongside owners and admins, an audit log, server-side validation of every form, and Postgres row-level security, so a query that forgets a filter returns nothing rather than someone else's data. These are the parts that are hardest to add after the fact, which is why they ship from the start. See how Anticode works for the other export formats.

Common first-run problems

  • Migrations fail to connect. Check DATABASE_URL, and whether your hosted database needs sslmode=require in the connection string.
  • Seed says the owner exists. You've seeded before; sign in with the details in .env, or reset the database.
  • Forms show an error after submitting. Read the terminal; it usually names the missing variable.
  • Upgrading Prisma breaks things. The README pins Prisma to a major version on purpose; follow Prisma's upgrade guide when you move.

Deploying and the limits

Any Node host can run it, and the README covers Vercel, Neon, Supabase and Docker. Once exported, the code is yours to maintain: Anticode's design checks, Sentinel, backups and integrity scans apply to sites it hosts, not to your deployment. Changes you make in the exported code don't flow back into the Anticode project, so pick one place to keep building.

Questions people ask

Can I export without a paid plan?

Check pricing for what each plan includes. The single HTML file and the Next.js project are the two export formats.

Do I need to know React to use the export?

To run it, no; the README steps are enough. To change it, basic React and TypeScript help, or hand it to a developer.

Does the exported site still pass Anticode's checks?

It starts from the same pages, and it ships with tests that guard its safety rules. After that, keeping it secure is up to whoever changes the code.

Sources

  1. Next.js documentation: App Router, checked
  2. Prisma documentation, checked