# LOMA-PORTAL

> AI-first enterprise portal generated from the `enterprise-genesis` meta-template (Loma Group).

This repository is the **enterprise-genesis** template, currently being bootstrapped through phases 0–9 defined in [`GENESIS.md`](GENESIS.md). The sample materialization is **LOMA-PORTAL**; replace `project.config.json` and run `_init.ps1` to spawn a new product.

> ⚠️ **Known issue:** `apps/web-next` production build (`pnpm build`) has a known upstream Next.js framework bug in legacy error-page export. Development mode (`pnpm dev`) works fully; the primary Angular frontend is unaffected. See [`docs/known-issues/web-next-prod-build.md`](docs/known-issues/web-next-prod-build.md).

## Quick start (after Phase 9 completes)

```bash
# 1. Clone and configure
git clone <repo-url> my-new-project
cd my-new-project
# edit project.config.json with your identity

# 2. Initialize (Windows / PowerShell 5+)
./_init.ps1 -Config ./project.config.json

# 2. Initialize (macOS / Linux)
./_init.sh --config ./project.config.json

# 3. Start local services
docker compose up -d

# 4. Develop
pnpm dev
```

Open [http://localhost:4200](http://localhost:4200) (Angular) or [http://localhost:3000](http://localhost:3000) (Next.js).

## Project structure

See [`CLAUDE.md`](CLAUDE.md) §3 for the full folder map. High-level:

| Folder                 | Contents                                                  |
| ---------------------- | --------------------------------------------------------- |
| `apps/`                | Deployable apps (Angular, Next.js, NestJS, worker, admin) |
| `dotnet/`              | Primary .NET 9 Clean Architecture solution                |
| `packages/`            | Shared TypeScript libraries                               |
| `enterprise-modules/`  | Reusable business modules                                 |
| `prisma/`, `database/` | Schema (Postgres) + SQL Server mirror                     |
| `platform/`            | Docker, K8s, observability, secrets templates             |
| `presets/`             | Stack / business / theme presets used by `_init.ps1`      |
| `.claude/`             | Claude Code workspace (settings, hooks, commands, agents) |
| `.mcp/`                | Model Context Protocol configs                            |
| `docs/`                | Human docs (onboarding, ADRs, runbooks, compliance)       |
| `knowledge/`           | AI knowledge base                                         |
| `tools/`               | Validators, generators, codemods                          |

## Common commands

```bash
pnpm dev                # run all apps in parallel
pnpm build              # build everything
pnpm test               # unit tests
pnpm test:e2e           # Playwright E2E
pnpm lint               # eslint
pnpm typecheck          # tsc --noEmit on every workspace
pnpm format             # prettier --write
pnpm validate           # format + repo-map + architecture + deps

pnpm db:migrate         # run migrations (after Phase 5)
pnpm db:seed            # seed data (after Phase 5)
pnpm db:studio          # open Prisma Studio

docker compose up -d    # start Postgres + Redis + SQL Server
docker compose down     # stop services
```

## Documentation

- [`GENESIS.md`](GENESIS.md) — the master prompt that generated this template
- [`GENESIS-PLAN.md`](GENESIS-PLAN.md) — resolved config + per-phase plan
- [`RUNBOOK.md`](RUNBOOK.md) — how to (re)run the bootstrap with Claude Code
- [`CLAUDE.md`](CLAUDE.md) — repo memory for AI agents (and humans skimming the architecture)
- [`AGENTS.md`](AGENTS.md) — sub-agent roster
- [`CONTRIBUTING.md`](CONTRIBUTING.md) — branching, commits, PR process
- [`SECURITY.md`](SECURITY.md) — vulnerability reporting
- `docs/onboarding/` — Day-1 onboarding (English + Thai) — added in Phase 9

## License

Internal — proprietary. See [`LICENSE`](LICENSE).
