How servicios-kdv-2025/sisescolar-25 works
Project type and purpose
• This is a full-stack monorepo managed with Turborepo.
• It contains three Next.js applications under /apps:
• admin – a Next.js frontend for administrators
• payload – a Next.js site integrated with Payload CMS for public content and headless CMS capabilities
• system – a Next.js multi-tenant “dashboard” app for schools, teachers, students
• Shared packages under /packages provide:
• UI components (ui)
• Convex backend functions & real-time DB (convex)
• ESLint and TypeScript config presets
High-level architectural components
• Monorepo root
• Turborepo orchestrates builds/dev tasks, remote caching via Vercel
• Shared configs: turbo.json, pnpm-workspace.yaml
• Apps layer (/apps)
• admin (uses Convex client + Payload API)
• payload (Next.js + Payload CMS + Convex client + Stripe endpoints)
• system (Next.js multi-tenant dashboard + Convex client)
• Backend services
• Convex – serverless functions and real-time DB; defined under /packages/convex/convex and used by all apps via generated API client
• Payload CMS – Node.js-based headless CMS for content storage; uses its own local/production database (e.g., prueba.db in development)
• Stripe – payment session and webhook endpoints implemented in the payload app
• Shared libraries (/packages)
• ui – shared React component library consumed by all Next.js apps
• eslint-config, typescript-config, zod-config – linting, typing, validation presets
Relationships and data flows
• Next.js frontends → call → Convex client → invokes → Convex serverless functions → operate on → Convex DB
• payload app → calls → Payload CMS internal API for content management → persists in its own DB
• payload app → integrates → Stripe API (via API routes) for payment sessions & webhooks
• admin & system apps → share → ui library and → call → Convex for application data
• All apps share code and configs via Turborepo caching and workspace package resolution
Key architectural patterns & design principles
• Monorepo with Turborepo for unified task running, caching, dependency graph awareness
• Micro-frontend style: three separate Next.js apps with their own concerns but shared libraries
• Serverless backend: Convex functions as business logic layer, abstracting database operations
• Headless CMS: Payload for managing content via a code-driven schema in /apps/payload/src/collections
• Multi-tenant routing: apps/system uses dynamic [subdomain] routing for per-school dashboards
Detail level
• Major component rather than individual pages/files
• Shared ui package linking into all three frontends
• Multi-tenant dynamic routing in the system app by labeling [subdomain]