Loving Tina? ⭐️ us on GitHubStar

Docs

Learn

v.Latest
Documentation
Repo-based Media
Table of Contents

TinaCMS has a built-in Repository (git) based media storage option. Alternatively you can connect your CMS to an external media storage provider.

Repo-based media keeps your assets alongside your content, meaning you can track changes and roll back versions for both code and media.

This has other benefits such reducing dependencies, usage of external APIs, syncronization between local development and preview environments.

Not seeing your media? To see your media in the media manager, you will need to press the "Sync Media" button in the media manager. This will pull all of your media from GitHub and add it to TinaCMS.

Configuration

To configure repo-based media in your project, add the following to your schema definition in tina/config.{ts,js}

//tina/config.{ts,js}
export default defineConfig({
// ...
media: {
tina: {
publicFolder: 'public',
mediaRoot: 'uploads',
static: false, //default is false
},
},
});

Asset Storage Path

Set publicFolder to the path to your site's "public" folder. This path is relative to your project's root.

For any NextJS site, (such as our tina-cloud-starter), this value should be "public".

Media Storage Path

The path to your media folder, relative to the publicFolder value.

Set this to "", if you want your media to be uploaded to the root of your publicFolder.

Anything in this directory will be synced with TinaCloud's media server, and the images will be publicly accessible.

Media Permissions

The static property determines whether media files can be uploaded, edited, or deleted directly through the editor.

  • static: true Editors cannot upload/delete media (static assets)
  • static: false (default): Editors can upload/delete media (dynamic assets).

Supported Media Types

The following file types are supported by default

Format

MIME Type

Examples

Adobe InDesign

application/x-indesign

.indd

Apple HTTP Live Streaming

application/vnd.apple.mpegurl

.m3u8

Binary File

application/octet-stream

.bin

Filmbox

model/fbx

.fbx

GL Transmission Format (JSON)

model/gltf+json

.gltf

Images

image/*

.jpg, .png, .gif, etc.

JSON

application/json

.json

JSON-LD

application/ld+json

.jsonld

Material Exchange Format

application/mxf

.mxf

Microsoft Excel (Legacy)

application/vnd.ms-excel

.xls

Microsoft Excel (OpenXML)

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

.xlsx

Microsoft Word (Legacy)

application/msword

.doc

Microsoft Word (OpenXML)

application/vnd.openxmlformats-officedocument.wordprocessingml.document

.docx

MPEG-DASH

application/dash+xml

.mpd

PDF

application/pdf

.pdf

Polygon File Format

model/ply

.ply

PostScript

application/postscript

.ps, .eps, etc.

Text Files

text/*

.txt, .md, etc.

U3D Mesh

model/u3d+mesh

.u3d

USDZ Zip

model/vnd.usdz+zip

.usdz

Videos

video/*

.mp4, .avi, .mkv, etc.

If you would like to specify your own allowed file types, add the following to the media property

//tina/config.{ts,js}
export default defineConfig({
// ...
media: {
tina: {
//..
},
accept: ['image/jpeg', 'video/mp4'],
},
});

NextJS Images

If you are using NextJS images, you will need to add some like the following to your next.config.js file to allow access to external images.

module.exports = {
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'assets.tina.io',
port: '',
},
],
},
};

Learn more about remote patterns here.

Maximum file size

When uploading files to TinaCloud, the maximum allowed file size is 100 MiB.

How does this work with Branching?

Repo-based media is designed to be used around a single-branch workflow. If your project is using multiple branches or Editorial Workflow, there's some known caveats to be aware of.

  • Images cannot be altered, once uploaded any subsequent changes to an asset will not be reflected.
  • If you only have a single branch with media enabled, the media store will source/upload images to/from that branch.
  • If you have multiple branches with media enabled, then all media will be sourced/uploaded to/from the repository's default branch.

If you are configuring Tina on a non-default branch (and the Tina config has not yet been merged to your default branch), you may see this message in the TinaCloud media settings:

To workaround this, you may need to enable media after merging Tina to your default branch.

Last Edited: March 26, 2025