Here are practical tips and best practices for using Sonamu UI more efficiently.
Keyboard Shortcuts
Essential shortcuts for quick work:
| Shortcut | Function | Description |
|---|
βK / Ctrl+K | Search | Open global search modal |
Esc | Close | Close open modal |
βS / Ctrl+S | Save | Save current edit |
Tab | Next field | Move to next field in forms |
Enter | Confirm | Submit form or complete edit |
Use search: Open search with βK to quickly find Entity names, field names, etc.
Entity Management Tips
1. Structure Parent-Child Entities
Organize related Entities in parent-child relationships:
Order (parent)
βββ OrderItem (child)
βββ OrderPayment (child)
βββ OrderShipment (child)
Benefits:
- Displayed hierarchically in sidebar
- Easy to find related Entities
- Logical grouping
2. Consistent Naming Conventions
| Type | Convention | Example |
|---|
| Entity ID | PascalCase | User, OrderItem |
| Field name | snake_case | created_at, user_id |
| Enum | PascalCase | UserRole, OrderStatus |
| Subset ID | Uppercase | A, B, C |
3. Leverage AI Chat
Writing effective prompts:
β Bad example:
"Make a user"
β
Good example:
"Create an e-commerce User Entity.
Fields: email (unique), name, phone (nullable),
role (enum: admin, user, guest),
created date, last login"
Be specific:
- Specify field types and constraints
- Describe relationship settings
- Mention index requirements
4. Organize Property Order
Arrange fields in meaningful order:
{
properties: [
// 1. Primary Key
{ name: "id", ... },
// 2. Core information
{ name: "title", ... },
{ name: "content", ... },
// 3. Foreign keys
{ name: "user_id", ... },
{ name: "category_id", ... },
// 4. Status/flags
{ name: "status", ... },
{ name: "is_active", ... },
// 5. Timestamps
{ name: "created_at", ... },
{ name: "updated_at", ... },
]
}
Migration Tips
1. Run in Small Units Frequently
β Bad example:
- Modify 10 Entities at once
- Migrate once a week
β
Good example:
- Modify 1-2 Entities at a time
- Migrate multiple times a day
- Test after each migration
2. Use Migration Preview
Always check Preview before execution:
Check items:
- β
Are the columns being added correct?
- β οΈ Are any columns being deleted?
- π Are type changes intentional?
3. Production Migration Checklist
β‘ Testing complete on Development DB
β‘ Verification complete on Testing DB
β‘ Data backup complete
β‘ Migration Preview checked
β‘ Rollback plan established
β‘ Team notified
β‘ Production DB migration executed
β‘ Application restarted and verified
Scaffolding Tips
1. Batch Generation Strategy
Project initial:
1. Define all Entities
2. [Select All] β Batch generate Model + Test
3. Add business logic to each Model
During development:
1. Add only one new Entity
2. Select and generate only that Entity
3. Start development immediately
2. Backup Habit
Backup Models with important business logic before regeneration:
# Backup
cp src/models/User.model.ts src/models/User.model.ts.bak
# Regenerate
[Overwrite in UI]
# Restore needed logic
3. Utilize Git
Commit generated files immediately to manage change history:
git add src/models/
git commit -m "Generate models for User, Post, Comment"
Subset Usage Tips
1. Define Standard Subsets
Define consistent Subsets for all Entities:
// Apply commonly to all Entities
Subset A: For list
- id
- title (or name)
- 1-2 core fields
- created_at
Subset B: For detail
- All general fields
- Exclude sensitive info
- Include timestamps
Subset C: With relations
- Based on Subset B
- Add needed relations
Include only needed fields:
// β Excessive fields
{
...allFields,
author: "User.C", // All User relations too
category: "Category.B",
tags: "Tag.C",
}
// β
Optimized
{
id: true,
title: true,
content: true,
author: "User.A", // Minimum info only
category_id: true,
created_at: true,
}
3. Subset Selection by API
| API | Recommended Subset | Reason |
|---|
| List query | A | Fast response |
| Detail query | B or C | Full info |
| Autocomplete | A (minimized) | Ultra-fast response |
| Admin page | C | All info |
Using Search
Quick Navigation
Search (βK) can find:
- Entity:
User, Post
- Fields:
email, created_at
- Migration: Filename search
- Subset:
User.Subset A
Search tips:
user email β User Entity's email field
post migration β Post-related migrations
subset A β All Subset A's
Workflow Optimization
New Feature Development Flow
1. Define Entity (Entity tab)
- Quick creation with AI chat
- Set fields and relations
β
2. Define Subsets (within Entity tab)
- Create A, B, C standard Subsets
β
3. Run Migration (Migration tab)
- Check Preview
- Execute Development β Testing order
β
4. Scaffolding (Scaffolding tab)
- Generate Model + Test
β
5. Development (code editor)
- Add Model methods
- Implement API endpoints
- Write tests
β
6. Register Fixtures (Fixture tab)
- Prepare test data
Entity Modification Flow
1. Modify Entity (Entity tab)
- Add/modify/delete fields
β
2. Check Migration Creation (Migration tab)
- Check auto-generated migration
β
3. Review Preview
- Confirm intended changes
- Check data loss risk
β
4. Run Migration
- Development β Testing order
β
5. Modify Model (if needed)
- Confirm type auto-sync
- Add logic using new fields
Network Tab
Check API calls for debugging:
F12 β Network tab
- Migration execution β Check /api/migrate/run
- Entity save β Check /api/entity/save
- Check response content on error
Console Tab
Check error messages:
F12 β Console tab
- Check JavaScript errors
- API response error logs
- Network request failure causes
Troubleshooting
When UI is Slow
Cause: Too many Entities or large data
Solution:
- Clear browser cache
- Close unnecessary browser tabs
- Restart Sonamu UI
When Changes Arenβt Reflected
Solution:
- Browser refresh (
F5)
- Hard reload (
ββ§R / Ctrl+Shift+R)
- Restart API server
- Restart Sonamu UI
Entity Save Failed
Check:
- Is API server running?
- Do you have file write permission?
- Is field name valid? (reserved word check)
- Is foreign key reference correct?
Next Steps