CONTACT US
TABLE OF CONTENTS

What’s inside Nexity: Next.js 16, Sanity 6 with an agent layer

Chris Lojniewski
By Chris LojniewskiUpdate:
Nexity branding on a dark background with the text WHAT'S INSIDE NEXITY? next to a glowing red atomic graphic and a Pagepro logo.

TL;DR

  • Nexity is an open source system for starting and growing AI-native websites on Next.js + Sanity, released by Pagepro under the MIT license.
  • Nexity Base is a pnpm monorepo with a Next.js 16.4 app and a Sanity Studio 6 that holds the schemas, also embedded at /admin.
  • The agent layer is plain files: AGENTS.md, DESIGN.md and BRAND.md for the rules, skills in the Agent Skills format, and nine read-only agents.
  • Five marketing skills work on any website and any CMS (the plugin adds three helper skills), and sanity-optimizations audits any Next.js + Sanity project and estimates Sanity and Vercel usage.
  • Every page has a Markdown twin at /page.md or through Accept: text/markdown, and a browser’s */* never triggers it.
  • Redirects are managed in Sanity and fail open, publishing revalidates by tag with no rebuild, and sanity.blueprint.ts keeps CORS origins and the webhook in code.

Try it in two minutes (needs Node.js 22.12+, pnpm and a free Sanity account):

npm create sanity@latest -- --template Pagepro/nexity/base
pnpm dev

The site runs on localhost:3000 and the Studio on localhost:3000/admin. Source: github.com/Pagepro/nexity (MIT).

We tried a few Next.js + Sanity templates, and none of them worked for us. Most give you a demo page and a schema, and the real work starts after that: redirects, cache invalidation, CORS and webhook config, link resolution and editor validation are left for you to build. So we built our own. Nexity is an open source system for starting and growing AI-native websites on Next.js + Sanity.

On every client project we ended up adding the same things again, so we put them in one place. Nexity comes from 20+ migrations that Pagepro delivered:

  • The document types every marketing site needs (pages, blog posts, case studies, podcast episodes, authors, testimonials, header, footer and site settings).
  • The utils we kept rewriting, for example resolveUrl, the one function that turns any Sanity document into its URL for links, canonicals, JSON-LD and the Markdown routes.
  • Skills for everyday work on the site, and agents that review the code before it ships.
  • Rules, so the AI follows the project instead of guessing.

We also put work into the editor’s side. Fields are grouped into tabs (Content, Listing and Metadata on a blog post), and validation catches mistakes before publishing, with error messages that say why the field matters. Below is the repo as it is today, with the file or the command for each part.

What “AI-native website” means in Nexity

In Nexity, an AI-native website is fast, ready for SEO and AI search, and editable in two ways: by people in Sanity Studio, and by coding agents, because the project ships the instructions and skills an agent needs: the rule files, the skills and the read-only reviewers.

An agent can edit any codebase, but it only edits it well when the project tells it the rules.

What is in the Nexity repo

The Nexity repo (github.com/Pagepro/nexity) has three top-level parts: Nexity Base in base/, the code a new project is created from; the Meridian demo theme in theme-meridian/, with the same features plus a full design and seed content; and the agent layer in .agents/, which holds the skills and the read-only agents.

The layout at a glance:

nexity/
├─ base/
│  ├─ web/        # Next.js 16.4 app (App Router, Turbopack)
│  └─ studio/     # Sanity Studio 6, schemas live here
├─ theme-meridian/   # demo theme with design and seed content
└─ .agents/
   ├─ skills/     # <name>/SKILL.md
   └─ agents/     # nine read-only agents

One file shows how the pieces fit together: the cache tag map in web/src/sanity/lib/tags.ts (abridged).

// web/src/sanity/lib/tags.ts (abridged)
export const GLOBAL_TAG = "sanity";
// SANITY_TAGS (document type to list tag) is defined above in the real file

export const postTag = (slug: string) => `post:${slug}`;

export const tagsForDocumentType = (
  type: string,
  slug?: string | null,
): string[] => {
  switch (type) {
    case "header":
    case "footer":
      return [SANITY_TAGS[type]]; // only its own tag
    case "post":
      return slug ? [SANITY_TAGS.post, postTag(slug)] : [SANITY_TAGS.post];
    // ...page, case-study, podcast-episode work the same way
    default:
      return [GLOBAL_TAG]; // unknown type purges the global tag
  }
};

The full behavior is described under Tag-based revalidation on publish below.

Nexity Base

Nexity Base, the base/ folder, is the foundation a company starts from. It is a pnpm monorepo with two packages:

  • web/: the Next.js 16.4 app (App Router, Turbopack), Tailwind CSS 4.3 with shadcn/ui, TypeScript 7.0, React 19.3.
  • studio/: a standalone Sanity Studio 6. The schemas live here, and web/ imports them, so there is one content model. The same Studio is also embedded in the app at /admin.

The page builder has about two dozen blocks: hero, feature grids, bento grid, split sections, stats, pricing, comparison table, testimonials, FAQ, contact form, CTA, listings and more. Each block has the same shared options: visibility, light or dark theme, dividers and an anchor ID. Nexity Base has a neutral look (the default Tailwind palette and Inter) and starts on an empty dataset.

The Meridian demo theme

The Meridian demo theme, the theme-meridian/ folder, is a full demo site for Meridian, a fictional B2B brand. It has the same features as Nexity Base, with a full design, product mocks and seed content. You import the content with pnpm seed. You can see it live at meridian.nexity.build.

The agent layer in .agents/

The .agents/ folder holds the skills and the read-only agents. They are plain Markdown files (not a plugin), so Claude Code, Codex, Cursor and other coding agents can read them. Codex reads .agents/skills/ directly. Claude Code reads .claude/skills/ and .claude/agents/, which are symlinks to the same folder.

How Nexity differs from a typical Next.js + Sanity template

A typical Next.js + Sanity template gives you code and leaves the coding agent to guess your rules. The agent reads the components, makes assumptions about naming, styling and content modelling, and you correct it in review. Nexity writes those rules into files that every coding agent reads before it changes anything.

Take one request: “add a pricing section”. On a template, the agent has to infer from the code whether a field may be renamed between the schema and the query, whether a button is a CTA the editor styles or a fixed link, and which design tokens apply. In Nexity, studio/AGENTS.md says field names stay identical from schema to GROQ to props and are never aliased, the create-section skill asks whether the editor controls how the button looks (CTA) or not (link), and DESIGN.md holds the tokens.

The agent layer has five parts:

  • AGENTS.md (in the root, web/ and studio/): how to build. Architecture, commands, conventions and step-by-step checklists.
  • DESIGN.md: how it looks. Design tokens in the frontmatter, then section anatomy and do’s and don’ts.
  • BRAND.md: what it says. Audience, voice, messaging, and the invented names and numbers a demo can use.
  • Skills in the open Agent Skills format (.agents/skills/<name>/SKILL.md) for repeatable work: set up a project, create a section, fix links, write alt texts, audit Sanity use.
  • Nine read-only agents in .agents/agents/: five reviewers, three auditors and one alt-text writer. Each has a fixed checklist and a fixed output format, and none of them edits files.

The difference shows up when you add a new section. The create-section skill first checks whether an existing section already covers the request (reuse, extend or new). Then it builds the section from DESIGN.md and BRAND.md, and hands off to the reviewers: content-model-architect, styling-fidelity-reviewer, sanity-schema-reviewer, groq-parity-reviewer and link-reviewer.

A workflow diagram showing the Nexity agent process: the Claude agent processes a request, the Meridian agent builds a new section with a Book free demo button, and the Reviewer agent verifies the design against documentation.

Nexity vs a typical Next.js + Sanity template

FeatureNexityNext.js + Sanity templates we tried
Redirects managed in Sanityfile redirect-loader.tsnot included
Tag-based revalidation with signature check/api/revalidate and tags.tsnot included
CORS origins and webhook in codesanity.blueprint.tsnot included
Markdown twin of every page and /llms.txtincludednot included
Agent rules (AGENTS.md, DESIGN.md, BRAND.md) and read-only reviewersincludednot included

What editors see in Nexity’s Sanity Studio

Editors in Nexity work in Sanity Studio at /admin, on the same domain as the site. Each document splits its fields into tabs, and validation stops a mistake before it is published. Errors block publishing, warnings only flag the field, and the messages tell the editor why the field matters.

  • A blog post splits its fields into three tabs, Content, Listing and Metadata, and sections use the same split into content and options.
  • The title and SEO title fields count characters up to 60, the description up to 160, and the title field shows a preview of the share image as you type.
  • An integration without a category cannot be published, and the error reads “Pick a category so the integration shows under a tab.”
  • A post with two authors gets the warning “Only the first author is shown.” because the page shows one.
  • The visual editing preview lets an editor click a block on the page to open its fields, and the Sections Gallery shows every block with sample content.

When a URL changes, the editor adds the redirect in Sanity without a developer: permanent (308) or temporary (307), with patterns such as /old-blog/:slug to /blog/:slug and campaign query strings kept. A chain from A to B to C is served as one hop, so old links, bookmarks and crawlers reach the new page in one step.

What you can use without moving to Nexity

You do not have to build on Nexity to use parts of the agent layer. Makreting skills work on any website, one works on any Next.js + Sanity project, one works on similar Sanity sites, and the rest expect a Nexity project:

Where it worksSkillsWhat you get
Any website, any CMSbrand-kit, blog-post-quality-review, site-contradictions, internal-links, blog-post-update. The plugin installs them with three helpers: marketing-setup (guides the setup), source-review (checks the facts in a post) and work-humanizer (makes proposed text read like a person wrote it)Read published pages and propose changes. They are read-only by default, and a person makes the change.
Any Next.js + Sanity projectsanity-optimizationsThree read-only auditors and a usage estimate for Sanity and Vercel.
Similar Sanity sitesgenerate-altsAlt text proposals for every image in the dataset, with a review page before anything is written.
Nexity projects onlylink-fix, create-section, project-setup, sanity-module-catalog, product-mock, and the link-reviewer agent. Every Nexity project also includes pr-writeup and work-humanizerThey depend on the Nexity file layout, schemas and conventions.

Marketing skills for any website and any CMS

The marketing skills read public pages, exports or pasted text, and nothing is published. The one opt-in exception is internal-links, which can put approved links into Sanity drafts when you ask and give it access. They live only in the repo root, so projects created from Nexity Base do not get them.

In Claude Code, install them as a plugin:

/plugin marketplace add Pagepro/nexity
/plugin install nexity-marketing-skills@nexity



With other agents, use:

npx skills add Pagepro/nexity

Not comfortable with a terminal? The Claude app can install and run these skills for you. The step-by-step setup is at the end of this article and in MARKETING-SKILLS-README.md in the repo.

sanity-optimizations for any Next.js + Sanity project

The sanity-optimizations skill has a discovery path for projects not built from Nexity: it maps your data layer (clients, fetch helpers, the tag map, the webhook, the image path) before the audit starts. Then it runs three read-only auditors in parallel:

  • sanity-query-auditor: GROQ projections and dereferences, query size, and Sanity reads per route.
  • sanity-image-auditor: image CDN use, widths and sizes, LQIP, preload only on the LCP image.
  • sanity-delivery-auditor: API CDN against the live API, Live and stega only in draft mode, static or dynamic per route, cache tags and webhook scope.

The report ranks the findings by impact and estimates Sanity and Vercel usage for 100 to 5,000 daily visitors against the Free and Growth quotas. The skill changes code only after you pick the fixes.

generate-alts for similar Sanity sites

The generate-alts skill caches one preview per asset, proposes alt text in the site's content language (or marks the image decorative), and writes the approved alts to drafts with a dry-run-first script. It must run from a web/ folder that has the env files.

Skills that need a Nexity project

The Nexity-only skills come with every project created from Nexity Base or the Meridian demo theme, as a snapshot in the project's own .agents/. product-mock ships only with the Meridian demo theme. To copy one skill into another project without cloning the repo:

npx degit Pagepro/nexity/.agents/skills/<name> .agents/skills/<name>

Details in Nexity that developers will like

Nexity Base ships seven mechanisms that we used to rebuild by hand on client projects: a Markdown twin of every page for AI agents, redirects managed in the CMS, tag-based revalidation, Sanity config as code, read-only reviewers, one agent folder for every tool, and checks before launch. Each one below names its file.

A Markdown twin of every page for AI agents

Every public page in Nexity has a Markdown twin, and /llms.txt lists every page with a link to it. GET /pricing.md returns the Markdown of /pricing, and so does GET /pricing with Accept: text/markdown. The negotiation in web/src/lib/markdown/negotiation.ts does not count wildcards, so a browser's */* never triggers it. A CMS redirect keeps the format: /old.md returns 308 to /new.md. The twin is served with noindex and a canonical link to the HTML page. On Vercel, the proxy runs before the cache, so a cached HTML page is never served to a Markdown request. Each section has its own serializer, and the registry is typed against the section union, so a new section type fails pnpm typecheck until it has one.

