Skip to main content
Here are practical tips and best practices for using Sonamu UI more efficiently.

Keyboard Shortcuts

Essential shortcuts for quick work:
ShortcutFunctionDescription
⌘K / Ctrl+KSearchOpen global search modal
EscCloseClose open modal
⌘S / Ctrl+SSaveSave current edit
TabNext fieldMove to next field in forms
EnterConfirmSubmit 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

TypeConventionExample
Entity IDPascalCaseUser, OrderItem
Field namesnake_casecreated_at, user_id
EnumPascalCaseUserRole, OrderStatus
Subset IDUppercaseA, 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

2. Performance Optimization

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

APIRecommended SubsetReason
List queryAFast response
Detail queryB or CFull info
AutocompleteA (minimized)Ultra-fast response
Admin pageCAll info

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

Using Browser Developer Tools

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:
  1. Browser refresh (F5)
  2. Hard reload (βŒ˜β‡§R / Ctrl+Shift+R)
  3. Restart API server
  4. 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