# GENESIS Execution Plan — Resolved from `project.config.json`

> Generated by Phase 0 (Pre-flight) of `GENESIS.md`. This file captures the resolved configuration and the per-phase plan that the bootstrap will follow. Do not edit by hand — re-run Phase 0 if the config changes.

---

## 1. Resolved Project Identity

| Key                    | Value                              |
| ---------------------- | ---------------------------------- |
| `projectName`          | `LOMA-PORTAL`                      |
| `projectSlug`          | `loma-portal`                      |
| `projectNamespace`     | `Loma.Portal`                      |
| `projectDbName`        | `loma_portal`                      |
| `companyName`          | `Loma Group`                       |
| Template repo target   | `enterprise-genesis`               |
| Sample materialization | `LOMA-PORTAL` (proof-of-life only) |

## 2. Resolved Presets (`extends`)

| Slot      | Selected preset      | Materialization in Phase 2                  |
| --------- | -------------------- | ------------------------------------------- |
| Stack FE  | `angular-enterprise` | Full preset materialized                    |
| Stack BE  | `dotnet-enterprise`  | Full preset materialized                    |
| Business  | `portal-platform`    | Full preset materialized (1 selected)       |
| Theme     | `premium-theme`      | Full tokens + theme overlay materialized    |
| Reference | `nextjs-enterprise`  | Generated as reference (secondary frontend) |
| Reference | `nestjs-enterprise`  | Generated as reference (secondary backend)  |
| Skeleton  | `crm-platform`       | README stub only                            |
| Skeleton  | `ecommerce-platform` | README stub only                            |
| Skeleton  | `pdpa-platform`      | README stub only                            |
| Skeleton  | `saas-platform`      | README stub only                            |
| Skeleton  | `fintech-theme`      | README stub only                            |
| Skeleton  | `enterprise-theme`   | README stub only                            |
| Skeleton  | `glass-theme`        | README stub only                            |

## 3. Resolved Stack

| Layer      | Primary                                                  | Secondary             |
| ---------- | -------------------------------------------------------- | --------------------- |
| Frontend   | Angular 19 (Signals)                                     | Next.js 15 App Router |
| Backend    | .NET 9 + ASP.NET Core                                    | NestJS 11             |
| DB engine  | PostgreSQL 16+ (Prisma)                                  | SQL Server 2022 (EF)  |
| Cache      | Redis 7+                                                 | —                     |
| Realtime   | SignalR + WebSocket                                      | —                     |
| Queue      | Hangfire (.NET) + BullMQ (Node)                          | —                     |
| Storage    | S3-compatible                                            | —                     |
| Email      | SMTP                                                     | —                     |
| Push       | FCM                                                      | —                     |
| i18n       | English + Thai                                           | —                     |
| Auth       | JWT + Refresh, RBAC, single-tenant, local provider       | —                     |
| UI         | Tailwind + Angular Material, premium theme, dark, PWA    | —                     |
| Deployment | Docker + Kubernetes                                      | —                     |
| CI         | GitLab CI (primary) + GitHub Actions parallel preset     | —                     |
| AI         | Claude Opus, strict governance, on-commit memory refresh | —                     |
| Compliance | PDPA + GDPR + Audit trail                                | —                     |

## 4. Phase 1–9 Plan

Each phase ends with `git commit -m "phase-<N>: <title> ✅"` and a §6 STOP CONDITIONS report.

### Phase 1 — Monorepo Foundation (must satisfy Day-1 criteria)

- pnpm workspace + Turborepo (`pnpm-workspace.yaml`, `turbo.json`, `package.json`)
- Base TS / ESLint / Prettier / EditorConfig configs in `packages/tsconfig` + `packages/eslint-config`
- `docker-compose.yml` for Postgres + Redis + SQL Server (health-checked)
- Root governance docs: `CLAUDE.md`, `AGENTS.md`, `.claude/settings.json`, `.claude/settings.local.json.example`
- `_init.ps1` + `_init.sh` (with `-DryRun` and `-SkipInstall`)
- `README.md`, `README.th.md`, `CONTRIBUTING.md`, `SECURITY.md`, `CODE_OF_CONDUCT.md`, `LICENSE`
- `.husky/` + `commitlint.config.js`
- `.vscode/` (extensions, settings, launch), `.editorconfig`, `.nvmrc`, `.tool-versions`, `.gitattributes`, `.gitignore`
- Validators: `pnpm validate` wired (lint + typecheck + repo-map + arch placeholder)

### Phase 2 — Preset System

- `presets/stacks/{angular-enterprise,nextjs-enterprise,nestjs-enterprise,dotnet-enterprise}/preset.json` + materialization manifests
- `presets/business/portal-platform/` full; `crm-platform`, `ecommerce-platform`, `pdpa-platform`, `saas-platform` README stubs
- `presets/themes/premium-theme/` full tokens; `fintech-theme`, `enterprise-theme`, `glass-theme` README stubs
- `presets/project.config.schema.json` for IDE validation

