Skip to content

GitHub Gist Adapter

The GitHub Gist adapter stores your content schema in a GitHub Gist. It’s a simple way to make your content available remotely without setting up a full repository.

Terminal window
npm install @useacms/cli
import { defineConfig } from '@useacms/client';
import { localFile, githubGist } from '@useacms/cli/adapters';
export default defineConfig({
dev: localFile({ path: './acms.json' }),
production: githubGist({
token: process.env.GITHUB_TOKEN,
gistId: process.env.GITHUB_GIST_ID,
}),
});
OptionTypeRequiredDescription
tokenstringYesGitHub personal access token with gist scope
gistIdstringYesThe ID of the Gist to use for storage
  1. Go to GitHub Settings > Developer settings > Personal access tokens.
  2. Click “Generate new token (classic)”.
  3. Select the gist scope.
  4. Copy the token.
  1. Go to gist.github.com.
  2. Create a new Gist with a file named acms.json.
  3. Add an empty JSON object {} as the content.
  4. Save the Gist and copy its ID from the URL (e.g., https://gist.github.com/yourname/abc123def456 — the ID is abc123def456).
.env
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
GITHUB_GIST_ID=abc123def456
Terminal window
acms push

This uploads your local acms.json to the Gist.

Terminal window
acms pull

This downloads the Gist content and writes it to your local acms.json.

Terminal window
acms sync

Bi-directional merge between local and Gist content.

The adapter uses the Octokit library to interact with the GitHub Gist API:

  • Read: Fetches the Gist and parses the acms.json file content.
  • Write: Updates the Gist with the new content using the Gist API.

Gists support versioning, so you can view the history of changes in the Gist’s revision history.

  • Small to medium sites — Gists are great for storing a single JSON file.
  • Simple remote storage — No need to set up a full repository.
  • Quick collaboration — Share the Gist ID with team members.
  • Gist files are limited to 10 MB (more than enough for most content schemas).
  • No built-in access control beyond the Gist’s public/secret setting.
  • Not ideal for very large schemas with many fields.