Sanity Pioneers: Get early access to betas, extra AI credits, and a direct line to the engineering team. Apply now

Last updated May 22, 2026

Building a Content Engine with Sanity, Next.js, Vercel, GitHub, and Claude

By Carlynn Espinoza

Building a Content Engine with Sanity, Next.js, Vercel, GitHub, and Claude

Running a marketing agency means content never stops. I built a fully automated content engine for Level Up Digital Marketing Group that publishes 3 SEO-optimized blog posts a week, auto-posts to Google Business Profile, and gets smarter over time using visitor behavior data. This guide covers the full stack — Sanity, Next.js, Vercel, GitHub, and Claude — and how each piece connects into a system that runs without manual writing time.

Running a marketing agency means content never stops. Blog posts, Google Business Profile updates, campaign landing pages — the volume is relentless. I built a fully automated content engine for Level Up Digital Marketing Group that publishes 3 SEO-optimized blog posts per week, auto-posts to Google Business Profile, and gets smarter over time. Sanity sits at the center of all of it.

Here's the full stack and how each piece connects.

The Stack

  • Sanitycontent hub, schema, and source of truth for all published posts
  • Next.js (App Router) — frontend, ISR for instant post availability after publish
  • Vercel — hosting and deploy webhooks
  • GitHubversion control, CI/CD trigger point
  • Claude (Anthropic API) — content generation, outline drafting, SEO optimization
  • Google Business Profile API — auto-distributes each post as a GBP update

Architecture Overview

The engine runs on a Node.js cron job (hosted on a VPS) that fires three times a week. At a high level:

  1. Claude generates a blog post outline + full draft based on a keyword brief
  2. The draft is written into Sanity as a document with status: draft
  3. A human review step (optional) can approve or override
  4. On publish, Sanity fires a webhook to Vercel — Next.js rebuilds the page via ISR
  5. A second webhook triggers the GBP post with a link to the live article
  6. Visitor behavior data feeds back into the next generation cycle

Sanity Schema Design

The post schema is kept intentionally minimal to stay compatible with automated writes:

Sanity Schema Design
Sanity Schema Design

Keeping body as standard portable text means Claude's output (converted from Markdown) drops in cleanly using @portabletext/toolkit.

Claude Integration

The generation script calls the Anthropic API with a structured prompt that includes the target keyword, competitor gap analysis, and brand voice guidelines pulled from a Sanity singleton document:

Claude Integration
Claude Integration

The Markdown response is converted to Portable Text and written to Sanity via the client:

Portable Text and written to Sanity via the client
Portable Text and written to Sanity via the client

The Learning Loop

This is the part that compounds value over time. After each post has been live for 7 days, a separate cron job pulls scroll depth, time-on-page, and bounce rate from GA4. It compares performance against the post's target keyword ranking.

Posts that underperform get flagged in Sanity with a needsImprovement boolean. A second Claude pass rewrites the underperforming sections — specifically the intro and any H2 section that had high scroll-exit rates.

The feedback signal is stored back in Sanity on each post document:

The Learning Loop
The Learning Loop

Over time, this data trains the generation prompt — low-performing structures get flagged, high-performing post patterns get reinforced in the system prompt.

GBP Auto-Post

Sanity's webhook system handles the GBP distribution. When a document transitions from draft to published, the webhook payload fires to a small Express endpoint that calls the Google Business Profile API:

GBP Auto-Post
GBP Auto-Post

One caveat: GBP's API requires whitelisting approval for the localPosts endpoint. Budget 4–8 weeks for that to come through.

Results

Three months in, the site publishes consistently without manual writing time. Organic impressions are climbing steadily, and the learning loop has already caught and fixed 4 posts that were dragging below target scroll depth.

The biggest win is using Sanity as the single source of truth — every post, every performance data point, every revision lives in one place. The Next.js frontend pulls it all at build time, and Vercel handles the rest.

If you're building something similar, the key is keeping your Sanity schema automation-friendly from day one. Don't add required fields that a script can't fill. Keep portable text conversion clean. And log everything back into Sanity where it becomes a powerful audit trail.

Sanity – The Content Operating System that ends your CMS nightmares

Sanity replaces rigid content systems with a developer-first operating system. Define schemas in TypeScript, customize the editor with React, and deliver content anywhere with GROQ. Your team ships in minutes while you focus on building features, not maintaining infrastructure.

Sanity scales from weekend projects to enterprise needs and is used by companies like Puma, AT&T, Burger King, Tata, and Figma.

Was this guide helpful?