Skip to content

StudioCMS Config

The StudioCMS config file is used to configure various aspects of StudioCMS in your Astro project. It allows you to define settings such as database configuration, plugins, component registry, localization, and feature flags.

  • .env
  • astro.config.mjs
  • studiocms.config.mjs
  • package.json
  • Directorysrc
astro.config.mjs
import
function node(userOptions: UserOptions): AstroIntegration
node
from '@astrojs/node';
import
const studioCMS: () => AstroIntegration

StudioCMS Integration

StudioCMS is an open-source headless CMS built for Astro, by members of the Astro community.

To configure StudioCMS, create a studiocms.config.* file in the root of your Astro project. Then, import the defineStudioCMSConfig function from studiocms/config and export the configuration as the default export.

Note: Supported config file extensions are .ts, .js, .mts, and .mjs.

@seeThe GitHub Repo: withstudiocms/studiocms for more information on how to contribute to StudioCMS.

@seeThe StudioCMS Docs for more information on how to use StudioCMS.

studioCMS
from 'studiocms';
import {
function defineConfig<const TLocales extends Locales = never, const TDriver extends SessionDriverName = never, const TFontFamilies extends FontFamily[] = never>(config: AstroUserConfig<TLocales, TDriver, TFontFamilies>): AstroUserConfig<TLocales, TDriver, TFontFamilies>

See the full Astro Configuration API Documentation https://astro.build/config

defineConfig
} from 'astro/config';
export default
defineConfig<never, never, never>(config: AstroUserConfig<never, never, never>): AstroUserConfig<never, never, never>

See the full Astro Configuration API Documentation https://astro.build/config

defineConfig
({
AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.site?: string

@namesite

@type{string}

@description

Your final, deployed URL. Astro uses this full URL to generate your sitemap and canonical URLs in your final build. It is strongly recommended that you set this configuration to get the most out of Astro.

{
site: 'https://www.my-site.dev'
}

site
: 'https://demo.studiocms.dev/',
AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.output?: "server" | "static"

@nameoutput

@type{('static' | 'server')}

@default'static'

@seeadapter *

@description

Specifies the output target for builds.

  • 'static' - Prerender all your pages by default, outputting a completely static site if none of your pages opt out of prerendering.
  • 'server' - Use server-side rendering (SSR) for all pages by default, always outputting a server-rendered site.
import { defineConfig } from 'astro/config';
export default defineConfig({
output: 'static'
})

output
: 'server',
AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.adapter?: AstroIntegration

@nameadapter

@seeoutput *

@description

Deploy to your favorite server, serverless, or edge host with build adapters. Import one of our first-party adapters (Cloudflare, Netlify, Node.js, Vercel) or explore community adapters to enable on-demand rendering in your Astro project.

See our on-demand rendering guide for more on Astro's server rendering options.

import netlify from '@astrojs/netlify';
{
// Example: Build for Netlify serverless deployment
adapter: netlify(),
}

adapter
:
function node(userOptions: UserOptions): AstroIntegration
node
({
UserOptions.mode: "standalone" | "middleware"

Specifies the mode that the adapter builds to.

  • 'middleware' - Build to middleware, to be used within another Node.js server, such as Express.
  • 'standalone' - Build to a standalone server. The server starts up just by running the built script.

mode
: "standalone" }),
AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never, TFontFamilies extends FontFamily[] = never>.integrations?: (false | AstroIntegration | (false | AstroIntegration | null | undefined)[] | null | undefined)[]

@nameintegrations

@description

Extend Astro with custom integrations. Integrations are your one-stop-shop for adding framework support (like Solid.js), new features (like sitemaps), and new libraries (like Partytown).

Read our Integrations Guide for help getting started with Astro Integrations.

import react from '@astrojs/react';
import mdx from '@astrojs/mdx';
{
// Example: Add React + MDX support to Astro
integrations: [react(), mdx()]
}

integrations
: [
function studioCMS(): AstroIntegration

StudioCMS Integration

StudioCMS is an open-source headless CMS built for Astro, by members of the Astro community.

To configure StudioCMS, create a studiocms.config.* file in the root of your Astro project. Then, import the defineStudioCMSConfig function from studiocms/config and export the configuration as the default export.

Note: Supported config file extensions are .ts, .js, .mts, and .mjs.

@seeThe GitHub Repo: withstudiocms/studiocms for more information on how to contribute to StudioCMS.

@seeThe StudioCMS Docs for more information on how to use StudioCMS.

studioCMS
() ],
});
studiocms.config.mjs
import {
function defineStudioCMSConfig(config: StudioCMSOptions): StudioCMSOptions

A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

@example

// studiocms.config.mjs
import { defineStudioCMSConfig } from 'studiocms/config';
export default defineStudioCMSConfig({
dbStartPage: true,
// ...Other Options
})

defineStudioCMSConfig
} from "studiocms/config";
export default
function defineStudioCMSConfig(config: StudioCMSOptions): StudioCMSOptions

A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

@example

// studiocms.config.mjs
import { defineStudioCMSConfig } from 'studiocms/config';
export default defineStudioCMSConfig({
dbStartPage: true,
// ...Other Options
})

defineStudioCMSConfig
({
StudioCMSOptions.dbStartPage?: boolean

Project Initialization Page - Used during First Time Setup to initialize the database

@defaulttrue

dbStartPage
: false,
// other configuration options
})

For more information on the StudioCMS configuration options, see the reference page.