Skip to content

Fork-ready platform hub

This section implements the platform refactoring master plan: clean multi-repo boundaries, contract-driven integration, reusable platform core, and IDE-friendly workflows.

English

DocumentPurpose
Naming for technical docs vs legalTechnical vs legal naming; links to the documentation style guide.
Master planFull program: summary, problems, architecture, phases, risks (sections 1–20).
Dependency inspection (IDE agents)Mandatory checklist before editing across repos — canonical copy lives in the operator AI documentation tree (docs/from-prego-monorepo/platform/dependency-inspection-for-ai.md) when that repository is cloned beside the monorepo.
Platform overviewOne-page system context and layer model.
Tenant & trust boundariesHeaders, internal signature, trust zones — canonical copy in the operator AI docs tree (docs/from-prego-monorepo/platform/tenant-trust-boundaries.md) when cloned beside this monorepo.
Entity ID standardIdentifier format ([prefix]_[nanoid]), prefix registry, collision handling, migration rules. Implementation package: @platform/id-utils (see monorepo packages/id-utils/README.md).
Repo responsibility matrixWhat each repository must / must not own.
How to add an APIOpenAPI → gateway → Worker ordering.
API gateway & BFF governanceGateway vs same-origin BFF vs presigned upload — hybrid rules for marketing web, admin web, and client web.
Fork checklistNew product from the platform: copy vs depend.
IDE guideSafe vs risky changes and where to add code (including gateway CORS and optional browser x-trace-id) — operator AI docs tree (docs/from-prego-monorepo/platform/ai-ide-guide.md) when cloned beside this monorepo.
SaaS ERP web app standardDraft v1.0 — Next.js, Zod, RHF, shared packages, Cloudflare deploy posture for marketing, admin, and client web apps.
Web app standardization planProgram plan and priorities; converges apps on the web standard.
Web app refactoring prompt (Cursor)Copy-paste prompts for IDE-assisted refactors aligned with the web standard.
Web app safe refactor statusBehavior-preserving audit snapshot, risk map, deferred work vs the web standard.
Web app refactor continuation planProgress summary and phased follow-up (Next alignment, contracts/forms, billing, deploy decisions).
Deploy convergence ADR (client-web)next-on-pages vs OpenNext — target, current posture, migration preconditions.
Marketing web — Cloudflare Pages hostingCanonical hosting for apps/marketing-web vs internal Starlight docs (prego-devdoc); CI upload pointers.
Phase 2 — connector slotsThin Zod + control-plane D1 0029 + operator AI worker connector context; optional CACHE erp_cred: (ERP_CREDENTIAL_KV_PREFIX) + ref — see operator AI repository docs/deployment.md when automating credential material (no big-bang).
Repository README indexRole-based index of gateway, Workers, ERP app, infra, and docs repositories (swap GITHUB_ORG when forking).
Browser storage minimizationWhitelist or blacklist per app, control-plane D1 target model, admin and marketing web contracts, client web auth phases, ERP boundaries, operator auth, optional consent audit.
Environment variable neutralization planPlanning — Migration strategy for PREGO_* environment variables to brand-neutral names; phased rollout, cookie rename order, risk mitigation. Public HTTP headers (X-Prego-*) are out of scope for this phase.
  • Trial marketing web → admin signup: Trial email and admin handoff — control-plane INTERNAL_API_KEY / optional TRIAL_FORCE_BUSINESS_EMAILS; admin Worker PREGO_CONTROL_PLANE_INTERNAL_API_KEY (same value as control-plane internal key). Manual approval (email OTP + details): marketing web /trial/manual-approval/verify; gateway POST /api/trial/manual-approval/*; control-plane D1 0027·0028 and Resend / OTP_PEPPER as in the control-plane repository README.md (same runbook).
  • Gateway operators (CORS / Pages origins): gateway repository docs/runbook/README.md (index) and docs/runbook/ALLOWED_ORIGINS, browser preflight triage, optional x-trace-id in CORS allowedHeaders (see tenant & trust boundaries in the operator AI docs tree when cloned beside this monorepo).
  • Contracts: API contracts (OpenAPI source of truth lives in the gateway repository; this section links and explains versioning).
  • Gateway OpenAPI fragments: Merge order from config/oas-manifest.json. Older planning docs may name superseded fragments — see gateway repository docs/planning/oas-layout-history.md · How to add an API section 1.
  • Domain: ERP / Frappe.
  • IDE / agents: Monorepo root AGENTS.md and .cursor/rules/prego-multi-repo-platform.mdc point agents at this section. Sibling repositories use shorter .cursor/rules/prego-platform-docs-pointer.mdc style stubs.
  • Monorepo integration verify: root AGENTS.mdpnpm run build:verify — shared packages, verify:next-dev-scripts, build:docs, etc. (does not build marketing / admin / client web production bundles). Internal docs/ Starlight pages are MDX — see docs/README.md beside this app. If astro build fails with missing chunks under docs/dist (for example renderers.mjs), run pnpm run build:docs:clean from the monorepo root (see AGENTS.md). Monorepo verification details: operator AI docs tree ai-ide-guide.md.
  • GitHub Actions: monorepo .github/workflows/README.md — index of workflows (admin-web-verify, build-client-web, next-dev-scripts, …).

한국어

포크 가능한 플랫폼 문서의 시작점입니다. 기술 문서 표기Naming for technical docs vs legalDocumentation style guide 를 먼저 본다. 위 영어 표의 링크에서 마스터 플랜, 테넌트·신뢰 경계(운영 AI 문서 트리의 tenant-trust-boundaries.md), 엔티티 ID 표준, 레포 책임, API 추가 절차, API 게이트웨이·BFF 거버넌스, SaaS ERP 웹 앱 표준, 표준화·리팩터링·배포 ADR 문서, 마케팅 웹 Pages 호스팅 결정, Phase 2 커넥터 슬롯(운영 AI 저장소의 배포·KV 문서와 함께 읽기), 브라우저 저장소 최소화, 환경 변수 중립화 계획 (기획 — PREGO_* → 중립 이름 이전 전략), 포크 체크리스트, 레포 README 색인을 순서대로 읽을 수 있다. 트라이얼 마케팅 웹 → 관리자 가입·수동 승인 경로는 Trial email and admin handoff 및 컨트롤 플레인 저장소 README.md 를 참고한다. 모노레포 통합 검증: 루트 AGENTS.mdpnpm run build:verify — 공유 패키지·build:docs 등. astro build 실패 시 루트에서 pnpm run build:docs:clean. 게이트웨이 CORS·ALLOWED_ORIGINS·x-trace-id 는 게이트웨이 저장소 docs/runbook/ 을 본다. OpenAPI 조각 이력: 게이트웨이 저장소 docs/planning/oas-layout-history.md · API 추가 방법 §1.

Help