Tina CMS is a content editor for sites whose pages live as Markdown, MDX or JSON files in a git repository. It is aimed at developers and operators who want non-technical editors to change those files safely. A CMS, or content management system, usually keeps content in a database that you have to host, back up and patch. Tina has no database. The editor opens as an /admin page inside your Next.js, Astro or Hugo site. Each time someone clicks Save, a backend service turns the change into a git commit. You get a full history of every edit, and editors can preview their changes next to the live site. The sections below show how to check that the setup works, how the pieces connect, and how to run the backend on your own servers instead of Tina Cloud, the hosted service.
How to verify
A working Tina-enabled site shows:
curl -sI https://example.org/admin/index.html | head -1
# HTTP/2 200
# After loading the admin, the GraphQL endpoint resolves:
curl -s https://example.org/api/tina/graphql -H 'Content-Type: application/json' \
-d '{"query":"{ getPostList { edges { node { id title } } } }"}' | jq '.data'
git -C /var/www/site log --oneline -5 -- content/posts/
# d4a8b21 [tina] Update content/posts/hello.md
# 9f2e7a3 [tina] Create content/posts/hello.md
ls -la content/posts/
# -rw-r--r-- 1 deployer www-data hello.md
# (each file is a real Markdown file editable outside Tina)
If the admin loads but Save throws “branch is not editable”, the backend (Tina Cloud or self-hosted) is out of sync with the git provider — that’s the most common production failure.
What’s happening
Tina is three things stitched together. First, a React-based editor (@tinacms/cli runs it in dev, the production build outputs static HTML at /admin/index.html). Second, a content schema you define in tina/config.ts — collections, fields, and how files map to git paths. Third, a backend service that takes the editor’s “save” mutation and turns it into a git commit on your behalf.
The backend choice is the operational decision. Tina Cloud (managed) is the default — you connect your GitHub/GitLab/Bitbucket repo, Tina holds an OAuth token, the editor posts mutations to their service, they commit. Self-hosted swaps the cloud out for the Tina open-source backend, which you run on your own infrastructure with the git credentials in your possession. We’ll cover both, with self-hosted as the production-grade path for clients who can’t ship OAuth tokens off-prem.
Content fetching at build time uses Tina’s GraphQL — your Next.js or Astro page calls client.queries.post({ relativePath }) which reads the file from disk, applies the schema, and returns typed data. At runtime in the editor, the same GraphQL goes through the backend so the editor sees draft state. This is why Tina works without a database: the schema is in code, the data is in files, the runtime is your existing build pipeline.
The procedure (self-hosted backend)
-
Install Tina in your existing Next.js / Astro repo.
npx @tinacms/cli@latest init # answer the prompts: framework, content paths, ...This adds
tina/config.ts, acontent/directory, and updates your build scripts. -
Define collections. Example
tina/config.ts:export default defineConfig({ branch: process.env.HEAD || 'main', clientId: process.env.NEXT_PUBLIC_TINA_CLIENT_ID, token: process.env.TINA_TOKEN, build: { outputFolder: 'admin', publicFolder: 'public' }, media: { tina: { mediaRoot: 'uploads', publicFolder: 'public' } }, schema: { collections: [{ name: 'post', label: 'Posts', path: 'content/posts', format: 'md', fields: [ { type: 'string', name: 'title', isTitle: true, required: true }, { type: 'datetime', name: 'date' }, { type: 'rich-text', name: 'body', isBody: true }, ], }], }, }); -
Stand up the self-hosted backend. Clone the reference implementation:
git clone https://github.com/tinacms/tinacms-self-host-starter cd tinacms-self-host-starter npm install cp .env.example .envEdit
.env:GITHUB_OWNER=your-org GITHUB_REPO=your-repo GITHUB_BRANCH=main GITHUB_PERSONAL_ACCESS_TOKEN=<a fine-grained PAT with contents:write> NEXTAUTH_SECRET=$(openssl rand -hex 32) MONGODB_URI=mongodb://localhost:27017/tinaThe MongoDB is for editor session and lookup metadata only — content stays in git.
-
Deploy the backend. Self-hosted Tina is a Next.js app — deploy it to its own subdomain (say
tina-backend.example.org) on the same Node runtime you use for the main site. -
Wire the frontend to the backend. Back in your main repo:
TINA_TOKEN=<a token issued by your self-hosted backend> NEXT_PUBLIC_TINA_CLIENT_ID=<the client id from the backend> TINA_PUBLIC_BACKEND=https://tina-backend.example.orgAnd in
tina/config.ts, setcontentApiUrlOverride: process.env.TINA_PUBLIC_BACKEND + '/api/gql'. -
Build the admin and the site.
npm run tina:build # generates admin/ static assets and types npm run build # your normal Next.js buildThe admin is now reachable at
/admin/on the same domain as the site, and Save commits via your self-hosted backend. -
Wire ISR or rebuild webhook. Tina commits a change, the git provider fires a webhook to your CI, the site rebuilds (or revalidates ISR paths). Without that, Tina commits but the live site doesn’t change.
Common pitfalls
- A fine-grained PAT scoped to a single repo with
contents:writeis the minimum — granting write to all repos is a foot-gun if the token leaks. - The
media:config decides where uploaded images go — git LFS for binary assets, or an S3 media handler if your content team uploads frequently. - Editors expect “preview” to work — a Tina draft is not committed until Save, but the admin’s preview pane shows the in-memory draft only. The live site never shows drafts.
- Self-hosted Tina + the cloud Tina admin UI requires the cloud client ID; check that your
tina:buildis using the self-hosted client ID, not a stale cloud one. - Tina’s GraphQL is generated from your schema — every schema change requires
tina:buildto regenerate types, or the editor will throw schema errors.
For teams that want git-backed editorial with no database to run, Stack Harbor operates the self-hosted Tina backend — PATs scoped and rotated, MongoDB backed up, webhook to CI monitored, admin behind SSO — so editors can ship content directly from /admin without owning the git plumbing. That model lives under managed operations, with related Sanity and Statamic notes alongside.