A comprehensive manufacturing ERP solution built with .NET 10 and Clean Architecture principles, managing the complete lifecycle from sales and purchases to production planning, inventory control, and financial operations.
Architecture Grade: A (9.5/10) - Exceptional Clean Architecture implementation with complete service layer separation across all 51 controllers (completed December 2025). All business logic is now testable without HTTP context, with consistent error handling and full localization support. Key remaining areas for improvement: test coverage and authorization framework.
- .NET 10 - Web API framework
- Entity Framework Core - ORM with PostgreSQL provider
- PostgreSQL - Primary database
- JWT Bearer - Authentication
- Serilog - Structured logging
- Swashbuckle - OpenAPI/Swagger documentation
┌─────────────────────────────────────────────────────────────┐
│ API LAYER │
│ (Controllers - only inject service interfaces) │
│ (Middleware, Program.cs - wires implementations) │
│ ↓ │
│ (depends on service interfaces) │
└─────────────────────────┬───────────────────────────────────┘
│
┌──────────────▼─────────────────┐
│ APPLICATION.CONTRACTS │
│ (Service & Repository IFs, │
│ DTOs, Constants) │
│ ↑ ↑ │
└─────────┼────────────┼─────────┘
│ │
┌────────────┘ └────────────┐
│ │
│ implements implements│
│ │
┌───────▼───────────┐ ┌───────────▼────────┐
│ APPLICATION │ │ INFRASTRUCTURE │
│ (Services) │─────────────→│ (Repositories, │
│ Business Logic │ uses IUoW │ UnitOfWork, │
└───────┬───────────┘ │ EF Core) │
│ └───────────┬────────┘
│ │
└──────────────┬───────────────────────┘
↓
┌───────────────────────┐
│ DOMAIN │
│ (Entities, Core) │
│ NO Dependencies │
└───────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ VERIFACTU │
│ (External Tax Integration Service) │
│ Spanish AEAT Invoice Registry │
└─────────────────────────────────────────────────────────────┘
# Prerequisites: .NET 10 SDK, PostgreSQL 16+
# 1. Restore dependencies
dotnet restore
# 2. Update connection string in src/Api/appsettings.Development.json
# 3. Apply database migrations
dotnet ef database update --project src/Infrastructure/
# 4. Run the API
dotnet run --project src/Api/
# or use VS Code task: "watch"
# 5. Access Swagger UI
# Navigate to: https://localhost:5001/swagger- Architecture Layers - Deep dive into the 6 projects and their responsibilities
- Architectural Patterns - Repository, Service, GenericResponse, and Entity configuration patterns
- Request Flow - How HTTP requests flow through layers with sequence diagrams
- Domain Model - Business entities across Sales, Purchase, Production, and Warehouse
- Developer Guide - Setup, common tasks, and critical conventions
- How to Create Endpoints - Step-by-step guide for adding new API endpoints
- How to Refactor Controllers to Services - Moving business logic out of controllers
- Localization - Multilanguage support (Catalan, Spanish, English)
- External Integrations - Verifactu tax service and other external systems
- Architectural Debt Assessment - Critical improvements needed (tests, authorization)
src/
├── Domain/ # Pure business entities (no dependencies)
├── Application.Contracts/ # Interfaces, DTOs, constants (flat namespace)
├── Application/ # Business logic and services
├── Infrastructure/ # Data access with EF Core + PostgreSQL
├── Api/ # Controllers, middleware, startup
└── Verifactu/ # Spanish tax authority integration
- Domain is the core with zero external dependencies
- Application.Contracts defines all abstractions (interfaces, DTOs)
- Application implements business logic using contracts
- Infrastructure implements data access and external integrations
- Api orchestrates everything as the composition root
- Repository + Unit of Work - Data access abstraction
- Service Layer - Business logic completely separated from controllers (100% of controllers refactored)
- GenericResponse - Standardized error handling and results
- Primary Constructors - Modern C# 12 dependency injection
- Localization-First - All user-facing strings support multiple languages
Sales: Customer, Budget, SalesOrder, DeliveryNote, SalesInvoice
Purchase: Supplier, PurchaseOrder, Receipt, PurchaseInvoice
Production: WorkMaster, WorkOrder, ProductionPart, Workcenter
Warehouse: Stock, Location, StockMovement, Reference
- Use
StatusConstants- Never hardcode lifecycle/status names - Localize error messages - Inject
ILocalizationServicein all services - Return
GenericResponse- For all write operations that can fail - Primary constructors - Use modern C# 12 syntax for DI
- Async/await - All I/O operations must be asynchronous
- No logic in controllers - Business logic belongs in services (all 51 controllers now follow this pattern)
- Never inject
IUnitOfWorkin controllers - Use service layer interfaces only
# Create new migration
dotnet ef migrations add MigrationName --project src/Infrastructure/
# Apply migrations to database
dotnet ef database update --project src/Infrastructure/
# Rollback to previous migration
dotnet ef database update PreviousMigrationName --project src/Infrastructure/# Build image
docker build -t lilith-backend .
# Run with PostgreSQL connection
docker run -p 8080:80 \
-e ConnectionStrings__Default="Host=postgres;Database=lilith;..." \
lilith-backendBefore implementing new features:
- Read Developer Guide for conventions
- Check Architectural Debt Assessment for known issues
- Follow established patterns in Architectural Patterns
- Add localization keys for all user-facing messages
- Update relevant documentation
Internal project - All rights reserved.