Generate your first module
StackRivet’s code generator doesn’t just write CRUD. From a single database table it generates a governed module: backend layers, frontend pages, the menu, permissions, OpenAPI annotations, a test scaffold, a module manifest and AI-readable module context — all of it respecting the architecture and security rules.
The generator lives inside the product (admin UI plus the /api/v1/generator API); you don’t run a separate tool.
Before you start
Section titled “Before you start”- Have the backend and admin UI running (see Installation).
- Have a database table to generate from. The generator reads tables from MySQL 8.4 or PostgreSQL 18.4.
The flow
Section titled “The flow”select a table → import metadata → configure fields → configure menu & permissions→ preview → confirm → write code + manifest → run tests / start the app1. Import the table
Section titled “1. Import the table”Pick a table and import its metadata. The generator reads columns, types, primary key, indexes and comments.
GET /api/v1/generator/database-tables # browse available tablesPOST /api/v1/generator/tables/import # import the selected table(s)This creates the sr_gen_table and sr_gen_column config rows. Re-importing the same table prompts to merge or overwrite.
2. Configure fields
Section titled “2. Configure fields”For each column, set how it appears in the list, the form, queries, validation, dictionary and control type. StackRivet applies sensible defaults from the column type:
| DB type | Java | Control |
|---|---|---|
| varchar / text | String | input / textarea |
| integer / bigint | Integer / Long | number input |
| decimal | BigDecimal (never double, for money) | decimal input |
| boolean / tinyint(1) | Boolean | switch |
| date / datetime | LocalDate / LocalDateTime | date / datetime picker |
*_asset_id | String | asset uploader (auto-detected) |
*_dict | String | select |
id, tenant_id, created_at, updated_at and deleted stay out of the normal form by default. Any field you mark as a query condition is run through an index-risk check — if no index covers it, the preview flags it.
3. Configure the menu and permissions
Section titled “3. Configure the menu and permissions”The generator produces the menu entry plus menu, button and API permissions for the module, so it is locked down by default. (See Add a permission for the manifest details.)
4. Preview, then apply
Section titled “4. Preview, then apply”The generator always previews before it writes. Each file is marked new, overwrite or skip — and it will not overwrite a file you have modified unless you explicitly confirm.
POST /api/v1/generator/tables/{id}/preview # see the file diffPOST /api/v1/generator/tables/{id}/apply # write after you confirmWhat you get
Section titled “What you get”| Area | Files |
|---|---|
| Backend | {Name}Entity, {Name}Mapper, {Name}Service + Impl, {Name}Controller, Create/Update/Query DTOs, a Response VO |
| Frontend | {resource}.api.ts, a list page and a form dialog/drawer |
| Governance | menu + button + API permission seed, OpenAPI annotations, a base test, module manifest, AI-readable module context |
The generated backend compiles, the Controller never calls a Mapper directly, DTO/VO are not reused entities, list APIs paginate (max pageSize 200), and generated files carry template metadata and file hashes for the upgrade path.
After generating
Section titled “After generating”- Run the generated tests and start the app.
- Open the module in the admin UI and exercise create / read / update / delete.
- Continue customizing — an AI tool can read the module context to extend it safely (see AI coding workflow).
Edition boundary
Section titled “Edition boundary”Community generates single-table modules. Master-detail, tree and many-to-many generation, template editing and generated diff previews are Pro / Enterprise — see the pricing page.