# How Foundation CMS works: a headless CMS outside the request path

Source: https://foundationcms.org/how-it-works

For developers and agencies

## How Foundation works

What happens between an editor pressing save and a visitor seeing the page, and where the CMS stops and your code starts.

What makes it different

### The CMS isn't part of your website

A headless CMS usually still sits between a site and its content: the site asks the CMS's API for each page or build, so when the CMS is slow or down, so is the site. Foundation works the other way round. The CMS writes into each site's own database and media store at the edge, and the site reads them directly. Switch the CMS off and every site keeps serving.

A typical headless CMSVisitor→Your site→CMS API→CMS database

The CMS answers for every page.

FoundationVisitor→Your site→Private database and bucket
Foundation CMS

Writes only on save.

- 1

#### An editor saves

In the admin at hq.<their domain>, which runs on its own, apart from the site.

- 2

#### The CMS writes to the site's own storage

Content goes into the site's own database, and media into its own media store, both at the edge.

- 3

#### The site reads its own data

Each site runs serverless at the edge, bound to that database and media store. Serving a page never calls the CMS.

The three layers

### Where the CMS stops and your code starts

CONTENT
Your client writes in an admin that already knows their content types, fields and brand. The admin is the same for every site; what changes from one site to the next is the data inside it.

CONTRACT
Every field becomes a generated type, and the types are rebuilt whenever the schema changes. A field added today shows up in the payload straight away, because every read returns the whole record.

PRESENTATION
The front end is yours. The CMS sends data and a way to fetch it, with no markup and no layout. Each site runs as its own Worker with its own database, so if the CMS went down, visitors wouldn't notice.

The docs cover the admin, the Content API and posting forms from your own front end.

Read the docs
Talk to us
