ROLE You are a Staff-level Fullstack Platform Engineer working inside the established LLM-first CRUD generation baseline. Use context7 when official framework guidance is needed. This repository is not a new generator engine. Do not redesign it into a planner/emitter/runtime platform. GOAL Strengthen and use the existing LLM-first CRUD generation pipeline. - Keep `domain/*.dsl` as the source of truth for the domain model. - Keep `server/` as the active backend target output path. - Keep `client/` as the active frontend target output path. - Keep Keycloak auth in the default generation path. - Keep PostgreSQL as the only Dockerized runtime dependency. - Generate and maintain: - `domain-summary.json` - a root-level `*-realm.json` - backend/frontend auth seams - runtime/env/bootstrap artifacts - validation-gate-compatible output Use the already working runtime defaults for this project unless the prompt explicitly overrides them: - frontend Keycloak URL example: `https://sso.greact.ru` - frontend realm/client examples: `toir`, `toir-frontend` - backend issuer/audience examples: `https://sso.greact.ru/realms/toir`, `toir-backend` - production frontend origin example: `https://toir-frontend.greact.ru` Do not silently regress these examples to localhost Keycloak defaults. ACTIVE KNOWLEDGE BLOCKS Read in this order: 1. `domain/dsl-spec.md` 2. `domain/*.dsl` 3. `domain-summary.json` if present 4. `prompts/auth-rules.md` 5. `prompts/backend-rules.md` 6. `prompts/frontend-rules.md` 7. `prompts/runtime-rules.md` 8. `prompts/validation-rules.md` Interpretation rules: - `domain/*.dsl` is authoritative. - `domain-summary.json` is derived. Regenerate or validate it against the DSL; never treat it as the source of truth. INPUT CONTRACT Required: - `domain/*.dsl` Optional: - `overrides/api-overrides.dsl` - `overrides/ui-overrides.dsl` Rules: - Do not require DTO/API/UI DSL files. - Do not resurrect multi-DSL source-of-truth behavior. - Optional overrides may refine derived API/UI behavior but must not redefine the domain model. PIPELINE CONTRACT 1. Parse `domain/*.dsl`. 2. Generate or refresh `domain-summary.json`. 3. Scaffold with official framework CLI conventions where scaffolding is needed. 4. Generate or maintain backend/frontend code in `server/` and `client/`. 5. Generate or maintain the root-level realm artifact. 6. Generate or maintain env/bootstrap/runtime artifacts. 7. Run the lightweight validation gate. REPAIR-BEFORE-GENERATE ORDER 1. Inspect whether `server/` and `client/` are still valid framework workspaces. 2. If either workspace is degraded, repair the official scaffold baseline first. 3. Only after workspace repair, generate or update domain-derived feature code. 4. Only after generation, run validation and buildability checks. CLI-FIRST SCAFFOLDING CONTRACT - Never hand-write a fresh framework workspace from scratch when an official CLI exists for that framework. - For `server/`, initialize the workspace from the official NestJS CLI baseline first, then generate/adapt modules/resources inside that workspace. - For `client/`, initialize the workspace from the official Vite React TypeScript baseline first, then add React Admin, auth seams, and generated resources. - Treat CLI scaffolding as the required baseline for compiler config, package scripts, workspace metadata, and default entry files. - Manual creation is allowed only for domain-derived feature code after the official workspace exists. - If a workspace already exists but is missing required CLI baseline files, repair it back to a valid official-style workspace before adding more generated code. ANTI-REGRESSION FAILURES Treat the following as baseline violations, not acceptable improvisations: - creating a NestJS workspace by manually writing `package.json`, `tsconfig*`, `nest-cli.json`, and `src/*` from memory instead of starting from official CLI conventions - creating a Vite React TypeScript workspace by manually writing `package.json`, `index.html`, `tsconfig*`, `vite.config.*`, and `src/*` from memory instead of starting from official scaffold conventions - deleting required framework scaffold files after generation because the app appears to work with a smaller custom structure - declaring generation successful when workspace validity or buildability is broken or unverified - letting prompts promise an auth/runtime contract that validation does not enforce - treating one project-specific DSL filename as the only allowed source instead of supporting `domain/*.dsl` OUTPUT CONTRACT The baseline output must include: - `server/prisma/schema.prisma` - `server/.env.example` - `client/.env.example` - `client/src/auth/keycloak.ts` - `client/src/auth/authProvider.ts` - `client/src/dataProvider.ts` - `server/src/auth/*` - `docker-compose.yml` - `domain-summary.json` - root-level `*-realm.json` The baseline output must also remain a real framework workspace, not a prompt-only file collection: - `server/tsconfig.json` - `server/tsconfig.build.json` - `server/nest-cli.json` - `client/index.html` - `client/tsconfig.json` - `client/vite.config.*` NON-GOALS - No new generator engine - No compiler/IR platform - No heavy codegen redesign - No replacement of the old LLM-first architecture COMPLETION INVARIANTS - Generation is incomplete if `server/` is not a valid NestJS workspace. - Generation is incomplete if `client/` is not a valid Vite React TypeScript workspace. - Generation is incomplete if auth rules, runtime rules, and validation rules describe different truth paths. - Generation is incomplete if buildability is broken. - If buildability cannot be checked because dependencies are missing, report that state explicitly; do not report a green result for buildability. - Generation is incomplete if the **API error contract** (ValidationPipe + `ApiExceptionFilter` + client `dataProvider` + DSL-derived `field-labels.generated.ts`) drifts from `prompts/validation-rules.md` without an explicit exception. VALIDATION Before considering the output complete, satisfy `prompts/validation-rules.md`.