Skip to Content
SchemaSchema Configuration

Schema Configuration

Use defineConfig() to register one project or multiple projects.

Each project configuration should define a scopes array. At least one scope should be marked with isDefault: true.

Single Project

React
import { defineConfig } from '@flexkit/studio';
import { products } from './schema/products';
import { categories } from './schema/categories';
 
export default defineConfig({
  title: 'Commerce',
  projectId: 'commerce123',
  basePath: '/studio',
  menuGroups: [
    { title: 'Catalog', name: 'catalog' },
    { title: 'Operations', name: 'operations' },
  ],
  scopes: [
    { name: 'default', label: 'Default', isDefault: true },
    { name: 'es', label: 'Spain' },
    { name: 'fr', label: 'France' },
  ],
  schema: [products, categories],
});

Multiple Projects

React
import { defineConfig } from '@flexkit/studio';
import { crmDeals } from './schema/crm/deals';
import { crmContacts } from './schema/crm/contacts';
import { erpSuppliers } from './schema/erp/suppliers';
 
export default defineConfig([
  {
    title: 'CRM',
    projectId: 'crm123',
    basePath: '/studio',
    scopes: [
      { name: 'default', label: 'Global', isDefault: true },
      { name: 'na', label: 'North America' },
      { name: 'emea', label: 'EMEA' },
    ],
    schema: [crmDeals, crmContacts],
  },
  {
    title: 'ERP',
    projectId: 'erp123',
    basePath: '/studio',
    scopes: [
      { name: 'default', label: 'Default', isDefault: true },
      { name: 'warehouse-a', label: 'Warehouse A' },
      { name: 'warehouse-b', label: 'Warehouse B' },
    ],
    schema: [erpSuppliers],
  },
]);

Defining Scopes

Scopes are configured at the project level, not on individual entities.

  • Add a scopes key next to projectId, basePath, plugins, and schema.
  • Define at least one scope with isDefault: true.
  • Use scope: 'local' on attributes that should store different values per selected scope.
  • When a local value is missing in the selected scope, the default scope value is used.

Config Fields

  • title?: string project label shown in UI.
  • projectId: string unique project identifier.
  • basePath?: string studio route path.
  • schema: Entity[] list of entities created with defineEntity.
  • menuGroups?: { title: string; name: string }[] group names used by entity.menu.group.
  • scopes: { name: string; label: string; isDefault?: boolean; sortOrder?: number }[]
  • plugins?: PluginOptions[] plugin system for apps, commands, custom fields, previews, and navbar overrides.

Plugin Extension Points (Summary)

Plugins can contribute:

  • apps
  • formFields (custom inputType UI)
  • previewFields
  • commands
  • navbar overrides (logo, projectSelector, search)

Use plugins when you need custom form behavior or additional Studio modules beyond schema modeling.

Last updated on

© 2026