Static CMS
Star StaticJsCMS/static-cms on GitHubSponsor
v3.3.3DocsCommunitySponsor

Overview

A backend is JavaScript code that allows Static CMS to communicate with a service that stores content - typically a Git host like GitHub or GitLab. It provides functions that Static CMS can use to do things like read and update files using API's provided by the service.

Backend Configuration

Individual backends provide their own configuration documentation, but there are some configuration options that are common to multiple backends. A full reference is below. Note that these are properties of the backend field, and should be nested under that field.

NameTypeDefaultDescription
name'git-gateway'
| 'github'
| 'gitlab'
| 'bitbucket'
| 'gitea'
|'test-repo'
| 'proxy'
The backend git provider
repostringRequired for github, gitlab, gitea and bitbucket backends. Ignored by git-gateway. Follows the pattern [org-or-username]/[repo-name]
branchstringmainOptional. The branch where published content is stored. All CMS commits and PRs are made to this branch
api_rootstringGitHub
https://api.github.com

GitLab
https://gitlab.com/api/v4

Bitbucket
https://api.bitbucket.org/2.0

Gitea
https://try.gitea.io/api/v1
Optional. The API endpoint. Only necessary in certain cases, like with GitHub Enterprise or self-hosted GitLab
site_domainstringlocation.hostname

On localhost
cms.netlify.com
Optional. Sets the site_id query param sent to the API endpoint. Non-Netlify auth setups will often need to set this for local development to work properly
base_urlstringGitHub or Bitbucket
https://api.netlify.com

GitLab
https://gitlab.com

Gitea
https://try.gitea.io
Optional. OAuth client hostname (just the base domain, no path). Required when using an external OAuth server or self-hosted GitLab/Gitea
auth_endpointstringGitHub or Bitbucket
auth

GitLab
oauth/authorize
Optional. Path to append to base_url for authentication requests.

Creating a New Backend

Anyone can write a backend, but the API is not yet finalized and documented. If you would like to write your own backend for a service that does not have one currently, Static CMS recommends using the GitHub backend as a reference for API and best practices.