Entity Definitions
Entities are the core building blocks of your Radish blueprint. Each entity represents a data type in your application.
Basic Entity Structure
{
"entities": {
"EntityName": {
"label": "Display Name",
"description": "Description of the entity",
"plural": "entities",
"fields": {},
"filters": [],
"indexes": []
}
}
}
Entity Properties
label
Human-readable name for the entity (singular form).
{
"label": "Task"
}
description
Brief description of what this entity represents.
{
"description": "A todo task that can be assigned to users"
}
plural
Plural form used for collections and endpoints.
{
"plural": "tasks"
}
ownership
Determines entity ownership model:
user(default) - Entity belongs to a specific user (hasownerId)system- System-level entity, no owner
{
"ownership": "system"
}
extends
Inherit fields from another entity or base type.
{
"extends": "EntityBase"
}
Built-in base types:
EntityBase- Standard entity with id, ownerId, timestampsSystemEntityBase- System entity with id, timestamps (no owner)ContentBase- Extends EntityBase with title, slug, tags, status, etc.
versioning
Enable version tracking:
full- Complete snapshots with revert capabilitysimple- Lightweight audit logs
{
"versioning": "simple"
}
Example Entity
{
"entities": {
"Project": {
"label": "Project",
"description": "Project for organizing tasks",
"plural": "projects",
"ownership": "user",
"versioning": "simple",
"fields": {
"name": {
"type": "string",
"required": true,
"label": "Project Name"
},
"description": {
"type": "string",
"optional": true
},
"status": {
"type": "enum",
"values": ["active", "archived", "completed"],
"default": "active"
},
"memberIds": {
"type": "objectId[]",
"ref": "User",
"default": []
}
},
"filters": ["status", "ownerId"],
"indexes": [
{ "fields": ["ownerId", "status"] },
{ "fields": ["name"], "options": { "unique": true } }
]
}
}
}