How durundur/electro-app works
Major Components
a. Backend API:
• Two similar backend codebases are present (“electro.api.rest.new” and “electro.api.rest”) that implement the web API. These expose endpoints for key business functionality like authentication (login, register, refresh token), product catalog operations, cart management, orders, opinions, and product hierarchy.
• The backend is implemented in layered architecture:
– Application Layer: Contains “Features” such as Auth, Cart, Order, ProductCatalog, ProductHierarchy, and shared functionality. This layer handles commands, queries, mapping, handlers, and service orchestration.
– Domain Layer: Contains rich domain models (aggregates like CartAggregate, OrderAggregate, ProductCatalogAggregate, etc.), domain exceptions, repositories interfaces, and value objects.
– Infrastructure Layer: Provides ORM configurations (Entity Framework mappings, migrations), repository implementations, external services (identity, token, user context), and database context for Postgresql.
– Web API Layer: Includes controllers, middleware (for exception handling, authentication), DTO mappings, and API-specific configurations.
b. Database:
• Postgresql is used as a persistence store. The data model uses Entity Framework’s migration files to manage schema evolution.
c. Frontend Clients:
• The Vue3/Nuxt3 “electro.client” project is the primary storefront client based on the README. It covers pages for account management, shopping cart, checkout flows, product details, search, and admin panels.
• The “electro.client.react” project (using Next.js and React) adds another flavor of the client interface – possibly for a different user role or an alternative approach.
d. Additional/Supporting Services:
• “files.api.rest” appears to handle file operations (uploading, serving images, etc.) which might be integrated with the main API.
• There are shared API contracts, DTO mappings, and libraries (like the “nswag” generated stuff) that define the communication protocols between the frontend and backend.
Component Interactions
– The API controllers (in both “electro.api.rest.new” and “electro.api.rest”) forward requests into the application layer where business logic is processed.
– The Application layer interacts with the Domain layer for business rules and with the Infrastructure layer to manage persistence, identity, and external services.
– The Infrastructure layer then communicates with the Postgresql database (also shown as a distinct component) and with any external identity providers or file storage systems.
– In addition, the “files.api.rest” service should be depicted as a standalone or auxiliary service that the frontend or backend may call when handling file uploads/downloads.
Architectural Patterns and Design Principles
– Emphasize the layered architecture / Domain-Driven Design (DDD) pattern with clear separation between domain, application, and infrastructure.
– Note the usage of patterns like CQRS (Command/Query separation is visible in the “Features” by splitting commands, queries, handlers, and results).
– Mark the common structures like repositories (interfaces defined in Domain and implementations in Infrastructure) and identity/exception handling services.
– On the frontend side, the separation between admin and shop (user-facing) flows is clearly distinguished by folder structures (e.g., “(admin)” vs. “(shop)” in Nuxt).
Relevant Technology and Tools
– Backend: .NET 8, Entity Framework 8 for ORM, Postgresql as the database.
– Frontend: Vue3 with Nuxt3 for the Vue-based application and React with Next.js in the alternative client app.
– External tools: Docker (Dockerfiles in several projects), migration tools, and third-party libraries for state management (Redux in React, Vue/Nuxt store), authentication flows, etc.