Skip to Content
SchemaSchema Configuration

Schema Configuration

Use defineConfig() in flexkit.config.ts to register one project or multiple projects. The file is pure data: it exports entities, attributes, scopes, spaces and menu groups, and nothing else. flexkit deploy reads it, serializes it and sends it to the project; the Studio then renders the deployed configuration.

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

Single Project

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

Multiple Projects

TypeScript
import { defineConfig } from '@flexkit/schema';
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',
    scopes: [
      { name: 'default', label: 'Global', isDefault: true },
      { name: 'na', label: 'North America' },
      { name: 'emea', label: 'EMEA' },
    ],
    schema: [crmDeals, crmContacts],
  },
  {
    title: 'ERP',
    projectId: 'erp123',
    scopes: [
      { name: 'default', label: 'Default', isDefault: true },
      { name: 'warehouse-a', label: 'Warehouse A' },
      { name: 'warehouse-b', label: 'Warehouse B' },
    ],
    schema: [erpSuppliers],
  },
]);

flexkit deploy starts one deploy job per project in the array.

Defining Scopes

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

  • Add a scopes key next to projectId, menuGroups, spaces, 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 Studio title shown in the navbar. Falls back to the project name from the Dashboard.
  • projectId: string unique project identifier.
  • menuGroups?: { name: string; title: string }[] sidebar sections. Entities join one through entity.menu.group; a menu.group that is not declared here is rejected at deploy.
  • scopes: { name: string; label: string; isDefault?: boolean; sortOrder?: number }[] data variants (markets, channels). See Scopes.
  • spaces?: { code: string; label: string }[] permission spaces; deploy before assigning membership.
  • schema: Entity[] list of entities created with defineEntity.

There is no basePath, extensions, commands or icon key. The path the Studio is mounted on is a property of the <FlexkitStudio> component in your app (basename), not of the schema, and the Studio UI is no longer extended from the config: extend behaviour through custom tools, skills and automations instead.

The file

  • The config must be flexkit.config.ts (.js and .mjs are also accepted). A flexkit.config.tsx is refused by the CLI with migration guidance: rename it to .ts, replace icon components with lucide icon names such as 'Tag', use booleans for hidden and readOnly, and remove extensions, basePath and commands.
  • import { defineConfig, defineEntity } from '@flexkit/schema'. Both helpers are also re-exported by @flexkit/studio.
  • Export the result of defineConfig() as the default export.

The Studio fetches the deployed schema for each project after login. Editing the config file changes nothing on screen until you run flexkit deploy. A project that has never been deployed shows a “No deployed schema” screen.

See deployment for the server/application boundary and schema deployment and migrations for changing a live schema safely.

Last updated on