How miguelvalenzuela6/camaras-page works
Project Type and Purpose
• This is a Turborepo monorepo hosting:
• A Next.js public + admin web application (apps/web)
• A Node.js background worker (apps/backend-worker)
• A shared API service (packages/api)
• Supporting packages: database (Prisma), auth, S3, UI library, TS configs, etc.
• Purpose: public booking pages, user authentication, admin dashboards for coupons, packages, schedules; background tasks; persistent storage.
File Structure (Top-level Clusters)
• apps/
– web (Next.js frontend)
– backend-worker (Node worker)
• packages/
– api (Express-style HTTP service with domain modules)
– auth (shared auth logic & client)
– database (Prisma schema & migrations)
– s3 (file storage helpers)
– ui (shared React component library)
– typescript-config (shared tsconfigs)
• Root configs: turbo.json, .env.local.example, lint/build scripts.
README Insights
• Standard Turborepo starter, uses pnpm/turbo for builds, caching, parallel execution.
• All packages and apps are TypeScript.
Main Components & Their Relationships
a. Frontend (apps/web)
• Runs in browser (or Vercel); uses Next.js SSR.
• Imports from @repo/ui for components.
• Calls the API service over HTTPS for data (coupons, bookings, profiles, sessions).
• Uses Shared auth logic for login/registration flows.
b. API service (packages/api)
• Hosts REST endpoints (coupons, orders, packages, users, sessions, photographers, profile, images).
• Uses Prisma client (packages/database) to interact with the relational database.
• Uses auth plugin for secure routes.
• Uses S3 helpers to upload/image retrieve URLs.
c. Background Worker (apps/backend-worker)
• Runs scheduled / queued tasks (e.g., cleanup, notifications).
• Imports the same domain services from packages/api modules to reuse business logic.
• Reads/writes to DB (Prisma) and S3.
d. Database
• PostgreSQL (or similar), managed via Prisma migrations in packages/database.
e. File Storage
• AWS S3 (or compatible) used via packages/s3.
f. Shared UI Library (packages/ui)
g. Authentication (packages/auth)
• Contains JWT/session logic, permission enums.
Architectural Patterns & Principles
• Monorepo with Turborepo for incremental builds & caching.
• Modular domain services in packages/api/src/modules (one module per business area).
• Shared libraries (UI, auth, database, S3) to avoid duplication.
• Clear separation: frontend, HTTP API, background processing, data storage.
Key Elements to Label
• Component names (apps/web, packages/api, prisma DB, S3 bucket)
• Data flows (e.g., “GET /coupons → returns JSON”)
• Dependencies (web imports ui, auth; api imports database, s3)
• Environments (Dev, Prod) and CI/CD (Turbo remote cache, pipeline).