Architecture · 0.8.1

Generator internals

Manifest, normalization, plan, templates and UI.

On this page

The previous articles describe your application. This is the separate Admingen repository: it reads the declarative model, normalizes it, plans changes and creates files. Generator UI and the supplementary CLI call shared application logic.

The tree shows main paths using Article as an example, not a complete inventory. Files depend on the model and project capabilities.

Generator repository — main packages

admingen/
├── cmd/
│   └── admingen/main.go
├── internal/
│   ├── domain/
│   │   ├── spec/              # model contract
│   │   │   ├── project.go
│   │   │   ├── types.go
│   │   │   └── validation.go
│   │   ├── normalized/        # normalized model
│   │   │   ├── normalizer.go
│   │   │   ├── types.go
│   │   │   └── projection.go
│   │   └── generation/        # artifacts and ownership
│   │       ├── planner.go
│   │       ├── plan.go
│   │       └── migration_inventory.go
│   ├── app/                  # application use cases
│   │   ├── project/service.go
│   │   ├── plan/service.go
│   │   ├── generate/service.go
│   │   └── rollback/service.go
│   ├── adapters/             # CLI and HTTP
│   │   ├── cli/runner.go
│   │   └── http/server.go
│   └── infrastructure/
│       ├── manifest/         # model storage
│       │   ├── store.go
│       │   └── workflow.go
│       ├── templates/        # rendering
│       │   ├── renderer.go
│       │   └── registry.go
│       └── fs/               # filesystem
│           ├── osfs.go
│           └── retirement.go
├── templates/                # template sources
│   ├── backend/
│   │   ├── app_service.go.tmpl
│   │   └── custom_hooks.go.tmpl
│   ├── admin/
│   │   ├── feature_form.tsx.tmpl
│   │   └── feature_custom_ui_extension.tsx.tmpl
│   ├── api/entity.yaml.tmpl
│   ├── db/schema_migration.sql.tmpl
│   └── project/
└── ui/admin/                 # generator interface
    └── src/
        ├── app/router.tsx
        ├── features/
        │   ├── entities/
        │   ├── generation/
        │   └── project/
        └── shared/

Domain defines model rules; app performs project operations. Filesystem access, HTTP and other input/output live in outer packages. Generator UI and CLI use the same use cases and model, so choosing an interface does not change generation rules.

Model contract

internal/domain/spec/ defines valid manifest content: entities, fields, relationships and project capabilities. Generator UI, CLI and generation rely on this contract, keeping all project interfaces on one description.

internal/domain/generation/planner.go defines file inventory, paths and update strategies. templates/backend/, templates/admin/ and templates/project/ contain template text. Model rules can evolve separately from emitted code. Fix shared generation here instead of repeating manual fixes in every application.

Normalized model

internal/domain/normalized/ resolves names, types and relationships into a consistent internal representation. Templates receive prepared data instead of parsing original settings again for every file.

File plan and update rules

internal/domain/generation/ identifies files to create, their locations and ownership. These rules tell the generator what to update, what to preserve and when to report a manual-edit conflict.

Application use cases

internal/app/ performs project operations: model editing, planning, generation preview and application. It uses storage and rendering interfaces; concrete reading and writing implementations are wired from outside.

UI HTTP and CLI commands

internal/adapters/ receives Generator UI HTTP requests and terminal commands and converts them into use-case arguments. Both interfaces share the same project rules.

Model storage

internal/infrastructure/manifest/ reads and saves the project manifest. It manages the document on disk; generating Go and React code is a separate operation.

Template rendering

internal/infrastructure/templates/ feeds prepared data into templates to obtain future file contents. It contains the rendering mechanism; template text lives separately in the root templates/ directory.

Filesystem access

internal/infrastructure/fs/ implements file reads and writes. Application use cases use these operations without mixing disk details with model rules or template text.

Template sources

templates/ contains Go, React, configuration and other file templates. Change the relevant template to change standard generation. Generate can then deliver the change without repeating it manually in each project.

Generator interface

ui/admin/ contains Generator UI: the model editor, project settings, Generate and History. Application developers work here. The admin for managing application data is generated separately from templates.

Practical guides