How proyecto26/projectx works
Main Components
• Frontend:
• apps/web: The web application built using React (via Remix) that handles user interactions.
• libs/frontend/ui: The UI component library providing reusable components, themes, and Storybook configurations.
• Backend Services:
• apps/auth, apps/order, apps/product: Each dedicated to specific domains (authentication, order processing, and product catalog/inventory). They expose REST APIs and integrate business logic.
• Shared Backend Libraries:
• libs/backend/core: Contains shared business logic, utilities, and common NestJS modules.
• libs/backend/db: Manages database access with Prisma, schema definitions, and the Repository pattern.
• libs/backend/email: Handles email template generation (using MJML) and email sending logic.
• libs/backend/payment: Provides payment integration (e.g., Stripe) and related workflows.
• libs/backend/workflows: Integrates Temporal workflows and orchestration, handling long-running business processes.
• Domain Models and DTO Definitions:
• libs/models: Contains common data transfer objects (DTOs) and types ensuring consistency between services.
• Infrastructure Components:
• Temporal Server and UI: Orchestrates durable executions and coordinated workflows.
• Database Layer: PostgreSQL with PostGIS SQL schemas (initialized via docker-entrypoint scripts).
• Docker & Deployment: docker-compose file, Dockerfile, and deployment scripts, which define the containerization and orchestration of services.
Out Interactions and Relationships
• Frontend (apps/web) communicates with backend services (auth, order, product) through HTTP/REST API endpoints.
• Backend services share common functionalities (authentication, logging, configuration) via libs/backend/core.
• The Temporal orchestration layer (via libs/backend/workflows) interacts with backend services to manage long-lived business processes, handle asynchronous signals, and execute retries as necessary.
• The DB layer (libs/backend/db) is uniformly accessed by the backend services for data persistence.
• Payment workflows in libs/backend/payment manage integration with external payment providers (Stripe) and use webhooks to communicate results.
• Email notifications (via libs/backend/email) are triggered based on events from workflow progression or external inputs.
• The shared data models in libs/models ensure type safety and consistency across all layers.
Architectural Patterns and Principles
• Monorepo architecture managed via Nx, enabling code share, centralized configuration, and consistent tooling.
• Separation of Concerns: Distinct apps for different domains (auth, order, product, web) and libraries for shared business logic.
• Microservices-like design within the monorepo: Even if deployed together, each app is kept modularly separated.
• Workflow Orchestration: Temporal is used to manage long-running, distributed operations with durability and compensation.
• Domain Driven Design (DDD): Each domain (auth, order, product) has its domain models and business logic implemented via DTOs and service modules.
Additional Detailed Suggestions
• Present the overall monorepo as a container, with internal subdivisions for apps and libs.
• Adding a layer or annotation representing “Deployment & DevOps” indicating the Dockerfiles, docker-compose setup, and CI pipelines (as seen in the .github/workflows/ci.yml file).
• Use labels such as “Configuration Files” for global settings (nx.json, tsconfig.base.json) to indicate how consistency is maintained across the project.