A code block displaying a Markdown file with title, description, and URL metadata, followed by text explaining that Meridian helps users identify which content moves sales pipelines.

Redirects and rewrites managed in the CMS

Editors manage redirects and rewrites in Sanity. They go live about two minutes after publishing, with no rebuild, and they support patterns, query-string passthrough and loop protection. The loader in web/src/lib/redirect-loader.ts fails open: when a read fails, it serves the last good set and retries soon. A broken redirect table never takes the site down.

Tag-based revalidation on publish

Publishing in Sanity calls a webhook to /api/revalidate, which checks the signature and maps the document to cache tags in web/src/sanity/lib/tags.ts. Publishing a post purges the post list tag and that post's own tag; a header, footer or site settings change purges only its own tag; a document type the map does not know purges the global tag. The webhook delays revalidation so that CDN reads already see the new data. The site updates with no rebuild.

Sanity config as code in sanity.blueprint.ts

sanity.blueprint.ts declares the CORS origins and the revalidation webhook from env vars, so they live in the repo and not only in sanity.io/manage. It refuses an origin like *.vercel.app, which would match every site on the platform. You anchor the origin to your team scope.

Read-only reviewers with a fixed output

The groq-parity-reviewer agent checks a 10-point list: field names identical from schema to GROQ to props, buttonIcon projected for every CTA, defined() guards, params instead of string interpolation, a new section registered in every place it needs to be, and more. It returns a verdict and one line per finding in the form severity · file:line · rule · fix. It never edits files.