### Phase 3 — Frontend Foundations

- `apps/web-angular/` standalone + Signals + Tailwind + Material + Transloco (TH/EN)
- Core services, interceptors, guards, models, utilities, constants per §15
- Shared UI components from `premium-theme`
- `apps/web-next/` minimal scaffold (secondary frontend) with App Router + middleware + next-intl
- Working login screen + dashboard shell (stub backend bindings until Phase 4)

### Phase 4 — Backend Foundations

- `dotnet/` solution: `Api / Application / Domain / Infrastructure / Shared` (Clean Architecture, MediatR, JWT+Refresh, RBAC, Serilog → OTLP)
- `apps/api-nest/` reference: AuthModule / RbacModule / AuditModule / HealthModule / MetricsModule, pino logger, BullMQ baseline
- OpenAPI/Swagger live for both
- Seeded admin user works end-to-end against Postgres

### Phase 5 — Prisma + Database Foundations

- `prisma/schema.prisma`: `User`, `Role`, `Permission`, `RoleOnUser`, `RefreshToken`, `AuditLog` (+ soft delete + audit fields)
- `prisma/seed.ts` idempotent admin + roles
- `database/` SQL Server mirror: migrations, procedures, functions, views, seeds, anonymization scripts
- Migration runbook at `docs/runbooks/db-migrations.md`

### Phase 6 — Enterprise Modules

- `enterprise-modules/{auth,rbac,audit,notifications,file-storage}/` with thin DI-friendly wiring for both NestJS and .NET hosts
- Worker app (`apps/worker-nest/`) consuming BullMQ for queued notifications + audit shipping
- Wire modules into both API hosts; integration tests on the .NET host

### Phase 7 — AI Layer

- `.claude/commands/`, `agents/`, `skills/`, `hooks/`, `blueprints/`, `context/`, `prompts/`, `orchestrators/` per §23
- `.mcp/` configs + `profiles/{local-dev,ci-review,production-readonly,designer}.json` + `policies/{permissions,security,safe-usage}.md`
- `tools/validators/` repository-map + dependency-map + module-boundaries + feature-ownership
- `knowledge/` seeded for `portal-platform`

### Phase 8 — DevOps, Testing, Observability, Security

- Multi-stage Dockerfiles per app under `platform/docker/`
- `docker-compose.yml` (dev) + `docker-compose.prod.yml`
- `platform/k8s/` Helm skeleton, `platform/nginx/` reverse proxy
- `.gitlab-ci.yml` + `.github/workflows/` parallel preset
- Vitest / Jest / xUnit / Playwright baseline + Testcontainers config
- `platform/observability/` OTel + Prometheus + Grafana dashboards (JSON) + Loki
- Security: headers middleware, rate limiting, gitleaks pre-commit, OWASP audit script
- PDPA/GDPR primitives in `docs/compliance/` + `database/scripts/anonymize/`

### Phase 9 — Documentation & Onboarding

- `docs/architecture/` C4 diagrams (mermaid)
- `docs/onboarding/README.md` (EN) + `README.th.md` (TH) — step-by-step ≤ 5 min
- `docs/runbooks/{deploy,rollback,disaster-recovery,incident,slo,db-migrations}.md`
- `docs/decisions/0000-template.md` + ADRs 0001–0010 seeded
- `docs/performance-budgets.md`, `docs/dod.md`, `docs/permissions.md`, `docs/environments.md`
- Final Day-1 smoke run; emit final §6 report and stop

## 5. Day-1 Acceptance Criteria (Definition of Done for Stage 1)

1. `pnpm install` completes without error
2. `docker compose up -d` brings Postgres + Redis + SQL Server to healthy
3. `pnpm dev` runs frontend + backend on documented ports
4. Claude Code loads `CLAUDE.md` with no warnings
5. `pnpm validate` (lint + typecheck + architecture + dep validators) passes
6. `pnpm test` passes seeded unit tests
7. Browser opens login screen, seeded admin signs in, dashboard shell renders
8. `docs/onboarding/README.md` + `README.th.md` exist and are accurate

## 6. Out-of-scope for this bootstrap

- Real production secrets (only `.env.example` files are generated)
- Vercel deployment preset (not in `deployment.targets`)
- SMS provider (`features.sms = null`)
- `mobile/` app code (placeholder directory + README only)
- Marketplace runtime (only `registry.json` schema + README in Phase 7)

## 7. Mode & Cadence

- Mode: **Mode 4 — Checkpoint Auto-Commit** per `RUNBOOK.md`
- After every phase: validate → commit → emit §6 STOP CONDITIONS → ask `Proceed to Phase <N+1>? (yes / no / pause / clear)`
- Do not proceed without explicit confirmation
