Skip to main content
Entities are custom data structures you define to store information in your Base44 applications. They work like database tables, with built-in validation, real-time updates, and security rules. Use the entities module to work with entity data in code.
To configure security rules for your entity, see Security.

Define entity schemas

Entities are defined using a JSON Schema that describes the data structure and validation rules.

Basic schema structure

Here’s an entity schema template:
{
  "name": "my_entity",
  "type": "object",
  "title": "My Entity",
  "description": "Description of what this entity represents",
  "properties": {
    "<field_name>": {
      "type": "<field_type>",
      "<option>": "<value>"
    }
  },
  "required": ["<field_name>"]
}

Schema fields

name
string
String identifier for the entity.
type
string
required
Must be "object".
title
string
User-friendly display name.
description
string
Description of what the entity represents.
properties
object
required
Object containing your field definitions. Each field has a type and optional validation rules.

Field types

Entities support various field types to define different kinds of data you can store: string, integer, number, boolean, array, and object. Each field inside properties requires a type. Based on the type, you can add validation options.

String fields

String fields support these options:
  • minLength / maxLength: Control minimum and maximum character count.
  • pattern: Regular expression for custom validation.
  • format: Predefined formats. Supported values:
    • "date"
    • "date-time"
    • "time"
    • "email"
    • "uri"
    • "hostname"
    • "ipv4"
    • "ipv6"
    • "uuid"
  • enum: Restrict to specific allowed values. Define as an array: ["value1", "value2", "value3"].
  • default: Default value if none provided.

Integer fields

Integer fields support these options:
  • minimum / maximum: Set inclusive lower/upper bounds.
  • default: Default value if none provided.

Number fields

Number fields support these options:
  • minimum / maximum: Set inclusive lower/upper bounds.
  • default: Default value if none provided.

Boolean fields

Boolean fields support these options:
  • default: Default value if none provided.

Array fields

Array fields support these options:
  • items: Define the type/schema for array elements.
  • default: Default array value if none provided.

Object fields

Object fields support these options:
  • properties: Define the fields within the object.
  • required: List of required property names.

Required fields

Specify which fields must be provided:
{
  "required": ["title", "email"]
}

Complete example

Here’s a complete entity schema:
{
  "name": "Task",
  "type": "object",
  "title": "Task",
  "description": "A task item with priority, due date, and completion status",
  "properties": {
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "description": {
      "type": "string",
      "maxLength": 1000
    },
    "priority": {
      "type": "string",
      "enum": ["low", "medium", "high"],
      "default": "medium"
    },
    "completed": {
      "type": "boolean",
      "default": false
    },
    "due_date": {
      "type": "string",
      "format": "date"
    },
    "tags": {
      "type": "array",
      "items": {"type": "string"}
    }
  },
  "required": ["title"]
}

Viewing schemas in dashboard

You can view your entity schemas directly in the Base44 dashboard:
  1. Go to your app’s Data section.
  2. Select the entity you want to view.
  3. Click Schema to view the current JSON schema.

See also