The TinaCMS CLI
Available Commands
$ tinacms <command>Commands:dev [options] Builds Tina and starts the dev serverbuild [options] Build the CMS and autogenerated modules for usage with TinaCloudinit [options] Add TinaCloud to an existing projectaudit [options] Audit your schema and the files to check for errorssearch-index [options] Builds the TinaCMS search index and uploads it to TinaClouddoctor [options] Check direct TinaCMS dependencies against npm latesthelp [command] display help for command
Common options
Here are some common options that can be used in both tinacms dev and tinacms build
Argument | Description |
|---|---|
|
|
| Specify a port to run the server on. (default 4001) |
| Specify a port to run the local level server. (default 9000) |
| Don't regenerate config on file changes. This option is good to add when building in CI or if you do not want to watch the file system for changes. |
| Don't generate the generated client SDK. Read here for more details about the SDK. |
| increase verbosity of logged output (default: false) |
| Specify the root directory to run the CLI from (defaults to current working directory) |
| don't report anonymous telemetry |
Basic Usage:
"tinacms dev"
To run this command, you must have a validtina/config.{ts,tsx,js,jsx}file.
dev will compile the schema into static files, generate typescript types for use in your project and start a graphQL server on http://localhost:4001
This command takes the arguments listed in the common options
NextJS Example:
tinacms dev -c \"next dev\"
Other SSG Frameworks Example
tinacms dev -c \"<Yor Dev Command>\"
"tinacms build"
This command compiles and validates the schema and generates the client and types. It will also ensure your content has finished indexing.
Options
This command takes all the common options as well as a few others:
Argument | Description |
|---|---|
| Specify the version of |
| Will start the local Graphql server and generate the local client. This is useful for static builds but will not work with SSR |
| Source content from the local filesystem during the build so no TinaCloud Content API calls are made, while the generated client still points at TinaCloud at runtime. Recommended for SSG sites with many pages. |
| Skip the TinaCloud checks (dangerous and not recommended) |
| Skip the search indexing |
| Disables automatic caching of queries by local client |
Examples:
Building for production with TinaCloud for data fetching
tinacms build && next build
Building for production with a SSG
tinacms build && <Your SSG build command>
Using the local client and local graphql server
tinacms build --local -c "next build"
This will
- Start the local graphql server
- Generate the local TinaCMS client that will query the local file system
- Produce local image paths
- build production SPA
- run Next build
Building from local content with a TinaCloud production client
tinacms build --content=local -c "next build"
This will
- Index your content into a temporary in-memory data layer for the duration of the build
- Generate the production TinaCMS client (so the deployed site still talks to TinaCloud at runtime)
- Make zero TinaCloud Content API requests during the build
- Run your framework's build command
Useful when SSG is generating thousands of pages. On SSW Rules (~4,000 pages) build time dropped from 4:55 to 2:12, with TinaCloud Content API calls dropping from ~4,000 to 0.
Because the generated client is the production client, branch, clientId, and token must be configured in your Tina config, the same values you would use for a normal tinacms build.
A few things to know:
- Search indexing is skipped during the build (a warning is emitted). Reindex separately if you rely on search.
- TinaCloud validation checks (branch status, schema match) still run; pass
--skip-cloud-checksto skip them. - If both
--localand--content=localare passed,--localtakes precedence.
"npx @tinacms/cli@latest init"
The init command must be run inside of an existing project (E.g a NextJS project, Hugo, Jekyll, etc).
npx @tinacms/cli init
This will:
- Install all required dependencies for Tina.
- Define a basic content schema in the
tinadirectory. - Create example content in the demo directory.
- Edit the
package.jsonto have thedev,build, andstartscripts run the tina GraphQL API.
Options
Argument | Description |
|---|---|
| Disables Open Source Telemetry |
"tinacms audit"
The audit command is used for checking for errors in your in your files. It currently does two things.
- Checks to see if the files have the correct extension
- Submits each file as a Graphql mutation and checks for Graphql errors
By default the mutation will not change the content of the files.
Options
Argument | Description |
|---|---|
| When this flag is used, it submits actual Graphql mutations to the file system. This means that it will clean out any fields that are not defined in your schema. It is a good practice to do a |
| increase verbosity of logged output (default: false) |
"tinacms search-index"
This command builds the search-index using the content in your repository and uploads it to TinaCloud.
"tinacms doctor"
The doctor command checks whether the Tina packages installed in your project are current against the npm latest dist-tag. It answers the question "am I current?" — the CLI counterpart to the /versions page.
The command:
- Reads your
package.jsonand resolves installed versions fromnode_modulesor your project lockfile (supportspackage-lock.json,pnpm-lock.yaml, andyarn.lock). - Filters to the Tina package family:
tinacms,@tinacms/*,tinacms-*,next-tinacms-*, andcreate-tina-app. - Fetches
dist-tags.latestfromregistry.npmjs.orgfor each installed package in parallel. - Prints a table of declared, installed, and latest versions with a status column (
CURRENT,OUTDATED,LOCAL, orUNKNOWN). - Exits with code
1if any package is outdated or cannot be resolved, so it's CI-friendly.
pnpm tinacms doctor
Options
Argument | Description |
|---|---|
| Specify the root directory to inspect (defaults to current working directory) |
| Print machine-readable JSON output instead of the formatted table |
| npm registry request timeout in milliseconds (default: 5000) |