Frameworks

Standalone

Run Tenon headless, with the API and the admin and no site.

A standalone project runs only the CMS: the HTTP API under /_tenon and the admin. It has no pages. Your frontends read the content over HTTP.

Headless use is experimental. Expect gaps and changes. See the limits.

When to use it

Use a standalone project when:

  • Your frontend is not a Vite app, or is not written in JavaScript.
  • Several frontends, like a site and a mobile app, share one CMS.
  • The CMS runs on its own host, like cms.example.com.

If your site runs on Astro, Nuxt or TanStack Start, put Tenon inside it instead. You deploy one app, and drafts and the live preview work without shared cookies. Other apps can still read that CMS over HTTP.

Create a project

Run the wizard and pick Standalone:

npm create tenoncms@latest

Start it with npm run dev and open the URL it prints. / redirects to the admin, where you create the first admin. See create-tenoncms for every question and flag.

The project is a small Vite app with Nitro. Three files make it work:

server.ts
import html from "#tenon/admin-html";
import cms from "./tenon.config";

const admin = cms.adminPath!;

export default {
  fetch(request: Request) {
    const { pathname } = new URL(request.url);
    if (pathname === "/") return Response.redirect(new URL(admin, request.url), 302);
    if (pathname === admin || pathname.startsWith(`${admin}/`)) {
      return new Response(html, { headers: { "content-type": "text/html; charset=utf-8" } });
    }
    return cms.fetch(request);
  },
};
  • server.ts is the server entry. It serves the admin page at admin.path and hands every other request to the CMS.
  • tenonAdmin() builds the admin, and Nitro builds the server. tenonAdmin() also runs due jobs every minute. See TanStack Start for its options.
  • cms.adminPath holds admin.path. tenonAdmin() throws with admin: false, so the path is always set.
  • site.url and auth.baseURL read TENON_SITE_URL and TENON_CMS_URL. Leave both unset while the CMS runs alone. Set both when a site on another origin reads it.

Read content from another app

Any app reads published content with the client from tenoncms/client:

src/lib/cms.ts
import { createClient } from "tenoncms/client";

const cms = createClient({ baseUrl: "https://cms.example.com" });
const posts = await cms.find("posts", { limit: 10 });

An app in another language sends plain requests, like GET https://cms.example.com/_tenon/collections/posts?limit=10.

A site on another origin that shows drafts, the admin bar or the live preview needs more: site.url and auth.baseURL in the config, shared cookies and a request client. Headless covers the origins, the cookies, types, media URLs and the limits. Build a headless site with Next.js walks through both sides, step by step.

Deploy

Node

vite build and node .output/server/index.mjs.

Vercel

Vercel functions, with Postgres or Turso and a bucket.