---
title: 'Schema Configuration'
description: 'Reference and usage guidance for Schema 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

```tsx
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

```tsx
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`, `extensions`, 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.
- `spaces?: { code: string; label: string }[]` permission spaces; deploy before [assigning membership](/docs/schema/spaces).
- `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 }[]`
- `extensions?: StudioExtension[]` extension system for apps, custom fields, previews, and navbar overrides.

## Studio contribution points

Extensions can contribute:

- `apps`
- `formFields` (custom `inputType` UI)
- `previewFields`
- `navbar` overrides (`logo`, `projectSelector`, `search`)

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

See [extension development](/docs/extensions) for supported contribution contracts and [deployment](/docs/deployment) for the server/application boundary.


---

[View full sitemap](/docs/sitemap.md)
