Tina Docs
Home
Blog
Showcase
Community
Introduction
Overview
Introduction To TinaCMS
Getting Started
Using the Tina Editor
FAQ
Core Concepts
Content Modeling
Data Fetching
Visual Editing
Querying Content
Overview
Writing custom queries
Editing
Overview
Markdown & MDX
Block-based editing
Single Document Collections
Customizing Tina
Overview
Validation
Custom Field Components
Custom List Rendering
Format and Parse Input
Filename Customization
Before Submit function
Going To Production
Overview
Tina Cloud
Self-Hosted
Introduction
Getting Started
Deploy a (Next.js) Example Site
CLI Quick Start on an Existing site (Next.js only)
Manual Setup (Agnostic)
Migrating From Tina Cloud
Querying Content
User Management
Drafts
Overview
Draft Fields
Editorial Workflow
Guides
Overview
Framework Guides
Separate Content Repo
Querying Tina Content at Runtime
Internationalization
Migrating From Forestry
Further Reference
Overview
Config
Schema
The "tina" folder
The TinaCMS CLI
Media
Search
Content API
Tina's edit state
The "tinaField" helper
Self-Hosted Components

Introduction

This doc will guide you through setting up our pre-configured self-hosted example repository. This implementation uses:

Deploy The Starter Template

You can deploy the self-hosted starter using our preconfigured Vercel template:

This will:

  • Create a copy of the self-hosted starter repository in your GitHub account
  • Create a new Vercel project with the starter code
  • Create a new Vercel KV store for the project

Setup Vercel KV Store

In the initial Vercel project setup, you will be prompted to set up the Vercel KV store. Use the default KV_ environment variables prefix.

Setup Environment Variables

You will be prompted to enter values for the following environment variables:

GITHUB_PERSONAL_ACCESS_TOKEN

A GitHub personal access token can be generated in your GitHub developer settings. Make sure to assign it repo access to the new repository with Read/Write access to Contents.

You may want to change the expiry date to longer than 30 days (max is 1 year).

Github Auth Settings

NEXTAUTH_SECRET

Random string used by NextAuth.js for JWT encryption.

Can be generated with the following command:

openssl rand -hex 16

Test Deployment

At this point you should be able to see your deployed starter site. If you add /admin to the URL, you should be prompted to login. You can login with the default username of tinauser and password of tinarocks. Once logged in you will be prompted to change your password.

TinaCMS username and password

Adding Additional Users

Check out the User management docs for information on how to add additional users.

Note: when you're testing TinaCMS locally, you don't need to be logged in to access the CMS."

Local Development

Clone the Repository

(Replace the URL with your newly forked repo)

git clone <YourGitUrl>

Install the project's dependencies:

yarn install

Configure the Development Environment

Setup the .env file:

cp .env.example .env

Use the same environment variables locally that you setup with the Vercel project earlier. You will also need to add some environment variables that are applied automatically in Vercel for your Vercel KV Store

# Github credentials for onPut and onDelete
GITHUB_PERSONAL_ACCESS_TOKEN=
# Required when building locally
GITHUB_OWNER=
GITHUB_REPO=
GITHUB_BRANCH=
# Used by NextAuth.js to encrypt JWT
NEXTAUTH_SECRET=changeme
# Used by Vercel KV (Can be found in the vercel dashboard)
KV_REST_API_URL=
KV_REST_API_TOKEN=

Run the Project Locally

yarn dev

You will be able to view your starter on http://localhost:3000. To edit content with TinaCMS go to http://localhost:3000/admin

Last Edited: July 7, 2023

Previous
Self-hosting Tina
Next
Self Hosted Setup on a Next.js Site

Product

Showcase
TinaCloud
Introduction
How Tina Works
Roadmap

Resources

Blog
Examples
Support
Media

Whats New
TinaCMS
TinaCloud
Use Cases
Agencies
Documentation
Teams
Jamstack CMS
Benefits
MDX
Markdown
Git
Editorial Workflow
Customization
SEO
Comparisons
TinaCMS vs Storyblok
TinaCMS vs Sanity
TinaCMS vs DecapCMS
TinaCMS vs Contentful
TinaCMS vs Builder.io
TinaCMS vs Strapi
Integrations
Astro
Hugo
NextJS
Jekyll