move fast and break things
I feels like Project structure is way more important than writing the clean code.. or may be you are mistaken project structure with clean code.. cuz actually it is about regulatory compliance, audit trails, and systems that never go down during market hours.
Over years of building stock portfolio management systems and fintech platforms, I’ve seen every architecture pattern succeed brilliantly and fail catastrophically, and the difference is not that much..
Okay, let’s fuckin analyze from my learning — structuring 50+ .NET projects in an industry.
The title for today’s article is —
“move fast and break things”
🔺Why Generic Architecture Fails
Reason is simple — these all .NET architecture advices comes from **e-commerce or content management **and Financial software has constraints that break conventional wisdom:
— Here is the thing
**Regulatory Compliance — **Every trade execution must be auditable for 7+ years. Your “clean” domain layer needs to track who changed what, when, and why.
**Market Data Integrity — **Stock prices update 1000+ times per second. Your event sourcing pattern needs nanosecond precision, not just “eventual consistency.”
**Multi-Currency Complexity — **Portfolio calculations involve 180+ currencies with real-time FX rates. Your decimal precision choices affect millions in valuation.
**Trading Hours Constraints — **Markets close, but settlement happens 24/7. Your architecture must handle both real-time trading and overnight batch processing.
**Fail-Safe Requirements — **When a $10M trade hangs, you need circuit breakers, manual overrides, and instant rollback capability.
and because of these all your —
textbook architecture patterns often don’t survive contact with financial reality
🔺What We Tried and What Survived
🔹Phase 1 (2014–2016): The Monolith That Almost Worked
TradingPlatform.sln
├── TradingPlatform.Web/ // MVC controllers and views
├── TradingPlatform.Business/ // All business logic
├── TradingPlatform.Data/ // Entity Framework + SQL
└── TradingPlatform.Tests/ // Unit tests
Worked —
- Fast development for MVP
- Simple deployment pipeline
- Easy debugging across components
- Single database maintained consistency
Broke Us —
- **Scaling — **Market data updates locked the entire application
- **Testing — **Mock market data for unit tests was impossible
- **Deployment — **Any update could break critical trading functions
- **Team conflicts — **8 developers stepping on each other’s code
During a volatile trading day, a simple UI update deployment caused a 15-minute trading halt
🔹Phase 2 (2017–2019): Clean Architecture with DDD
Portfolio.Core.sln
├── src/
│ ├── Portfolio.Domain/ // Entities, Value Objects
│ │ ├── Entities/
│ │ │ ├── Portfolio.cs
│ │ │ ├── Position.cs
│ │ │ └── Trade.cs
│ │ ├── ValueObjects/
│ │ │ ├── Money.cs // Multi-currency handling
│ │ │ ├── SecurityId.cs
│ │ │ └── MarketPrice.cs
│ │ └── DomainEvents/
│ │ ├── TradeExecutedEvent.cs
│ │ └── PositionRevaluedEvent.cs
│ ├── Portfolio.Application/ //CQRS
│ │ ├── Commands/
│ │ │ ├── ExecuteTrade/
│ │ │ └── RebalancePortfolio/
│ │ ├── Queries/
│ │ │ ├── GetPortfolioValue/
│ │ │ └── GetRiskMetrics/
│ │ └── EventHandlers/
│ ├── Portfolio.Infrastructure/ // External dependencies
│ │ ├── MarketData/
│ │ ├── Persistence/
│ │ ├── TradingGateways/
│ │ └── RiskCalculations/
│ └── Portfolio.API/ // Web API controllers
└── tests/
├── Portfolio.Domain.Tests/
├── Portfolio.Application.Tests/
└── Portfolio.Integration.Tests/
Solved —
- Domain complexity
- **Testing — **Could unit test trading logic without databases
- Clear audit trail through domain events
- Clear boundaries reduced merge conflicts
Learned —
- **Over-abstraction because of **4 layers for simple CRUD operations was overkill
- **Event sourcing complexity causing **Rebuilding portfolio state slow
- Clean Architecture added 15% latency overhead
- Split data across multiple contexts caused consistency issues
Separating business logic from infrastructure helped Clean Architecture with financial domain modeling.
🔹Phase 3 (2019–2021): Vertical Slice + Event-Driven Architecture
TradingSystem.sln
├── src/
│ ├── TradingSystem.SharedKernel/ // Common financial types
│ │ ├── Money.cs
│ │ ├── SecurityId.cs
│ │ └── AuditableEntity.cs
│ ├── Features/
│ │ ├── TradeExecution/ // Everything for trade execution
│ │ │ ├── ExecuteTrade.cs // Command + Handler + Validation
│ │ │ ├── TradeExecutionService.cs // Orchestration
│ │ │ ├── FIXGateway.cs // External integration
│ │ │ ├── TradeRepository.cs // Data access
│ │ │ ├── TradeExecution.sql // Database scripts
│ │ │ └── TradeExecutionTests.cs // Feature tests
│ │ ├── PortfolioValuation/
│ │ │ ├── CalculateValue.cs
│ │ │ ├── MarketDataService.cs
│ │ │ ├── ValuationEngine.cs
│ │ │ └── ValuationTests.cs
│ │ ├── RiskAnalysis/
│ │ │ ├── CalculateVaR.cs
│ │ │ ├── MonteCarloEngine.cs
│ │ │ └── RiskRepository.cs
│ │ └── Reporting/
│ │ ├── GeneratePerformanceReport.cs
│ │ ├── ReportingQueries.cs
│ │ └── PDFGenerator.cs
│ ├── Infrastructure/ // Shared infrastructure
│ │ ├── EventBus/ // Service bus integration
│ │ ├── Caching/ // Redis for market data
│ │ └── Persistence/ // Shared DbContext
│ └── API/ // Thin API layer
│ ├── Controllers/
│ │ ├── TradingController.cs
│ │ ├── PortfolioController.cs
│ │ └── ReportsController.cs
│ └── SignalR/ // Real-time updates
│ └── MarketDataHub.cs
MElODIES —
- New trading features took days, not weeks
- Each feature team owned their complete stack
- Feature tests covered happy path to database
- All related code was in one place
- And it eliminated unnecessary abstractions
NOISE —
- **Code duplication — **Shared kernel for common financial types
- Middleware for audit logging, authorization
- **Database consistency — **Event-driven eventual consistency patterns
🔹Phase 4 (2021–2024): Modular Monolith with Event Sourcing
We will talk about this through emails. Drop in comment
Recommendations for New Financial Projects (2024+)
Start Simple, Scale Smart
Begin with modular monolith — Microservices later if needed
Vertical slices for features — Clean Architecture for complex domains only
Event source critical operations — Regular persistence for everything else
Read models for reporting — Direct queries for simple data access
Might be this can work —
FinancialApp.sln
├── src/
│ ├── Modules/
│ │ ├── [BusinessModule]/
│ │ │ ├── Features/ // Vertical slices
│ │ │ ├── Domain/ // Complex business logic only
│ │ │ ├── Events/ // Critical operations only
│ │ │ └── Infrastructure/ // Module-specific dependencies
│ ├── SharedKernel/ // Financial primitives
│ ├── Infrastructure/ // Cross-cutting concerns
│ └── API/ // Thin API layer
see don’t affraid to start.. I know a guy who just built the fuckin live Stock price API with proper stock portfolio management alone..
💡The most successful financial platforms combine multiple patterns strategically rather than applying one pattern everywhere.,,
*Good Bye *🖤