docsPROJECT MEMORY FOR CHATGPT TECHNICAL
MenuList — Technical Architecture Memory Pack
Purpose: onboarding reference for implementation, architecture, routing, and operational constraints.
1) Core architecture
MenuList is a Next.js App Router codebase with multiple route groups:
src/app/(website)/
Public marketing/site pages for the product and legal/marketing surfaces.src/app/(main)/
Authenticated owner/admin product app.src/app/client/[[...slug]]/
Tenant/public customer-facing rendering for menus and official pages.src/app/(global-pages)/
Shared global app routes (signin/error/forgot-password, etc.).src/app/sites/canonica
Canonica-siloed product route area (do not blend with MenuList logic).
2) Domain + tenant routing
- Resolver/domain mapping:
src/lib/multiTenant/domainResolver.tssrc/constants/productDomains.tssrc/constants/urls.ts
- Request transformation / headers:
src/middleware.ts- tenant context headers like
x-tenant-subdomain,x-tenant-custom-domain
- Domain behavior is strict by product and should not be changed casually:
- MenuList website domain vs platform domain vs tenant/public slugs
- Canonica route separation preserved
3) Runtime layers
- Owner app: React + Ant Design, Redux Toolkit, shared hooks/DAL
- Public menu/OBP rendering: route-based tenant rendering with generated metadata/schema and discovery surfaces
- Mobile layer: dedicated mobile surfaces with Tailwind and shared business logic from desktop where possible; avoid desktop-only assumptions
4) Data layer and canonical collections
Primary data patterns in src/constants/database.ts map:
- Tenancy:
platformSummary,tenants,stores - Menu and truth:
projects,files,menuSnapshots,menuItemState,menuChangeLog,menuIntelligence - Public entities:
publicMenuDrafts,assets,campaigns,campaignExports - Decision/quality:
decisionBlocks - Discovery:
businessEntityIndex,applicationLogs,errorLogs - Public operations:
analytics,feedback,guestFeedback,reviews,reviewsState - Infrastructure and controls:
ops_config,systemHealth,systemAlerts,schedulerRunLogs,ownerControlUsage - Billing:
pricingPlans,subscriptions,subscription_payments,payment_transactions,topups - Auth/data support:
users,usersSchedules,AI_OPERATIONS_COLLECTIONScollections (aiCreditTransactions, etc.) - Chain/multi-location:
masterOperationalState,integrations,posDeliveryQueue,messagingOnboarding*,businessEntityIndex
Important: avoid changing collection contracts without audit against runtime + docs.
5) Security and validation constraints
- Maintain tenant isolation on every read/write path.
- Use auth/session guards as implemented for protected routes.
- Input validation and schema checks (runtime + boundary validation) should not be bypassed.
- Follow the project security rule files before touching auth/middleware/firestore-sensitive code.
- Public APIs must preserve safe public output behavior and avoid leaking sensitive content.
6) Cache correctness (high-risk area)
Any write path touching public truth (especially projects/stores) should consider cache invalidation for:
- menu/store public cache tags
- client/public cache helpers in
src/lib/cache/publicClientCache.tsandsrc/lib/cache/swrLocalStorageProvider.ts - invalidation behavior in client writes and server/API paths that render tenant pages
Skipping cache invalidation is a common regression source for stale public content.
7) Stack and freeze expectations
- Next.js App Router with
nextruntime (14.2.x policy in AGENTS + actualpackage.jsondependency: 14.2.30) - Firebase/Firestore/Auth (client: 11.7.3, admin: 12.2.0)
- NextAuth 4.24.3
- Redux Toolkit + Redux Persist
- TypeScript strict mode + Zod-style validations where applicable
- Sentry + instrumentation modules in production paths
No unnecessary framework/library swaps for “modernization” unless explicitly required.
8) Mandatory implementation guardrails
- Use existing reusable primitives before introducing new ones.
- Feature work with runtime impact should map to
src/config/features.ts. - Use
react-icons/lu(Lucide) only for iconography. - Keep mobile touch targets accessible (large, clear interactions).
- Run type and lint checks for meaningful edits:
npx tsc --noEmit --incremental falsenpm run lint
9) Critical file map (implementation start points)
AGENTS.md(execution contract)IDE_PROMPTS/MASTER-EXECUTION-PROMPT.mdIDE_PROMPTS/00. MASTER RULES & WORKFLOW.mdsrc/middleware.tssrc/lib/multiTenant/domainResolver.tssrc/constants/database.tssrc/lib/cache/publicClientCache.tsand related cache modulessrc/app/(website)/layout.tsx,src/app/(website)/page.tsxsrc/components/website/home/HomePage.tsxsrc/app/client/[[...slug]]/page.tsx__docs__/constitution/01-CORE-DOCTRINE.md__docs__/main-website/main-website_content.md__docs__/main-website/main-website_impl.md
10) Architecture mental model for future edits
For any touched behavior:
- Validate in docs/spec first
- Confirm owner/public parity impact
- Confirm tenant routing and header path behavior
- Validate cache and write consistency
- Run type/lint
- Recheck UI behavior in desktop + mobile + public browser route