Tarik Hamilton.

A full-stack hauman's space on the web.

Deploying TinaCMS Next.js App to Prod Without TinaCMS: Local Editing Only

Web Development
Saturday, October 1, 2022

Bootstrapping your existing Next.js website with TinaCMS using @tinacms\cli@latest init gets you quickly set up with modified dev, build, and start package.json scripts. It's smooth sailing using TinaCMS locally in dev mode, but as soon as you try building your app, you discover you are required to provide Tina Cloud credentials.

Is Tina Cloud required?

Tina Cloud is required for authentication for editing on your content on production, but you don't have to use Tina Cloud if that's not desired.

I want to use something that lasts forever. It's why I love Markdown files, hence TinaCMS, so requiring a third-party service to publish makes me nervous. If they're down, then I can't publish? It's bad enough depending on Node packages.

Deploying Without Tina Cloud

Replace your existing build script, or create a new one. I actually signed up for Tina Cloud and don't have a problem using it, so I created a script called build:tina-free.

"scripts": {
  "build": "tinacms build && next build",
  "build:tina-free": "tinacms dev -c \"next build\"",
  ...
}

If you're authenticated already, it seems to persist or cache in an unexpected way. I was able to see my collections in /admin even in incognito mode and different browsers, but I wasn't able to when I tried on my phone.

Even though I use Tina Cloud, I feel much better knowing I can deploy without Tina Cloud. Hopefully this helps someone out. I searched for quite a bit, but I didn't get this figured out till I asked on the TinaCMS Discord. The community is great!