One source for many agents

.agents/ is the single copy of the skills and agents, and .claude/ holds symlinks to it. Codex and Claude Code read the same files. The root and web/ AGENTS.md are kept under Codex's 32 KiB limit together, because Codex reads only that much of AGENTS.md.

Checks before launch

  • One IS_INDEXABLE switch for robots.txt, so a staging site is not indexed by accident.
  • GROQ checks for missing or out-of-range titles and descriptions (docs/guides/before-release.md). For the wider SEO setup, see our guide to SEO best practices for Sanity CMS.
  • Schema.org JSON-LD, built from the same URLs as the links and canonicals.
  • Env vars validated with Zod.
  • A Sections Gallery with sample content for every block, at /styleguide/sections.

Traps the Nexity skills catch

The traps that the Nexity create-section skill catches are Sanity and GROQ bugs that fail silently: the build stays green and content goes missing. The skill keeps them in .agents/skills/create-section/references/gotchas.md, grouped by the build phase they bite in, and checks every new section against them. Five of them:

  • GROQ returns null for a misspelled field, with no error. The skill cross-checks names from schema to query to component.
  • A Studio that runs the old schema silently strips a new section type from the document on save. Restart Studio and the web dev server after you add a section type.
  • initialValue does not backfill. A field added to an existing section is null on every document saved before it.
  • A section type that is in schemaTypes/index.ts but not in INNER_SECTIONS and an insertMenu group is valid, but no editor can insert it.
  • A field named groups collides with the field-group key of defineType.
