Skip to main content
Sonamu UI’s Entity management feature allows you to easily create and edit Entities through a visual interface. It’s much faster and more intuitive than directly modifying files via CLI.

Entity Tab Structure

Entity Management Screen

Entity Management Screen

The Entity tab consists of two main areas:
  • Left Sidebar: Entity list and new Entity add button
  • Right Content: Selected Entity details (Properties, Indexes, Relations, Subsets, Enums)

Creating an Entity

1. Click New Entity Button

Click the [+ New Entity] button at the bottom of the sidebar.

2. Enter Entity Information

When the modal opens, enter the following information:
If you specify a Parent Entity, it becomes a child of that Entity. Example: OrderOrderItem

3. Add Basic Properties

Created Entities include these basic fields by default:

Editing Properties

Adding a Property

  1. Click [+ Add Property] button
  2. Enter Property information:
Supported data types:
  • String: string (falls back to text without a length), uuid, searchText
  • Number: integer, bigInteger, number, numeric (precision/scale)
  • Date: date
  • Other: boolean, enum, json, virtual, vector, tsvector, relation
Most scalar types also have an array form such as integer[] or string[]. See Field Types for the full list.

Editing a Property

  1. Click on a Property row to enter edit mode
  2. Modify values
  3. Click elsewhere or press Enter to save

Deleting a Property

Click the [×] button on the Property row.
Data loss warning: Deleting a Property will delete all data in that column. Make sure to backup data before running the migration.

Managing Indexes

Adding an Index

  1. Scroll to the Indexes section
  2. Click [+ Add Index] button
  3. Enter Index information:
Index types:
  • index: Regular index (improves search performance)
  • unique: Unique index (prevents duplicates)
  • hnsw / ivfflat: pgvector vector indexes
Full-text search is not a separate index type. Use a searchText/tsvector prop together with the using: "gin" option — see pgvector setup.

Composite Index

Select multiple fields to create a composite index:
where is emitted as a PostgreSQL partial index predicate. Treat it as raw SQL: do not build it from user input.

Managing Relations

belongsTo (N:1 Relationship)

Meaning: “This Entity belongs to another Entity” Example: Post belongs to User
  1. Click [+ Add] button in the belongsTo section
  2. Enter information:
Generated code:

hasMany (1:N Relationship)

Meaning: “This Entity has multiple of another Entity” Example: User has multiple Posts
  1. Click [+ Add] button in the hasMany section
  2. Enter information:
Generated code:

Managing Enums

Use Enums when a field can only have limited values.

Adding an Enum

  1. Click [+ Add Enum] button in the Enums section
  2. Enter Enum information:
Generated code:
Using in Property:

AI-Assisted Entity Creation

Click the [💬 AI] button at the bottom of the sidebar to open the AI chat interface.

Create Entity with AI

Example prompt:
AI generates the Entity definition and adds it automatically.

Modify Entity with AI

Example prompt:
AI analyzes the existing Entity and applies the modifications.
Be specific: The more clearly you describe field types, constraints, and relationships, the more accurate results you’ll get.

Practical Example

E-commerce Product Entity

src/application/product/product.entity.json

Applying Changes

After modifying an Entity, you need to create and run a migration to reflect changes in the database.

Workflow

  1. Edit Entity: Modify Entity in the UI
  2. Create Migration: Generate migration in the Migration tab
  3. Run Migration: Run migration to apply to DB
  4. Scaffolding: Generate Model and test code
Entity files (.entity.json) are automatically saved when modified in the UI.

Next Steps

Migration Tab

Create and run migrations

Scaffolding Tab

Auto-generate Model code