How devoc-admin/devoc works
Project Type & Purpose
• This is a JavaScript/TypeScript monorepo (managed by pnpm & Turborepo) containing multiple related web applications and shared configuration.
• Apps:
• Main public website (apps/web) built with Next.js
• Customer-specific frontend (apps/customers/lasbordes/front) built with Next.js + embedded Payload CMS
• Customer preview app (apps/customers/lasbordes/preview) built with Vite
• Email templating service (apps/email) producing server‐side React email templates
• Shared tooling under tooling/typescript-config and root‐level scripts (biome, lefthook, turbo).
Key Architectural Components
• Monorepo Root
• pnpm-workspace (monorepo package manager)
• turbo.json (task orchestrator)
• tooling/ (shared TS configs, lint/format)
• App: web (Next.js)
• Static & dynamic pages under app/
• API routes for contact forms (send-email action)
• Integrates with Email service via internal HTTP call
• App: customers/lasbordes/front (Next.js + Payload)
• Public “front” pages under src/app/(frontend)
• Embedded headless CMS admin & API under src/app/(payload)
• GraphQL & REST endpoints for content storage
• Persists content to external database (e.g., MongoDB)
• App: customers/lasbordes/preview (Vite)
• Standalone preview of front components (static assets + React UI)
• App: email (Node + React Email)
• Email templates under emails/
• Export functions compile JSX → HTML
• Can be invoked by web or front apps or CI for notifications
• External Services
• Database (Payload CMS stores to DB)
• Email provider (e.g., SendGrid)
• CDN / Static hosting (for built frontends)
Interactions & Data Flows
• Developer tools (pnpm, turbo, biome, lefthook) orchestrate builds & code quality across all apps.
• Running turbo dev spawns each selected app’s dev server:
• Next.js dev server on port 3000 for web & front
• Vite dev server on port 5173 for preview
• web ↔ email: Next.js API route calls email service functions (HTTP or internal import).
• front ↔ payload API: Next.js Pages call local API routes (GraphQL/REST) to read/write CMS content → DB.
• CI/CD pipelines (not shown in files but typically present) build & deploy each app to its environment.
Architectural Patterns & Principles
• Monorepo Pattern: single repository for multiple apps & libs
• Shared Configuration: tooling/typescript-config, root scripts, and shared lib/utils.ts
• Modular Micro-Frontends: each customer frontend is isolated in its own folder
• Serverless/API-First: Next.js API routes & Vite serve dynamic API layers
• Headless CMS embedding: Payload CMS runs alongside front code
• Component-Based UI: React components and design-system patterns in each app
Diagramming Recommendations
• Use clear labels: e.g., “Next.js Web App”, “Payload CMS API”, “Email Template Service”
• From web API route → Email service → Email provider
• From front pages → Payload API → Database
• From devtools → apps (for build/run)
• Blue for public websites
• Green for customer-specific apps
• Orange for backend/email service
• Gray for tooling/config
• Rectangles for code modules/apps
• Clouds for external services (CDN, email provider)
Essential Details to Capture
• Monorepo orchestration (pnpm/turbo) at the top
• Isolation & independence of each app
• Embedded headless CMS pattern in the lasbordes front
• Serverless/API-first pattern of Next.js API routes
• Shared configuration in tooling and libs