Instructions for Phase 4 of a schema registration process, involving two file paths and code snippets for updating schema types and internal section configurations, followed by a note on common configuration errors.

How a Nexity project keeps up with the repo

A Nexity project keeps up with the repo through its agent layer. The app code in web/ and studio/ is your copy, and you change it like any other codebase. The skills and agents are managed files: they update from a local clone of the Nexity repo, and a lock file records exactly what is installed.

  • .agents/install-lock.json records the catalog version, a content SHA-256, the selected skills and clients, and the hash of every managed file. You commit it with the installed files.
  • pnpm agent:update --source /path/to/nexity --dry-run shows the change, and the same command without --dry-run applies it. It keeps your selection, new optional skills stay opt-in, a renamed skill moves to its new name, and a skill dropped from the catalog is removed unless you edited it.
  • A managed file you edited blocks the whole update, and there is no force-overwrite option. You save your change, restore the file, update, then apply your change again.
  • pnpm agent:install --clients claude,codex,cursor adds the Cursor adapter next to the Claude Code links. On Windows the installer creates directory junctions in place of symlinks.
  • pnpm agent:doctor checks Node, pnpm, the env files, the agent files and the client links, so run it first when an agent doesn’t pick up a skill.
  • The installer does not download anything or run code from the source. You point it at a clone you trust, at the commit you reviewed.

