Codegea

Development

Custom software developmentSystems, platforms and integrations built around your operationCorporate websitesProfessional, fast and built to inspire trustOnline storesCatalog, payments and shipping ready to sell 24/7WooCommerceFast WooCommerce stores with each country’s payments and invoicingLanding pagesA page focused on one goal: turning visitors into customersMobile appsCustom iOS and Android apps that put your business in your customers’ pockets

Integration and CMS

CMS integrationsWordPress, Strapi, Directus and Arc XP connected to your whole ecosystemArc XPSupport, implementation and integrations for the media platformMigrationsMigrate your site, platform or database without losing anything

Growth and infrastructure

AI automationTechnology does the repetitive work and your team focuses on what mattersOn-page SEOBe found and recommended by Google: technical and content optimizationServers & hostingFast, secure servers monitored 24/7
RetainerYour dev team, by the monthFrom 20h a month. Fixed fee.
An AI quoting tool to quote services in minutesProfessional quotes in minutes, with projects, sellers and payments tracked in one place.See the case

By type

EcommerceStores and catalogsCorporate sitesBrand and lead genPlatforms & appsCustom software

Explore

All projectsCases and resultsClientsWho trusts usRetainerMonthly dev team

Blog

All articlesGuides and opinionNewsletterOne email a monthContactWe reply in 24h

Latest articles

Integrating Piano, Cxense and Google Ad Manager with Arc XPCMS · 2026-10-13How to migrate from WordPress to Arc XP without losing SEOCMS · 2026-10-13Arc XP vs WordPress for a digital media outlet: when to make the jumpCMS · 2026-10-13
NewsletterJoin our newsletterPractical web, SEO and AI notes.
ServicesCustom software developmentCorporate websitesOnline storesWooCommerceLanding pagesMobile appsCMS integrationsArc XPMigrationsAI automationOn-page SEOServers & hostingYour dev team, by the month
ProjectsProfessional quotes in minutes, with projects, sellers and payments tracked in one place.EcommerceCorporate sitesPlatforms & appsAll projectsClientsRetainer
Retainer
BlogAll articlesNewsletterContactIntegrating Piano, Cxense and Google Ad Manager with Arc XPHow to migrate from WordPress to Arc XP without losing SEOArc XP vs WordPress for a digital media outlet: when to make the jumpJoin our newsletter
ESEN
Let's talk

CMS

How to integrate Keystatic into Astro step by step

How to integrate Keystatic into Astro step by step: installation, astro.config.mjs, keystatic.config.ts, the /keystatic panel and reading with content collections.

Derian Pinto · Founder & Full Stack Developer2026-07-043 min
How to integrate Keystatic into Astro step by step

Astro and Keystatic make a good pair: a generator built for fast sites and a CMS that stores content as Markdown files in your repository. The result is a static, fast website with a comfortable editing panel and no database.

If you are still deciding between frameworks, the comparison of Astro vs Next.js for landing pages may help first. Here we get straight to the integration, following the official Keystatic documentation.

What you need

  • An Astro project (new with npm create astro@latest or an existing one).
  • Node.js and the project in a Git repository.
  • The Keystatic panel renders on the server, so to deploy it you will need an SSR adapter (for example @astrojs/node or the Vercel one).

Step 1: Install the dependencies

npx astro add react markdoc
npm install @keystatic/core @keystatic/astro

npx astro add react markdoc installs and configures the React integrations (the Keystatic panel uses React) and Markdoc; then we add the Keystatic packages.

Step 2: Configure Astro

Add the Keystatic integration in astro.config.mjs, next to React and Markdoc.

import { defineConfig } from 'astro/config';
import react from '@astrojs/react';
import markdoc from '@astrojs/markdoc';
import keystatic from '@keystatic/astro';

export default defineConfig({
  integrations: [react(), markdoc(), keystatic()],
});

Step 3: Create the Keystatic configuration

In the project root create keystatic.config.ts with your storage and your collections. It is the same configuration as in Next.js: here we define a posts collection in src/content/posts.

import { config, fields, collection } from '@keystatic/core';

export default config({
  storage: {
    kind: 'local',
  },
  collections: {
    posts: collection({
      label: 'Posts',
      slugField: 'title',
      path: 'src/content/posts/*',
      format: { contentField: 'content' },
      schema: {
        title: fields.slug({ name: { label: 'Title' } }),
        content: fields.markdoc({ label: 'Content' }),
      },
    }),
  },
});

Step 4: Open the panel

The Keystatic integration already exposes the panel. Start the project with npm run dev and open http://127.0.0.1:4321/keystatic: from there you create and edit your entries, which are saved as files in src/content/posts. Remember that, since the panel is dynamic, when deploying you need an SSR adapter configured.

Step 5: Show the content

Since the content lives in src/content, you can read it with Astro's native content collections and its getCollection function.

---
import { getCollection } from 'astro:content';
const posts = await getCollection('posts');
---
<ul>
  {posts.map((post) => (
    <li><a href={`/posts/${post.slug}`}>{post.data.title}</a></li>
  ))}
</ul>

For a single entry you use getEntry and the <Content /> component that Astro generates from the Markdown. That closes the loop: you edit in the panel and Astro renders the final HTML.

What decides whether it works in production

In Astro the Keystatic panel is dynamic, and that is the difference from a purely static site: even if the public pages are generated as HTML, the editing panel needs a server to run it. That is why the SSR adapter is not a detail at the end, it is an architecture decision.

It pays to test the deployment with the adapter from the start, even before you have content. That way you find out early whether your hosting supports it and what it costs. After that: local mode to develop, GitHub for production, and the client editing without touching code.

If your team does not want to maintain a server for the panel, the honest alternative is something else: a managed CMS or editing directly in the repository. Keystatic shines when you want a friendly panel on top of files, not when you want zero infrastructure.


Do you need a fast Astro website that is easy to edit? At Codegea we build it with the right CMS for your case. See the CMS integration service or tell us about your project from the contact page.

Share this article?LinkedInWhatsAppX

Written by

Derian Pinto

Founder & Full Stack Developer

Founder of Codegea. Builds custom websites, stores and platforms, and integrates and supports Arc XP for media companies.

Join our newsletter

An email with news and practical web, SEO and AI notes. No spam, unsubscribe anytime.

Shall we build your project?

Need help? Chat with us