Skip to content

Configuration

The kyro.config.ts file located at the root of your project is the single source of truth for your entire CMS. Because Kyro CMS is highly modular, this file dictates how your CMS stores data, handles authentication, presents the admin dashboard, and shapes your content APIs.

The kyro.config.ts File

When you use the @kyro-cms/create CLI, a default configuration file is automatically generated for you. If you are integrating Kyro CMS into an existing Astro project, you will create this file manually.

Here is a full example of a configuration file:

typescript
import { defineKyroConfig, createLocalAdapter } from "@kyro-cms/core";

export default defineKyroConfig({
  // 1. Database Adapter
  adapter: createLocalAdapter({ path: "./data/kyro.db" }),

  // 2. Collections (Your Content Types)
  collections: [
    {
      slug: "posts",
      label: "Blog Posts",
      fields: [
        { name: "title", type: "text", required: true },
        { name: "slug", type: "text", required: true },
        { name: "content", type: "richtext" },
      ],
    },
  ],

  // 3. Globals (Singletons)
  globals: [
    {
      slug: "site-settings",
      label: "Site Settings",
      fields: [
        { name: "siteTitle", type: "text", required: true },
        { name: "description", type: "textarea" },
      ],
    },
  ],

  // 4. Authentication
  auth: {
    tokenExpiration: 86400, // 24 hours
  },

  // 5. Admin Dashboard customization
  admin: {
    meta: {
      title: "My Kyro Admin",
      description: "Manage content easily",
    },
  },
  
  // 6. Plugins
  plugins: [],
});

Configuration Options

adapter

Required. The database adapter controls how Kyro reads and writes your data. Kyro supports multiple databases out of the box. You can use the local SQLite adapter (createLocalAdapter), Drizzle ORM (createDrizzleAdapter), or MongoDB (createMongoDBAdapter).

Learn more in the Database Adapters guide.

collections

An array of objects defining your content types (e.g., Users, Posts, Products). Each collection configures its own fields, access control rules, and admin panel behavior.

Learn more about defining fields in the Field Types guide.

globals

An optional array of global singletons and settings schemas.

You can pass:

  • Pre-packaged bundles from @kyro-cms/core/templates: allGlobalSettings (all 9 built-in panels: Site, SEO, Brand, Email, Storage, Access, System, Store, Shipping) or coreGlobalSettings (7 core panels).
  • Individual built-in panels: siteSettingsGlobal, seoSettingsGlobal, brandSettingsGlobal, emailSettingsGlobal, storageSettingsGlobal, accessSettingsGlobal, systemSettingsGlobal, storeSettingsGlobal, shippingSettingsGlobal.
  • Custom singletons: Your own custom global schemas (e.g. Navigation, Footer, Header Banner).

Learn more in the Globals guide.

auth

Configures authentication for both the Admin Panel and your API endpoints. Setting auth: true enables the default authentication. You can pass an object to define secret keys, session timeouts, and specific adapters.

Learn more in the Authentication guide.

admin

Customizes the appearance and behavior of the Kyro CMS Admin Dashboard.

  • meta: Customize the title, description, and OG image of the admin panel.
  • dateFormat: Set the format used for date fields across the dashboard.
  • disable: Set to true to disable the admin panel entirely.

Learn more in the Admin Customization guide.

plugins

An array of plugin configurations. Plugins can inject new collections, extend existing ones, or add entirely new features (like SEO helpers, E-Commerce workflows, or analytics).

graphQL

Options for configuring the auto-generated GraphQL API.

  • disablePlayground: Set to true to turn off the GraphQL Playground endpoint.
  • maxComplexity: Set a maximum query complexity to prevent abusive queries.

cors

Configures CORS (Cross-Origin Resource Sharing) policies for the API.

  • origins: An array of allowed origin strings.
  • credentials: Set to true to allow passing cookies across origins.

typescript

  • outputFile: Path where Kyro will generate TypeScript types for your collections and globals.

localization

  • locales: An array of locale strings (e.g., ['en', 'es', 'fr']).
  • defaultLocale: The default locale string.

Typings and Autocomplete

By wrapping your configuration object in defineKyroConfig(), you enable strict TypeScript type-checking and robust autocomplete in your editor. This guarantees that your configuration is valid before you run your app. Standardizing on defineKyroConfig prevents collisions with Astro or Vite configuration helpers.

typescript
import { defineKyroConfig } from "@kyro-cms/core";

export default defineKyroConfig({
  // Your config here...
});

Released under the MIT License.