From an existing Astro site
An Astro site moves onto CaraCMS one page at a time. The pages you haven’t moved keep working as they are, so the site can be deployed at any point along the way.
Read Porting a site first for the shape of the work.
Before you start
- The site is on Astro 7 and Node 22.12 or later.
- You’ve decided where it will run: CaraCMS Cloud or Standalone.
- The site’s own tests pass, and you’ve noted which do.
The order
Install the package, commit the install, and run caracms init. Getting started has the commands.
Set up the comparison: a git worktree at the commit before init, built and served on its own port.
Write the page component from the site’s layout. It takes over the head, the header and the footer.
Convert a page: its sections become blocks, its content becomes a JSON file, and its old route file goes. One page per commit.
Compare that page with the old site before moving to the next.
Move the images into the site’s media.
Convert the content collections.
Move the header, the footer and the site’s settings.
Run the checks, then the editor walk.
git worktree add ../my-site-baseline <commit before init>Converting a page
Each section component becomes a block: a config entry with a field for each thing an editor would change, and a component that renders the same elements and classes as before.
- Reuse a block across pages where the sections are the same. Don’t make one block per page.
- Things that aren’t content stay in the component: an animation’s settings, a decorative shape.
- A card’s icon becomes an image field, so a designer can swap it.
Images
Images kept in the repo are uploaded to the site’s media, and the content then names each by its key:
npx caracms media import src/assets/*.jpgThe site needs its media credentials in .env for this, and to show images in the dev server.
Collections
An Astro content collection becomes a CaraCMS collection: Markdown or YAML entries become JSON documents, and the collection’s route file goes, since the catch-all route serves them.
Before the pull request
caracms validate reports no errors.
The site builds.
The site’s own tests pass as they did before.
Every converted page matches the old site.
A new page made in the editor, from the general blocks, comes out right with no code.
Every visible word opens a field, and the audit is quiet.
For your agent
The caracms-adopt skill, copied into the site by init, is the full method: the comparison script and its options, converting each kind of page, forms, scripts under the preview, and the editor walk.
llms.txt · llms-full.txt: this site for AI tools