Test Backend
The Test backend is a simple backend for testing and local development. It stores entries and assets in a virtual file system in the browser, allowing developers to test the Sveltia CMS setup without needing a repository.
The Test backend also powers our demo site, where anyone can try Sveltia CMS with sample content, without an account or a repository.
Configuration
The configuration for the Test backend is straightforward. You only need to specify the backend name in your Sveltia CMS configuration file. No repository name or authentication details are required.
backend:
name: test-repo[backend]
name = "test-repo"{
"backend": {
"name": "test-repo"
}
}{
backend: {
name: "test-repo",
},
}How It Works
The Test backend saves entries and assets in the browser’s origin private file system (OPFS) so that changes are not discarded when the browser tab is closed or reloaded. The persistent storage support works with all modern browsers. Safari requires version 26 or later.
Since it’s not connected to any remote or local repository, the Test backend does not read existing content on initialization. Instead, it starts with an empty state, allowing you to create new entries and assets from scratch, unless you provide seed content as described below.
Seeding Content
To make the Test backend start with some entries and assets, for example on a demo site, add a <link> element pointing to a seed manifest to the <head> of the admin page:
<link rel="cms-seed-url" href="/seed/manifest.json" />The manifest is a JSON file listing the paths of the files to be copied to the virtual file system. Each path is relative to the repository root, and the file is fetched from the same path relative to the manifest. Text and binary files, such as images, are both supported.
{
"files": [
"content/posts/hello-world.md",
"content/posts/second-post.md",
"static/images/hello-world.jpg"
]
}In the above example, content/posts/hello-world.md is fetched from /seed/content/posts/hello-world.md.
When a seed manifest is linked, the sign-in button reads Start Demo instead of Work with Test Repository. The files are copied when the user signs in for the first time.
Once the virtual file system exists, it’s left untouched, so the user’s changes are kept across reloads. If the user deletes the virtual file system with the Clear File Cache or Erase All Data button in the Data Management tab of the Settings dialog, the content is seeded again on the next sign-in.
A file that cannot be fetched is skipped with a warning in the browser console. Paths containing empty, . or .. segments are ignored.
This is how our demo site gets its sample posts, pages and images.
Note for Netlify/Decap CMS users
The window.repoFiles object used to populate the Test backend in Netlify/Decap CMS is not supported. Use the seed manifest instead.
If you want to test the CMS with a local Git repository, you can use the Local Development Workflow instead. It lets you make changes to local files with Sveltia CMS while it’s running on a local development server.
Workflows
Only the Simple Workflow is supported with the Test backend.