Post entity using Sonamu UI, create a database table, and auto-generate Model files through scaffolding.
Prerequisites
- You must have completed the Quick Start guide and have the development server running.
- The API server must be running at http://localhost:1028.
Step 1: Access Sonamu UI
Open http://localhost:1028/sonamu-ui in your browser.
- Create and edit entities
- Add/modify/delete props
- Define relations
- Manage Enum types
- Define Subsets
- Create and run migrations
- Scaffolding (auto-generate Model files)
Step 2: Create a New Entity
Enter Basic Information and Create
Enter the basic information for the new entity and click the Create button:
- Entity ID:
Post(starts with uppercase, singular) - Table Name:
posts(lowercase, plural) - Title:
Post

Entity ID is used as the TypeScript class name, and Table Name is the actual database table name.
Step 3: Define Props
Now add props to thePost entity:
Add Basic Props
Click the Add a prop button to add the following props:

| Prop Name | Type | Description | Options |
|---|---|---|---|
id | integer | ID | Primary Key |
created_at | date | Created At | DB Default: CURRENT_TIMESTAMP |
title | string | Title | Length: 255 |
content | string | Content | - |
author | string | Author | Length: 100 |
view_count | integer | View Count | DB Default: 0 |
How to Configure Each Prop
How to Configure Each Prop
id prop
- Name:
id - Type:
integer - Description:
ID
- Name:
created_at - Type:
date - Description:
Created At - DB Default:
CURRENT_TIMESTAMP
- Name:
title - Type:
string - Description:
Title - Length:
255
- Name:
content - Type:
string - Description:
Content - Length: empty (creates TEXT type)
- Name:
author - Type:
string - Description:
Author - Length:
100
- Name:
view_count - Type:
integer - Description:
View Count - DB Default:
0

Define Subsets
In the Subsets section, define data query forms:
- Subset A (Admin):
id,created_at,title,content,author,view_count- Full information - Subset P (Public):
id,title,author,created_at- Public information - Subset SS (Secure Short):
id,title,author- Summary information

Subsets pre-define which props to include when querying data through APIs.
For details, see the Subset Guide.
Step 4: Database Migration
Now you need to apply the entity definition to the database.Generate Migration
Click the Generate button to auto-generate a new migration Code File.Click the 
<> button in the generated file list to open the migration file page in Cursor. The file content looks like this:
Run Migration
You can see pending migrations in the Migration tab.Click the all button, then click Apply to Latest to see migration targets in the modal.Select Shadow DB Testing and click the commit button to create the database table.
Step 5: Scaffolding (Auto-Generate Model Files)
After migration is complete, you can auto-generate Model files using Sonamu’s scaffolding feature.Select Templates
Select templates to generate:
- ✅ Model -
post.model.ts(business logic and API endpoints) - ✅ Model Test -
post.model.test.ts(test file)

Scaffolding auto-generates template files, so you don’t need to write code from scratch. Generated files can be modified to fit your project.
Step 6: Review Generated Model File
Let’s check thepost.model.ts file generated by scaffolding:

The generated Model file includes basic CRUD APIs. You can add or modify
business logic as needed.

Step 7: Auto-Generate Frontend Service
When you write APIs, frontend Service files are automatically generated.web/src/services/PostService.ts (auto-generated)
Step 8: Test the API
Now let’s test if the API is working correctly.Test with REST Client
Test in Browser
Navigate to http://localhost:1028/api/posts?subset=C to view the JSON response.Complete! 🎉
Congratulations! You’ve successfully created your first entity. You’ve completed the following:- ✅ Defined entity with Sonamu UI
- ✅ Created database table
- ✅ Auto-generated types and schemas
- ✅ Auto-generated Model and Test files with scaffolding
- ✅ Auto-generated REST API
- ✅ Auto-generated frontend Service
- ✅ Tested the API
Next Steps
Development Workflow
Understand Sonamu’s complete development workflow and learn how to work
efficiently.
Defining Relations
Learn how to define relationships between entities and write JOIN queries.
Puri Query Builder
Learn how to write complex database queries with the type-safe query builder.
Writing Tests
Learn how to test Model business logic based on the auto-generated test
templates.





