Architecture

The golden slice: adding a module

One complete path from table creation to go-live, which is also what the skeleton generator does for you.

The golden slice is the smallest complete path for one new module: table, entity, query, endpoint, permission, menu, test — none missing.

Seven steps

  1. Create the table with Liquibase (db/changelog) and write accurate column comments.
  2. Run the generator to produce DO / Mapper / XML / Repository.
  3. For dynamic queries, write QueryXxxDTO and annotate each field with @QueryField.
  4. Simple CRUD goes Controller to AppService to Repository to Convert.
  5. Logic involving flows, rules or multiple aggregates goes into domain/handler/<module>/XxxHandler; AppService only calls it.
  6. Implement ErrorCode for any new error code and complete the i18n text in all three languages.
  7. Run ./gradlew build once.

One command replaces the first two steps

./gradlew generateModule -Pname=demo
OutputNotes
Directory skeletongenerated to the layering rules, no manual package creation
Migration scripta new changeset with a non-conflicting number
Test skeletongenerated code ships with tests; the build must pass first try
Registrationsmodule, permission codes and menus are registered automatically

Acceptance criteria

  • The build passes on the first run (including architecture guards and contract consistency).
  • Permission codes are registered and no literal permission code appears in code.
  • Menus are registered and the front end does not hardcode routes.
  • Column comments on the new table are complete and the soft-delete column is NOT NULL DEFAULT 0.

Tip: these four are not advice. They are what the skeleton generator and the build guarantee together.

Last updated 2026-10-09Edit this page →