How seba-wetzel/ecomunidad works
Main Components
• Frontend (UI/Pages):
– Represent the Next.js pages found under src/app, including different sections like the “(admin)” and “(principal)” folders.
– Include components folders (e.g., src/components and src/app/(admin)/registrate/components) which handle form elements and other UI parts.
– Note the use of Tailwind CSS, global stylesheets (src/app/globals.css), and custom UI components (under src/components/ui).
• API Layer and Server-Side Logic:
– Map the API routes under src/app/api covering different functionalities (cron jobs, registro, and validation endpoints for direction and email).
– Include the connection between the frontend pages/forms and the API endpoints (showing data flow for registration and validation).
• Domain & Business Logic:
– Emphasize the modular structure seen in src/modules/Cliente. Break this segment into:
a. Application Layer (e.g., createCliente.ts, getClientes.ts): Handles use-case orchestration.
b. Domain Layer (e.g., Cliente.ts, Direccion.ts): Represents the core business entities and interfaces.
c. Infrastructure Layer (e.g., SupabaseClienteRespository.ts): Handles external dependencies and data persistence.
– Also include shared utilities and adapters (under src/modules/shared) which contain the database configurations, migrations, and schemas.
• Database and Persistence:
– Set aside the shared database module (src/modules/shared/database) which includes migrations, schemas, and configurations.
– Highlight the use of Supabase (as seen in the Supabase configuration) and possibly Drizzle ORM integration from the drizzle.config.ts file.
• Third-Party Integrations:
– Identify integrations like the Google address validator (src/lib/google/addressValidator.ts) which implies external service communication.
Relationships and Data Flow
• How the API layer interacts with the domain/application layers to handle business logic.
• Connection between the infrastructure layer (e.g., Supabase/DB) and the domain components.
Architectural Patterns and Design Principles
• Layered Architecture: Clearly differentiate the presentation layer (React components/Next.js pages), API layer, domain/application logic, and infrastructure/database.
• Modular and Domain-Driven Design: Note the separation into modules (like the "Cliente" module) with clear boundaries between Application, Domain, and Infrastructure.
• Use of API Routes: Emphasize how Next.js API routes are utilized for server-side operations.
• Separation of Concerns: Showcase how configuration, business logic, UI, and data persistence are organized in distinct directories.
Relevant Technologies & Frameworks
• Next.js (with the new App Router structure)
• React (components and UI)
• Supabase (for database interaction as evident from SupabaseClienteRespository)
• Tailwind CSS (for styling)
• Possibly Drizzle ORM (as indicated by the drizzle.config.ts, migrations, and database scripts)
• Zod (for schema validation, seen in adapters like ClienteSchema.zod.ts)
• External APIs: Google address validation