How murillofilho86/customerregister works
Project Type and Purpose
• This is a full-stack customer registration web application:
• Frontend: Angular 16 SPA (“customer-app” directory).
• Backend: .NET 7 microservice (“Customer-Api” solution) following a layered (Onion/Clean) architecture.
• Data store: SQL Server.
• Optional: Docker containerization, Brasil API integration for address lookup.
High-Level File Structure Analysis
• Top-level directories:
• Customer-Api: the .NET solution, split into projects:
– CustomerMicroService.Domain: domain entities & repository interfaces.
– CustomerMicroService.Core: shared base classes, messages, results, utilities.
– CustomerMicroService.Data: EF Core DbContext, mappings, repository implementations, external API service.
– CustomerMicroService.Application: application layer—CQRS commands/queries, handlers, DTOs, AutoMapper profiles.
– CustomerMicroService.API: ASP.NET Core project—controllers, configuration, DI, FluentValidation, program entry.
• customer-app: Angular client—module structure (core services, pages, shared components), environment config, assets.
• Key architectural patterns:
• Onion/Clean layers in backend.
• CQRS in Application layer (Commands vs. Queries).
• Repository pattern (ICustomerRepository).
• AutoMapper for domain⇄viewmodel mapping.
• Dependency injection and configuration via ApiConfig, DependenceInjectionConfig.
• External integration: BrasilApiService.
README Insights
• Describes tech stack: Angular CLI, Node.js, .NET 7, SQL Server, Docker.
• Setup instructions: database scripts creating Customer & Address tables with a FK.
• Run instructions: start .NET service, configure Angular’s environment.ts to match backend port, run ng serve.
a. Main Components
1. Angular Client (Browser)
2. ASP.NET Core Web API (CustomerMicroService.API)
3. Application Layer (CQRS handlers, DTOs)
4. Domain Layer (Entities, business rules)
5. Data Layer
– EF Core DbContext & Mappings
– Repository Implementations
– BrasilApiService (external HTTP service)
6. SQL Server Database
7. (Optional) Docker Host / Docker Compose network
b. Relationships & Data Flow
1. Browser ⇄ HTTP ↔ CustomerController (API Layer)
2. Controller → Injected Application Services (ICommandHandler, IQuery)
3. Handlers → Domain Entities & Repository Interfaces
4. Repository Implementations → EF Core → SQL Server
5. Data Layer → HTTP Calls → BrasilApiService → External Address API
6. DI Container wires all layers at startup (DependenceInjectionConfig)
c. Architectural Patterns/Design Principles
• Layered/Onion architecture: controllers depend on application layer → domain → data.
• CQRS separation: Commands vs. Queries with distinct handlers.
• Repository abstraction for data persistence.
• AutoMapper decouples domain from view models.
• FluentValidation for request validation.
d. Technologies & Frameworks
• Frontend: Angular 16, TypeScript, RxJS, Angular CLI
• Backend: .NET 7, ASP.NET Core Web API, Entity Framework Core, AutoMapper, FluentValidation, Dependency Injection
• Database: SQL Server
• External: BrasilApiService via HttpClient
• Deployment: Dockerfile, docker-compose (optional)
• Blue rectangles for frontend (Angular modules/components)
• Green for API and application services
• Yellow for domain entities & business logic
• Orange for data/infrastructure (EF Core, repositories, external API)
Essential Details to Capture
• Controller endpoints and their routing (e.g., GET /api/customers, POST /api/customers).
• CQRS command vs. query handlers.
• Entity relationships (Customer ⇄ Address via AddressId).
• BrasilApiService as an external module invoked during address validation/lookup.
• DI configuration class injecting IRepository, IBrasilApiService, AutoMapper profiles, FluentValidation rules.
• Database schema primary keys, FKs, row version for concurrency.