Limits to know before you start

  • The singletons in Studio (site settings, header, footer, listing pages) use Sanity's singletons API, which is in beta since Studio 6.17. Read the Studio changelog before you bump sanity.
  • The marketing skills stay in the repo root and are not part of a new project. product-mock ships only with the Meridian demo theme.
  • Updating the agent layer needs a local clone of the repo. There is no update from a URL.

FAQ about Nexity

Is Nexity free to use?

Yes. Nexity is open source under the MIT license, so you can use it for client and commercial projects, change it and ship it without asking Pagepro. To run it you need Node.js 22.12 or newer, pnpm and a Sanity account, and the Sanity free plan works.

Which coding agents work with the Nexity skills?

The Nexity skills and agents are plain Markdown files, so any coding agent can use them. Codex reads .agents/skills/ directly, Claude Code reads the same files through the symlinks in .claude/, and Cursor, Gemini CLI and others follow the pointer in AGENTS.md or read a SKILL.md file you point them at.

Can I use the Nexity skills on a site that is not built on Nexity?

Some of them. The five Nexity marketing skills work on any website and any CMS, sanity-optimizations audits any Next.js + Sanity project, and generate-alts works on similar Sanity sites. The table in the section on what you can use without moving to Nexity lists the rest.

Which versions of Next.js and Sanity does Nexity use?

Nexity Base and the Meridian demo theme use the same minimum versions: Next.js 16.4 with the App Router and Turbopack, React 19.3, Sanity Studio 6 with next-sanity 13, Tailwind CSS 4.3 with shadcn/ui, TypeScript 7.0 and Zod 4.6. They need Node.js 22.12 or newer and pnpm 12.15.

What is the difference between Nexity Base and the Meridian demo theme?

Nexity Base and the Meridian demo theme have the same features. Nexity Base has a neutral look and starts on an empty dataset, so it is the one you build a real site from. The Meridian demo theme adds a full design, product mocks and seed content for a fictional B2B brand, so you can see every block filled in.

Getting started with Nexity

You start a Nexity project with the Sanity CLI. It downloads the folder, creates or picks a Sanity project and dataset, writes the env files, creates the API tokens, adds the localhost CORS origins and installs the dependencies, so the first pnpm dev runs with no manual setup. Create a project from Nexity Base:

npm create sanity@latest -- --template Pagepro/nexity/base
pnpm dev

The site runs on http://localhost:3000 and the Studio on http://localhost:3000/admin.

To try the Meridian demo theme with content:

npm create sanity@latest -- --template Pagepro/nexity/theme-meridian
pnpm seed

Use a fresh dataset for the seed, because it replaces documents with the same IDs. The repo is at github.com/Pagepro/nexity.

Service note: if you want Pagepro to move an existing site onto Nexity, that is a separate paid service, described on the Nexity service page.

SETUP WITHOUT A TERMINAL (FOR MARKETERS)

  1. Download the Claude app from claude.com/download (Mac or Windows) and sign in.
  2. Create a folder for your work, for example “Marketing AI” in Documents. Your reports will be saved there.
  3. In the Claude app, open the Code tab and choose that folder.
  4. Type /plugin marketplace add Pagepro/nexity and confirm the install when asked.
  5. Type /plugin install nexity-marketing-skills@nexity and confirm.
  6. Start a new conversation in the same folder, then type: Help me setup these skills for marketers.
    The agent checks what is missing on your computer (usually only Node.js), installs the rest after asking, tests each skill and lists what you can ask for. Details are in MARKETING-SKILLS-README.md in the repo.
Chris Lojniewski

Chris Lojniewski is the CEO and founder of Pagepro, a software house specializing in Next.js and Sanity migrations. Since 2016 he has helped UK and US companies replace WordPress and other legacy CMS platforms with fast, headless websites. Pagepro runs its migrations on Nexity, its own Next.js and Sanity framework, which delivers a production-ready foundation in about four weeks. Recent work includes a medical platform with 100,000+ pages rebuilt on Next.js and Sanity. Chris is a Vercel v0 Ambassador and a Sanity Pioneer. He writes about CMS migration, headless architecture and AI-assisted development.

Article link copied

Close button

Leave a Reply

* Required informations.