TinaCMS Packages Overview
This document provides a detailed look into the core and modular packages within TinaCMS, covering their functions, configurations, and recommended usage. TinaCMS has evolved from a highly modular setup with numerous packages into a more consolidated structure, making it easier for developers to implement while retaining flexibility where needed.
Main TinaCMS Packages
1. @tinacms/tinacms
The main public-facing package for TinaCMS, @tinacms/tinacms wraps most of the core functionalities necessary for using TinaCMS. It acts as a high-level interface, bundling together frequently used components and tools for a streamlined installation and usage process. This package is the default installation for developers wanting to access the CMS’s core capabilities without managing multiple dependencies.
2. @tinacms/graphql
This package handles the GraphQL schema generation and API functionality within TinaCMS. It is responsible for dynamically building schemas based on user-defined collections, as well as managing queries for retrieving content data. During local development, @tinacms/graphql runs an in-memory data store (LevelDB) to handle rapid data access. This package is essential for users implementing TinaCMS as it underpins the CMS’s ability to serve content data efficiently.
3. @tinacms/mdx
The @tinacms/mdx package enables TinaCMS to work with MDX content, allowing users to edit rich text fields in markdown with JSX. This package is designed to be compatible across both the frontend and backend, making it possible to manage MDX data dynamically in real-time for preview and storage. @tinacms/mdx is a necessary package for projects that use MDX-based content in their collections.
4. @tinacms/schema-tools
@tinacms/schema-tools is a critical package for managing and validating schemas within TinaCMS. It provides utilities to define the shape and structure of content models, allowing TinaCMS to interpret different types of fields and templates correctly. The schema tools support both frontend content editing and backend GraphQL management, ensuring content structures are consistent across the CMS. This package is particularly useful in TinaCloud-based setups and in scenarios where complex content models are required.
5. @tinacms/auth
The @tinacms/auth package provides authentication utilities for TinaCMS, particularly when using TinaCloud. It is also valuable for self-hosted setups where users may prefer alternative identity providers, such as Keycloak or Clerk. This package helps manage sessions, token-based authentication, and any custom auth flows needed to secure content in a TinaCMS setup.
Asset Management Packages
TinaCMS provides several optional packages for asset management, which allow users to choose where and how assets (such as images) are stored. These packages remain separate from the core TinaCMS package to enable flexibility and customization based on project requirements.
6. next-tinacms-cloudinary
This package integrates TinaCMS with Cloudinary, allowing users to manage and store assets via the Cloudinary API. This is ideal for projects with high asset demands that require Cloudinary’s advanced image processing capabilities.
7. next-tinacms-digitalocean
For users storing assets in Digital Ocean Spaces, next-tinacms-digitalocean provides a straightforward integration, allowing seamless management and storage of images and other assets directly within TinaCMS.
8. next-tinacms-s3
The next-tinacms-s3 package supports S3 integration, enabling users to store and manage assets in S3-compatible environments. This package is often used in larger setups where S3 serves as the primary asset storage solution.
Development and Utility Packages
TinaCMS includes various packages and tools to improve developer productivity, compatibility, and overall build quality. Some of these are newer, while others are legacy packages from earlier modular versions of TinaCMS.
9. CLI (Command-Line Interface)
The TinaCMS CLI offers tools for managing the development environment, such as running a local GraphQL server and API endpoint. Though not packaged separately, the CLI plays a crucial role in setting up and managing a local instance of TinaCMS, especially when using features like next dev to preview changes live.
10. datalayer
datalayer manages in-memory data handling using LevelDB to store collection data. This package operates during local development, caching collection data in memory to optimize performance. It also integrates with the GraphQL API, making data retrieval fast and efficient.
11. toolkit (Legacy)
A legacy package, toolkit was initially designed to offer shared utilities and helper functions across TinaCMS packages. As the CMS has evolved, most of these utilities have been either deprecated or moved into other core packages. This package may still be found in older projects but is generally phased out.
12. shared-context (Legacy)
shared-context was once used for sharing context between TinaCMS packages but is now mostly obsolete. With the CMS’s transition to a monolithic structure, much of the context-sharing functionality was refactored into other packages, making shared-context largely redundant.
13. webpack-helpers (Legacy)
webpack-helpers contains build tools for webpack configurations, primarily for managing React as a singleton. This package is now largely obsolete due to changes in TinaCMS’s bundling strategy, but it may still exist in legacy projects for compatibility.
14. metrics (Legacy - Not Used)
The metrics package is used for collecting anonymous usage data, such as command usage statistics within the TinaCMS CLI. Metrics are used to monitor and improve user experience, with typical metrics including starter usage or error occurrences during builds.
15. scripts
The scripts package handles build tasks for TinaCMS, with specific rules for handling MDX, GraphQL, and data-layer-specific tasks. The scripts were initially developed for more complex setups, but TinaCMS now leverages TurboRepo for efficient, consistent builds across packages.