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
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
Overview
Backend Host
Git Provider
Database Adapter
Overview
Vercel KV
Mongo DB
Bring Your Own Database Adapter
Auth Provider

Overview

A database adapter provides an interface between the Tina database and the underlying database implementation. It implements a limited subset of functionality required by a sorted key-value store, which can be provided by almost any database implementation. We currently have database adapters for the following database implementations:

We're considering support for additional database adapters in the future, if this interests you let us know through GitHub discussions.

Configuring a database adapter can be done in the database.{ts,js} file by passing it to the createDatabase function.

// ...
export isLocal ? createLocalDatabase() : createDatabase({
// ...
databaseAdapter: new DatabaseAdapter()
})

createDatabase Function

This is a factory function that creates a new instance of the TinaCMS Database. It takes a databaseAdapter and a gitProvider.

ParameterDescription
databaseAdapterThe database adapter to use. (Required)
gitProviderThe git provider to use. (Required)
tinaDirectoryThe directory used to store tina files. Defaults to tina (Optional)
bridgeThe bridge used to index the content to the database adapter. This defaults to the FileSystem. The bridge is a more advanced use case if you want to index from a different source other than the filesystem. Please reach out on Discord for further help.
indexStatusCallbackasync function called to report the status of the current indexing operation. (Optional)
namespaceSpecifies the namespace for the current indexed content. If specified, this will usually be an environment variable with the name of the current branch.

createLocalDatabase Function

This is a factory function that creates a database that can be used for local development or static builds.

It uses a local in-memory database adapter and a file-system Git provider that only writes changes to the file-system without committing them.

(does not take any parameter)

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