Skip to Content
SchemaOverview

Flexkit Schema Documentation

Flexkit schemas define your data model in code. A schema describes:

  • Structure: what entities exist (product, deal, invoice, etc.)
  • Attributes: what fields each entity has (name, price, status, etc.)
  • Semantics: how data is stored (dataType) and edited (inputType)
  • Relationships: how entities connect (single or multiple)
  • Scope behavior: whether a value is global, local, or relational

Schemas are the foundation of how your data is structured, stored, queried, and presented in the Flexkit ecosystem. This documentation will help you understand what schemas are, how they work, and how to use them effectively in your Flexkit projects.

Quick Start

React
import { defineConfig, defineEntity } from '@flexkit/studio';
 
const products = defineEntity({
  name: 'product',
  plural: 'products',
  menu: { label: 'Products', group: 'catalog' },
  attributes: [
    {
      name: 'name',
      label: 'Name',
      scope: 'global',
      dataType: 'string',
      inputType: 'text',
      isPrimary: true,
      isSearchable: true,
      defaultValue: '',
      validation: (z) => z.string().min(1, { message: 'Name is required' }),
      options: {
        comment: 'Public product name',
        size: 260,
      },
    },
    {
      name: 'price',
      label: 'Price',
      scope: 'global',
      dataType: 'float',
      inputType: 'number',
      defaultValue: '',
      validation: (z) => z.number().min(0, { message: 'Price must be >= 0' }),
      options: {
        comment: 'Current selling price',
        min: 0,
      },
    },
  ],
});
 
export default defineConfig({
  title: 'My Project',
  projectId: 'myprojectid',
  basePath: '/studio',
  schema: [products],
});

Core Model

  • Project config (defineConfig) wires project settings, scopes, plugins, and schema.
  • Entity (defineEntity) is a collection/table-like model.
  • Attribute config defines storage type, form input type, validation, and behavior flags.
  • Relationship attributes link entities through relationship.entity, relationship.mode, and relationship.field.

More resources

Last updated on

© 2026