Skip to content

Editing in the site editor on GitHub

With the hosted Deco CMS, the site editor edits your site with nothing to clone or install: saves go to a draft in Deco's storage, and publishing commits them to your production branch on GitHub.

A merchandiser needs to change the homepage hero before tomorrow's sale. They don't have Git, a copy of the code or a dev server, and they shouldn't need one.

On your machine, the site editor edits your working tree through deco serve, and you commit the changes yourself (see Edit on your machine). With the hosted Deco CMS, the site editor's GitHub backend keeps editors' drafts in Deco's storage and publishes them to your repository.

This page shows how the site editor edits your repository on GitHub, where uploads go, and how publishing and CI work.

What changes

The site editor's forms, variants, pages and redirects are the same on both backends: they need only the schema and the files. What differs is where a save goes and what happens next.

deco serveThe site editor's GitHub backend
EditsThe files in your working treeA draft in Deco's storage, over your production branch
Where .deco/ isThe folder you pass with --root, or the nearest one with a .deco/; deco serve tells the site editorThe site editor's "app root" setting, such as apps/storefront in a monorepo
A saveWrites the file; your app hot-reloadsOne write to the draft, with all the blocks of that save; GitHub isn't involved
CommittingYou review the diff and commitOnly publishing commits: one commit on your production branch
Drafts and publishingNot shown: your branch is the draft, and you merge itDrafts in Deco's storage; publishing commits a draft to production
UploadsFiles in public/assets/ (or the folder you pass with --assets) in your working tree, which you commitDeco's asset storage, served from a CDN
Preview canvasYour dev appYour site, with a ?__draft= link
The site editor checks for changesAbout every 2 secondsWhen you return to the tab, and about every 30 seconds
NeedsA clone of the repository on your machine, git, and a running deco serve from @decocms/blocks 8.2.0 or newer, started inside that repositoryA connected site

Uploads

With the hosted Deco CMS, images and other files editors upload in the site editor go to Deco's asset storage, not your repository. The site editor saves each file's CDN address in the field, such as https://assets.decocms.com/…/summer-banner.jpg, so images are served from a CDN close to your visitors, your app serves nothing for them, and your repository doesn't grow with every image. Without the hosted Deco CMS, uploads are files in your repository (see Images and other uploads).

Uploads already in your repository keep working: a field holds either kind of address, and your app keeps serving the files it has.

Drafts

The editor works with a draft; they never create a branch, merge or rebase. A draft holds only the blocks the editor changed, kept in Deco's storage. The forms show your production branch, read from GitHub when the site editor opens and in its background check, with the draft on top.

Each save writes the whole blocks the editor changed into the draft, without a call to GitHub, so "Saved" shows as soon as the write is confirmed. If someone else saved the same block in between, nothing is overwritten: the site editor shows their version beside yours, and you choose what to keep (see A save).

When a developer pushes to the production branch, every block the draft didn't change follows it; a block the draft changed keeps the draft's version. See Keeping drafts current.

While the draft is unpublished, the site editor previews it on your real site; see Previewing drafts.

Publishing

Publishing is the one step that writes to GitHub. It commits the draft's blocks on top of your production branch's latest commit (usually main), changing only content files and respecting required checks. When a developer also changed one of those blocks there, the whole draft block wins, and the review says so before you confirm: "Your developer also changed Footer. Publishing keeps your version." The delivery pipeline prepares an immutable release from the commit and promotes it only when ready. Servers adopt it on their next background check (see Publishing without a deploy); saving, preparing and promoting are separate statuses. Publishing empties the draft instead of deleting it: the same link keeps working, and the preview shows the new release at once, because a draft preview checks for the latest release before it renders.

The site editor reads the schema committed on your production branch, so editors only see the block types and fields that branch's code has. Deploy code that adds a type before publishing content that uses it (see Keep running code compatible).

CI on site editor commits

Saves never create commits; only publishing does. A publish is one commit that only changes content, and the check workflow validates it like any other change. It's the only check content gets: the site editor doesn't check content against the schema, on save or at publish. When publishing opens a pull request, the check runs on it before merge. When publishing commits straight to your production branch, it's live as soon as it's released, so also run the check on pushes to main:

.github/workflows/check.yml (changes)
on:
  pull_request:
  push:
    branches: [main]

How the site editor reads and writes content over the protocol is in Content protocol, and its compatibility details in Site editor compatibility.