CLI

create-tenoncms

Scaffold a new project.

create-tenoncms creates a project with Tenon from a starter. It asks where the site runs and which database, storage, image provider, email and sign-in methods to use, and writes a project that runs with those choices. This page lists every question, what each answer writes, and how to run it without questions.

Usage

npm create tenoncms@latest

It needs Node 24 or newer. It asks one question at a time. The first answer of each question is the default. A question with only one answer is skipped.

At the end, it prints the next steps and the variables you still need to set. Then:

  1. Fill in the variables in .env.
  2. Run dev.
  3. Open /admin and create the first admin.

Questions

QuestionFlagAnswers
Where should we put your new project?the first argumentA folder. Default: ./tenon-cms
What should the site be called?--site-nameWritten to site.name. Default: Tenon
Which framework would you like to work with?--frameworkastro, nuxt, tanstack, standalone
Do you want a starter template?--templateminimal: one collection and two pages
Where will it run?--targetnode, vercel, cloudflare
Which database should we use?--databaseDepends on the target. See What works where
Where should media files go?--storageDepends on the target
How should images be resized?--imagesDepends on the target
How should the CMS send email?--emailnone, smtp, cloudflare. Default: none
How should people sign in to the admin?--authA list of password, passkey, magic-link, email-otp. Default: password
Which package manager?--pmnpm, pnpm, yarn, bun. Default: the one that runs it
Install dependencies?--install, --no-installDefault: yes
Initialize a git repository?--git, --no-gitDefault: yes

If the folder has files, it asks whether to delete them, keep them or cancel. Without a terminal, the folder MUST be empty.

  • If the install fails, the project stays. Run the install yourself.
  • The git repository gets a first commit, chore: initial commit. Without a git name and email, it stays without one.
  • --help or -h lists every flag.

What works where

The database, storage, image and email questions offer only what works on the target. The first one is the default:

TargetDatabaseStorageEmail
node: a server you runlibsql, postgres, pglite, sqlitelocal, s3, r2none, smtp, cloudflare
vercel: serverless functionslibsql, postgress3, r2none, smtp, cloudflare
cloudflare: Workers, Astro onlydurable-objectr2none, cloudflare, smtp
DatabaseWhat it is
libsqlSQLite in a local file, or Turso by URL. On Vercel, Turso
postgresPostgres, for example Neon or your own server
pglitePostgres in a folder, without a server
sqliteNode's built-in node:sqlite, in a file, without a native package
durable-objectSQLite inside a Cloudflare Durable Object
StorageWhat it is
localA folder on the server, ./.uploads
s3Any S3-compatible bucket: AWS, R2, MinIO and others
r2Cloudflare R2. A binding on Cloudflare, API keys elsewhere

See Databases and Media storage to choose.

Images

--images picks how Tenon resizes images. The first one of the target is the default:

TargetImage providers
nodeipx, none, cloudflare-url, netlify, imgix, cloudinary, imagekit, bunny, imgproxy, thumbor
vercelnone, vercel, ipx, cloudflare-url, imgix, cloudinary, imagekit, bunny, imgproxy, thumbor
cloudflarecloudflare, cloudflare-url, none, imgix, cloudinary, imagekit, bunny, imgproxy, thumbor
  • ipx renders WebP variants with sharp on your server, and adds the ipx package.
  • none serves the originals.
  • vercel needs images in the Vercel config.

See Image providers.

Sign-in methods

--auth takes any mix of methods. At least one is required.

  • password alone writes nothing, because it is the default. Without it, the config turns passwords off.
  • passkey adds @better-auth/passkey and its plugin.
  • magic-link and email-otp add magicLink() and emailOTP(). They need email. Without email, npx tenon users recover <email> prints a sign-in link until you add it.

Without password, the first admin signs up without one. See Authentication.

Run without questions

Every question has a flag, so the command also runs in a script:

npm create tenoncms@latest my-site -- --site-name "My Site" --framework nuxt --target node --database postgres --storage s3 --images imgix --email smtp --auth passkey,magic-link --pm pnpm --yes
  • --yes or -y takes the default for every question without a flag.
  • Without a terminal, it takes the defaults too.
  • An answer that does not fit the target fails with the list of valid answers.

--templates <source> takes the starters from another place: a giget source or a local folder. TENON_TEMPLATES does the same.

What it writes

The project has the files of the starter, with your choices filled in:

  • tenon.config.ts with the database, the storage, the image provider, the email and the sign-in methods.
  • The framework config with the Tenon adapter. In Astro, astro.config.ts also gets the env schema.
  • package.json with the packages your choices need, and the current version of tenoncms. Offline, it keeps latest. The package is named after the folder.
  • .env.example with every variable the config reads, one block per choice.
  • .env, a copy of .env.example with a random TENON_SECRET. On Cloudflare, these are .dev.vars.example and .dev.vars.

Variables

Each choice adds its variables. Fill them in before you start the project:

ChoiceVariables
Every projectTENON_SECRET, TENON_SITE_URL
standaloneTENON_CMS_URL, the CMS origin when a site on another origin reads it
libsqlDATABASE_URL (default file:./cms.db), DATABASE_AUTH_TOKEN for Turso
postgresDATABASE_URL
pgliteDATABASE_DIR (default ./.pglite)
sqliteDATABASE_PATH (default ./cms.db)
s3S3_BUCKET, AWS_ENDPOINT_URL_S3, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, and S3_PREFIX if you like
r2, outside CloudflareCLOUDFLARE_ACCOUNT_ID, R2_BUCKET, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, and R2_PREFIX if you like
smtpSMTP_HOST, SMTP_PORT (default 465), SMTP_USER, SMTP_PASSWORD, EMAIL_FROM
cloudflare emailCLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_EMAIL_API_TOKEN, EMAIL_FROM. On Cloudflare, EMAIL_FROM only
A hosted image providerIts URL, like IMGIX_URL or CLOUDINARY_BASE_URL
  • In Nuxt, every variable has the NUXT_ prefix, like NUXT_DATABASE_URL.
  • TENON_SITE_URL stays commented out in development, so the adapter uses the URL of the dev server. Set it in production to the public origin of the site.
  • TENON_CMS_URL stays commented out too. Set it together with TENON_SITE_URL when the site runs on another origin. See Headless.
  • S3_PREFIX and R2_PREFIX keep every file in one folder of the bucket, so several sites can share it.
  • A bucket MUST allow PUT from the site in its CORS rules and expose ETag, for uploads from the browser.
  • On Vercel, set the variables in the project settings. With libsql, DATABASE_URL MUST be a Turso URL there.
  • On Cloudflare, run types once after the install. The Worker and the bucket <name>-media are named after the project.