Accessing Sonamu UI
Running the Server
Accessing the UI
When the API server is running, Sonamu UI is automatically served:Sonamu UI is served at the
/sonamu-ui path of the API server without a separate port.Main Tab Structure
Sonamu UI consists of 4 main tabs:- Entities
- Migrations
- Scaffolding
- Fixture
Entity definition and management
- Create, edit, delete Entities
- Configure Props, Indexes, Subsets, Enums
Creating an Entity
1. Entity List Page
Click the Entities tab to see all Entities in the project.- Entity ID and Title
- Table name
- Number of Props
- Number of Relations
2. Creating a New Entity
Enter Basic Information
Enter the following information in the Entity creation form:
- Entity ID: PascalCase (e.g.,
User,BlogPost) - Table Name: snake_case (e.g.,
users,blog_posts) - Title: Display name (e.g., “User”, “Blog Post”)
- Parent ID: Optional - used when inheriting from another Entity
Editing an Entity
Click an Entity to open the detail editing page. It consists of 4 sheets:Props Sheet
The main sheet for managing Entity properties (columns).Adding Props
Click Add Property Button
Click the “Add Property” button in the top right or use shortcut
Ctrl+Cmd+Shift+NEnter Property Information
Basic Fields:
name: Property name (snake_case)type: Data type (select from dropdown)desc: Description (optional)nullable: Allow NULL (checkbox)dbDefault: Database default value
string / string[]
string / string[]
length: String length (default: TEXT)- Example:
length: 255→VARCHAR(255)
number / number[]
number / number[]
precision: Total digitsscale: Decimal placesnumberType:real|double precision|numeric(default: numeric)- Example:
precision: 10, scale: 2→NUMERIC(10, 2)
numeric / numeric[]
numeric / numeric[]
precision: Total digitsscale: Decimal places- Note: Processed as
stringtype in TypeScript (maintains precision)
enum / enum[]
enum / enum[]
id: Enum type ID (e.g.,UserRole)- Enums are defined in a separate Enums section
json
json
id: JSON schema type ID- Define TypeScript type in
{entity}.types.ts
vector / vector[]
vector / vector[]
dimensions: Vector dimensions (e.g., 1536)- Requires pgvector extension
virtual
virtual
id: Virtual type IDvirtualType:code|querycode: Calculated with TypeScript code (default)query: Calculated with SQL query
- Computed field not stored in database
relation
relation
- Select and configure Relation type
- See Relations for details
Editing and Deleting Props
- Edit
- Delete
- Reorder
- Double-click the row to edit in Props list or press
Enter - Or select row and click “Edit” button on the right
- Edit values in form and save
Indexes Sheet
Manages database indexes.Adding an Index
Configure Index
Index Options:
type: Index typeindex: Regular indexunique: Unique index (prevents duplicates)hnsw: Vector HNSW indexivfflat: Vector IVFFlat index
name: Index name (can be auto-generated)columns: Select columns to include- Multiple columns can be selected
- Column order matters (composite index)
using: Index method (optional)btree(default)hashgingist
vectorOps: Distance operatorvector_cosine_ops: Cosine distance (recommended)vector_ip_ops: Inner product distancevector_l2_ops: Euclidean distance
m: HNSW graph connections (default: 16)efConstruction: HNSW construction quality (default: 64)lists: IVFFlat cluster count (default: 100)
Subsets Sheet
Defines field combinations for API responses.Adding Subset Keys
Selecting Fields
- Regular Fields
- Relation Fields
- Internal Fields
- Click checkboxes to include/exclude fields
- Same field can be selected in multiple subsets
Enums Section
Defines Enum type keys and labels.Adding an Enum
Adding Enum Values
Each Enum is displayed as a separate tab, composed of key-label pairs.- Click “Add Row” button
- Or use
Ctrl+Cmd+Shift+Nin Enum tab - Enter Key and Label
- Key: Only lowercase letters, numbers, underscores allowed
- Label: Display text
Keyboard Shortcuts
Sonamu UI provides various shortcuts for efficient work.Global Shortcuts
| Shortcut | Function |
|---|---|
Cmd+S | Save current Entity |
Cmd+K | Enter search mode |
Tab | Move to next sheet |
Shift+Tab | Move to previous sheet |
Esc | Close dialog / Deselect |
Props/Indexes Sheet
| Shortcut | Function |
|---|---|
Ctrl+Cmd+Shift+N | Add new item |
Enter | Edit selected item |
Cmd+Backspace | Delete selected item |
↑ ↓ | Move selection |
Cmd+↑ Cmd+↓ | Change item order |
Search Mode
| Shortcut | Function |
|---|---|
Cmd+K | Start search |
| Typing | Auto-move to matching item |
Enter | Complete search |
Esc | Cancel search |
Deleting an Entity
Impact of Deletion:
{entity}.entity.jsonfile deleted- Related Model, Types files need to be deleted manually
- Database table should be deleted separately through migration
File Structure
When you save an Entity, the following files are generated:Highlighted files are auto-generated by Sonamu.
Real-time Validation
Sonamu UI validates input immediately:- Props
- Indexes
- Subsets
- Enums
- Reserved word check (JavaScript/TypeScript keywords)
- Type-specific required option check
- Duplicate name check
Auto-Completion Features
Sonamu UI provides context-appropriate auto-completion:When Entering Entity ID
When Entering Entity ID
- Existing Entity list suggested
- Filtered as you type
When Configuring Relations
When Configuring Relations
- Auto-complete available Entity list in
withfield
When Entering Type ID
When Entering Type ID
- Type suggestions in
idfield for JSON, Virtual types
When Entering Enum ID
When Entering Enum ID
- Defined Enum list suggested
- New Enum creation option provided