This is the full developer documentation for StudioCMS # StudioCMS Documentation > Guides and resources for learning how to use StudioCMS. import { CardGrid, LinkButton } from '@astrojs/starlight/components'; import Card from '~/components/landing/Card.astro'; import ListCard from '~/components/landing/ListCard.astro'; import SplitCard from '~/components/landing/SplitCard.astro'; import { Center } from 'studiocms:ui/components'; ```sh # Create a new Astro project pnpm create studiocms@latest # Start the development server cd my-studiocms-project pnpm dev ```
For more information about required environment variables, see the [Environment Variables][environment-variables] page. For a more in-depth guide, check out the [Getting Started][getting-started] guide. Looking for a libSQL database? Check out [Turso][turso].
- [Getting Started][getting-started] - [Environment Variables][environment-variables] - [Why StudioCMS?][why-studiocms] - [Understanding StudioCMS][how-it-works] - [Using the SDK][using-the-sdk] - [Using the REST API][using-rest-api] - [Finding and Using Plugins][package-catalog] - [Learn about the Plugin API][plugin-api]
Want to get involved with the StudioCMS community? Join our Discord!
{/* Page MD Links */} [environment-variables]: /en/start-here/getting-started/ [getting-started]: /en/start-here/getting-started/ [turso]: https://tur.so/studiocms [why-studiocms]: /en/start-here/why-studiocms/ [how-it-works]: /en/how-it-works/ [using-the-sdk]: /en/how-it-works/sdk/ [using-rest-api]: /en/how-it-works/restapi/ [package-catalog]: /en/package-catalog/ [plugin-api]: /en/plugins/ # Authentication API import { StudioCMSAuthApi } from '@withstudiocms/api-spec'; import ScalarDoc from '~/components/ScalarDoc.astro'; # Dashboard API import { StudioCMSDashboardApiSpec } from '@withstudiocms/api-spec'; import ScalarDoc from '~/components/ScalarDoc.astro'; # Integration API import { StudioCMSIntegrationsApiSpec } from '@withstudiocms/api-spec'; import ScalarDoc from '~/components/ScalarDoc.astro'; # REST API import { StudioCMSRestApiV1Spec } from '@withstudiocms/api-spec'; import ScalarDoc from '~/components/ScalarDoc.astro'; # SDK API import { StudioCMSSDKApiSpec } from '@withstudiocms/api-spec'; import ScalarDoc from '~/components/ScalarDoc.astro'; # StudioCMSOptions > Reference page for StudioCMSOptions import ReadMore from '~/components/ReadMore.astro'; StudioCMS Integration config options schema reference ```ts twoslash title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- // Default Values shown export default defineStudioCMSConfig({ dbStartPage: true, db: {}, verbose: false, logLevel: 'Info', plugins: [], componentRegistry: {}, locale: {}, features: {} }); ``` ## `dbStartPage` Project initialization page - Used during first time setup to create your database configuration. - **Type:** `boolean` - **Default:** `true` ### Usage ```ts twoslash {2} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ dbStartPage: true, // DEFAULT - This injects a start page to setup your DB data. }) ``` ## `db` `db` is an object that is used to configure the database dialect. - **Type:** `DBConfigSchema` - **Default:** `{}` ### Usage ```ts twoslash {2-4} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ db: { dialect: 'libsql', // 'libsql' | 'postgresql' | 'mysql' }, }) ``` ## `storageManager` `storageManager` is used to configure the storage manager plugin for StudioCMS. - **Type:** `StudioCMSStorageManager` - **Default:** `undefined` ### Usage ```ts twoslash {3} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- import s3Storage from '@studiocms/s3-storage'; export default defineStudioCMSConfig({ storageManager: s3Storage(), }) ``` ## `verbose` `verbose` is a boolean that is used to enable or disable verbose logging. - **Type:** `boolean` - **Default:** `false` ### Usage ```ts twoslash {2} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ verbose: false, // DEFAULT - This sets the verbose logging to false. }) ``` ## `logLevel` `logLevel` is a union for setting the LogLevel for Effect based code. - **Type:** `All` | `Fatal` | `Error` | `Warning` | `Info` | `Debug` | `Trace` | `None` - **Default:** `Info` ### Usage ```ts twoslash {2} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ logLevel: 'Info', // DEFAULT }) ``` ## `plugins` `plugins` is an array that is used to determine which plugins should be loaded. - **Type:** `StudioCMSPlugin[]` - **Default:** `[]` ### Usage ```ts twoslash {1, 3-5} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- import blog from '@studiocms/blog'; export default defineStudioCMSConfig({ plugins: [ blog(), ], }) ``` ## `componentRegistry` `componentRegistry` is an object that is used to register components. - **Type:** `Record` - **Default:** `{}` ### Usage ```ts twoslash {2-4} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ componentRegistry: { 'my-component': './src/components/MyComponent.astro', }, }) ``` ## `locale` `locale` allows setting Locale specific settings [See `locale` for full options][locale] ## `features` `features` is an object that allows adjusting the StudioCMS Dashboard features [See `features` for full options][features] {/* Links */} [locale]: /en/config-reference/locale/ [features]: /en/config-reference/features/ # Features > Reference page for StudioCMSOptions features StudioCMS Integration config options schema reference ```ts twoslash title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: {}, }); ``` ## `robotsTXT` `robotsTXT` Allows the user to enable/disable and configure the use of the StudioCMS Custom `astro-robots-txt` Integration - **Type:** `RobotsConfig` | `boolean` - **Default:** `{ policy: [ { userAgent: ['*'], allow: ['/'], disallow: ['/dashboard/'] } ] }` ### Usage Note: `robotsTXT` can also be set to `false` to disable it. ```ts twoslash {3-11} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { robotsTXT: { policy: [ { userAgent: ['*'], allow: ['/'], disallow: ['/dashboard/'], } ] } } }) ``` ## `injectQuickActionsMenu` `injectQuickActionsMenu` allows enabling and disabling the quick actions menu which allows easy access to your dashboard while logged in on non-dashboard pages. - **Type:** `boolean` - **Default:** `true` ### Usage ```ts twoslash {3} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { injectQuickActionsMenu: true } }) ``` ## `sdk` `sdk` can either be a boolean or an object containing cache configuration. If it is a boolean, it defaults to `true` and transforms into an object with default cache configuration. ### Usage ```ts twoslash {3-7} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; import { Duration } from 'effect'; // ---cut--- export default defineStudioCMSConfig({ features: { sdk: { cacheConfig: { lifetime: Duration.minutes(5), }, } } }) ``` ### `cacheConfig` `cacheConfig` is an object that is used to configure the cache for the SDK. - **Type:** `boolean` | `{ lifetime?: Duration | undefined; }` | `undefined` - **Default:** `{ lifetime: Duration.minutes(5) }` #### Usage ```ts twoslash {5-8} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- import { Duration } from 'effect'; export default defineStudioCMSConfig({ features: { sdk: { // DEFAULT - This uses the default cache configuration. cacheConfig: { lifetime: Duration.minutes(5), }, } } }) ``` ## `dashboardConfig` `dashboardConfig` allows customization of the Dashboard Configuration ### Usage ```ts twoslash {3} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { dashboardConfig: {} } }) ``` ### `dashboardEnabled` `dashboardEnabled` allows the user to enable or disable the StudioCMS dashboard but still provide all the helper's and utilities to those who are customizing their setup, doing so will disable the dashboard and you will need to manage your content via your database #### Usage ```ts twoslash {4} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { dashboardConfig: { dashboardEnabled: true, } } }) ``` ### `inject404Route` `inject404Route` allows the user to enable or disable the default 404 route for the dashboard #### Usage ```ts twoslash {4} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { dashboardConfig: { inject404Route: true, } } }) ``` ### `faviconURL` `faviconURL` allows the user to override the default Favicon URL to a custom URL #### Usage ```ts twoslash {4} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { dashboardConfig: { faviconURL: '/favicon.svg', } } }) ``` ### `dashboardRouteOverride` `dashboardRouteOverride` allows the user to change the base route at which the dashboard is served (e.g., `/admin` instead of `/dashboard`) #### Usage ```ts twoslash {4} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { dashboardConfig: { dashboardRouteOverride: 'dashboard', } } }) ``` ### `versionCheck` `versionCheck` allows the user to enable or disable the version check for the dashboard. This will check for the latest version of StudioCMS and notify the user if there is a new version available. #### Usage ```ts twoslash {4} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { dashboardConfig: { versionCheck: true, } } }) ``` ### `security` `security` Allows customization of the Security Configuration #### Usage ```ts twoslash {4} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { dashboardConfig: { security: {} } } }) ``` #### `hideGeneratorTags` `hideGeneratorTags` Allows enabling or disabling of the Generator Meta Tags in the Dashboard HTML - **Type:** `boolean` - **Default:** `false` ##### Usage ```ts twoslash {5} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { dashboardConfig: { security: { hideGeneratorTags: false } } } }) ``` ## `authConfig` `authConfig` Allows customization of the Authentication Configuration ### Usage ```ts twoslash {3} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { authConfig: {} } }) ``` ### `enabled` Allows enabling or disabling of the Authentication Configuration - **Type:** `boolean` - **Default:** `true` #### Usage ```ts twoslash {4} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { authConfig: { enabled: true } } }) ``` ### `providers` Allows enabling or disabling of the Authentication Providers The following provider can be configured from here: `usernameAndPassword`. #### Usage ```ts twoslash {4-9} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { authConfig: { providers: { usernameAndPassword: true, usernameAndPasswordConfig: { allowUserRegistration: true } } } } }) ``` ## `developerConfig` `developerConfig` Allows customization of the Developer Options ### Usage ```ts twoslash {3} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { developerConfig: {} } }) ``` ### `demoMode` Enable demo mode for the site. If set to an object, the site will be in demo mode, and the user will be able to login with the provided username and password. #### Usage ```ts twoslash {4-7} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { developerConfig: { demoMode: { username: 'foo', password: 'bar' } } } }) ``` ## `preferredImageService` `preferredImageService` Allows setting the identifier of the Preferred Image Service Requires an Image Service to be installed such as `'cloudinary-js'` - **Type:** `string` | `undefined` - **Default:** `undefined` ### Usage ```ts twoslash {3} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { preferredImageService: 'cloudinary-js' } }) ``` ## `webVitals` `webVitals` Allows enabling or disabling of Web Vitals tracking - **Type:** `boolean` - **Default:** `false` ### Usage ```ts twoslash {3} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { webVitals: true } }) ``` ## `api` `api` allows configuring API specific features - **Type:** `ApiConfig` | `undefined` - **Default:** `undefined` ### Usage ```ts twoslash {3} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { api: { // api specific features here } } }) ``` ### `api.apiDocs` `apiDocs` allows enabling or disabling of the API Docs route which provides an OpenAPI Spec for the StudioCMS API - **Type:** `boolean` - **Default:** `true` #### Usage ```ts twoslash {4} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ features: { api: { apiDocs: true } } }) ``` # Locale > Reference page for StudioCMSOptions locale import ReadMore from '~/components/ReadMore.astro'; `locale` allows setting Locale-specific settings ```ts twoslash title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ locale: { dateLocale: 'en-US', dateTimeFormat: {}, i18n: {} }, }); ``` ## `dateLocale` `dateLocale` is a BCP 47 locale identifier used for date formatting. - **Type:** `string` - **Default:** `'en-US'` ### Usage ```ts twoslash {3} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ locale: { dateLocale: 'en-US', // DEFAULT - This sets the date locale for date formatting. } }) ``` ## `dateTimeFormat` `dateTimeFormat` is an object that is used to configure the date time format. - **Type:** `Intl.DateTimeFormatOptions` - **Default:** `{}` ### Usage ```ts twoslash {3-7} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ locale: { dateTimeFormat: { year: "numeric", month: "short", day: "numeric" }, } }) ``` ## `i18n` `i18n` is an object that is used to configure internationalization options. - **Type:** `object` - **Default:** `{}` ### Usage ```ts twoslash {3-5} title="studiocms.config.mjs" import { defineStudioCMSConfig } from 'studiocms/config'; // ---cut--- export default defineStudioCMSConfig({ locale: { i18n: { defaultLocale: 'en', }, } }) # Ecosystem Overview import ReadMore from '~/components/ReadMore.astro' The StudioCMS ecosystem is a vibrant and growing collection of tools, plugins, and integrations that enhance the core functionality of StudioCMS or extend the Astro framework. These ecosystem packages are developed by both the StudioCMS team and the wider community, providing users with a diverse range of options to customize and optimize their StudioCMS experience. ## Featured Packages ### StudioCMS UI Library `@withstudiocms/ui` is a comprehensive UI component library designed specifically for building user interfaces within StudioCMS projects. It provides a wide range of pre-built, customizable components that adhere to StudioCMS's design principles, making it easy to create consistent and visually appealing interfaces. Learn more about the StudioCMS UI Library in the [UI Library Documentation](/en/ecosystem/packages/studiocms-ui/). ### Template Language `@withstudiocms/template-lang` is a lightweight and flexible templating engine designed for rendering dynamic content in StudioCMS projects. It supports variable interpolation, making it easy to create dynamic templates for emails, documents, and web pages. Learn more about the Template Language in the [Template Language Documentation](/en/ecosystem/packages/template-lang/). ### Kysely Database Client `@withstudiocms/kysely` is a type-safe SQL query builder for TypeScript, built on top of the Kysely library. It provides a powerful and flexible way to interact with databases while ensuring type safety and reducing runtime errors. This package is used internally by StudioCMS for database operations but can also be used directly in your projects. Learn more about the Kysely Database Client in the [Kysely Documentation](/en/ecosystem/packages/kysely/). ### CFetch `@studiocms/cfetch` is an Astro integration that provides a cacheable fetch function for Astro SSR projects. It enhances the standard fetch API by adding caching capabilities, allowing you to cache responses and improve performance for server-side rendered applications. Learn more about CFetch in the [CFetch Documentation](/en/ecosystem/packages/cfetch/). # Apollo Discord Bot > Apollo is a fully-configurable Discord Bot that helps with managing Discord Servers for OSS projects. Apollo is a fully-configurable Discord Bot that helps with managing Discord Servers for OSS projects. It is designed to help with common tasks such as managing support requests, sending PTAL announcements, and more. See this bot in action on the [StudioCMS Discord Server](https://chat.studiocms.dev). ## Tech Stack - Discord.js - Drizzle ORM - libSQL - GitHub API ## Commands ### `ptal` - **Minimum Permission**: Moderate Members Creates a PTAL announcement in the current channel and pings the notifications role (if configured). ### `settings` - **Minimum Permission**: Administrator Command which carries the sub-commands for configuring the bot. #### `set-forum` - **Minimum Permission**: Administrator Allows you to configure the Forum to be used for support requests. #### `set-ptal-role` - **Minimum Permission**: Administrator Sets the role that gets pinged when a new PTAL announcement is sent. #### `set-join-role` - **Minimum Permission**: Administrator Sets the role that a user receives when they join the server. #### `print` - **Minimum Permission**: Administrator Prints an overview of all settings. ### `solved` - **Minimum Permission**: Moderate Members Sends an embed with buttons so the OP of a support request can close it. ### `support` - **Minimum Permission**: Moderate Members Creates a new post in the support forum based on the message you supply. # Artemis Discord Bot > Artemis Bot for StudioCMS Artemis is a powerful Effect based discord bot that is designed to interact with your Discord community and your Github Organization. Built for StudioCMS, open sourced for anyone to tweak to their hearts content. See this bot in action on the [StudioCMS Discord Server](https://chat.studiocms.dev). ## Tech Stack - Effect-TS - Effect dfx - Drizzle ORM - libSQL - GroqAI API - GitHub API - Algolia ## Features - Auto-threader bot - BlueSky discord repeater - Contribute Embed - Crowdin PTAL from repo dispatch - Docs Search with Algolia - Custom Event bus (primarily for HTTP -> discord communication) - GitHub issue from message app interaction - GitHub issue from thread command - No-Embed bot (stop people's messages from having embeds) - PTAL Service - Stars Graph - HTTP webserver for assets and webhook handling - `@` ping replies with AI interactions ## Services ### Auto-Threader Automatically create threads from every message in a channel To enable auto-threading in a channel, an administrator must add `[threads]` to the channel topic. ### No-Embed Prevents embeds from appearing in messages in a channel. To enable no-embed in a channel, an administrator must add `[noembed]` to the channel topic. ### Crowdin PTAL Automatically dispatch PTAL notifications when a Crowdin pull request is created. To enable Crowdin PTAL dispatch in a channel, an administrator must set up a repository dispatch event in their GitHub repository with the action type `crowdin.create` and the appropriate payload. Also requires the PTAL service to be configured in the server. ## Commands ### `bluesky` - **Minimum Permission**: Administrator Manage BlueSky account tracking and settings for this server. #### `list` - **Minimum Permission**: Administrator Lists all BlueSky accounts currently being tracked in this server. #### `subscribe ` - **Minimum Permission**: Administrator Subscribes the current channel to updates from the specified BlueSky account. The parameters `top_level`, `replies`, and `reposts` are booleans indicating whether to track those types of posts. #### `unsubscribe ` - **Minimum Permission**: Administrator Unsubscribes the current channel from updates from the specified BlueSky account. #### `settings` - **Minimum Permission**: Administrator View or modify BlueSky tracking settings for this server. ##### `post_channel ` - **Minimum Permission**: Administrator Sets the channel where BlueSky updates will be posted. ##### `ping_role [role] [enable]` - **Minimum Permission**: Administrator Sets the role to ping for BlueSky updates and whether to enable or disable the ping. ##### `view` - **Minimum Permission**: Administrator Views the current BlueSky tracking settings for this server. ### `contribute` - **Minimum Permission**: N/A Creates a contributing guide embed for the current channel. ### `crowdin-setup` - **Minimum Permission**: Administrator Set up a Crowdin embed in the current channel for a specified repository. #### `set ` - **Minimum Permission**: Administrator Set up a new Crowdin embed listener in the current channel for the specified GitHub repository. #### `remove ` - **Minimum Permission**: Administrator Remove the Crowdin embed from the current channel for the specified GitHub repository. #### `list` - **Minimum Permission**: Administrator List all Crowdin embeds in the current channel. ### `docs [hidden=false] [language=en]` - **Minimum Permission**: N/A Search the docs for a specific query using the Algolia Docsearch API. ### `issue-from-thread [title]` - **Minimum Permission**: N/A Create a GitHub issue from the current thread in the specified repository. The `type` parameter indicates the type of issue, and an optional `title` can be provided. ### `issue-settings` - **Minimum Permission**: Administrator Manage issue command settings for this server. #### `add-repo