kra-oa/internal/initialize/README.md

23 lines
1010 B
Markdown

# Initialization
`internal/initialize` owns application bootstrap orchestration. It implements
`biz.InitializationRepo`, coordinates the explicit first-install workflow, and
formats the compatible runtime configuration API.
The package depends on a narrow `Backend` interface. `*data.Data` implements
that interface and remains responsible for opening, migrating, activating,
reloading, and persisting database-backed runtime infrastructure.
The first-install order is:
1. `data` opens the candidate database.
2. The single root migration runner applies infrastructure, system, and
payment schema steps.
3. `initialize` invokes `system.SeedSystem` for administrator, menu, API,
department, policy, and module administration-surface records.
4. `data` persists configuration and activates the candidate clients.
Schema migration and business seed data are deliberately separate. Normal
startup and configuration reload may run migrations, but only the explicit
first-install endpoint runs seed data.