Tip ExpenseTracker Backend | .NET Core โ€ข Clean Architecture โ€ข DDD โ€ข CQRS โ€ข Event Sourcing

aekoky

New member
Joined
Jun 14, 2025
Messages
2
Location
Casablanca , Morocco
Programming Experience
5-10
Sharing my backend solution for personal finance management, built with a microservices architecture for audit and expense tracking.
Designed for scalability, maintainability, and robust event-driven workflows.

๐—•๐—ฎ๐—ฐ๐—ธ๐—ฒ๐—ป๐—ฑ ๐—ง๐—ฒ๐—ฐ๐—ต ๐—›๐—ถ๐—ด๐—ต๐—น๐—ถ๐—ด๐—ต๐˜๐˜€:
โ€ข .๐—ก๐—˜๐—ง ๐—–๐—ผ๐—ฟ๐—ฒ โ€” High-performance, cross-platform framework
โ€ข ๐—–๐—น๐—ฒ๐—ฎ๐—ป ๐—”๐—ฟ๐—ฐ๐—ต๐—ถ๐˜๐—ฒ๐—ฐ๐˜๐˜‚๐—ฟ๐—ฒ & ๐——๐—ผ๐—บ๐—ฎ๐—ถ๐—ป-๐——๐—ฟ๐—ถ๐˜ƒ๐—ฒ๐—ป ๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป (๐——๐——๐——) โ€” Separation of concerns & business logic encapsulation
โ€ข ๐—–๐—ค๐—ฅ๐—ฆ (๐—–๐—ผ๐—บ๐—บ๐—ฎ๐—ป๐—ฑ ๐—ค๐˜‚๐—ฒ๐—ฟ๐˜† ๐—ฅ๐—ฒ๐˜€๐—ฝ๐—ผ๐—ป๐˜€๐—ถ๐—ฏ๐—ถ๐—น๐—ถ๐˜๐˜† ๐—ฆ๐—ฒ๐—ด๐—ฟ๐—ฒ๐—ด๐—ฎ๐˜๐—ถ๐—ผ๐—ป) โ€” Distinct read/write models for optimized data operations
โ€ข ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜ ๐—ฆ๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ถ๐—ป๐—ด โ€” Capturing state changes as event streams for auditability
โ€ข ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฐ๐—ฒ๐˜€ ๐—”๐—ฟ๐—ฐ๐—ต๐—ถ๐˜๐—ฒ๐—ฐ๐˜๐˜‚๐—ฟ๐—ฒ โ€” Separate Audit and Expense services for modularity and scalability
โ€ข ๐—ฃ๐—ผ๐˜€๐˜๐—ด๐—ฟ๐—ฒ๐—ฆ๐—ค๐—Ÿ โ€” Reliable relational database
โ€ข ๐—ฅ๐—ฒ๐—ฑ๐—ถ๐˜€ โ€” Fast caching layer
โ€ข ๐—ž๐—ผ๐—ป๐—ด ๐—”๐—ฃ๐—œ ๐—š๐—ฎ๐˜๐—ฒ๐˜„๐—ฎ๐˜† โ€” Managing API traffic and security
โ€ข ๐——๐—ผ๐—ฐ๐—ธ๐—ฒ๐—ฟ โ€” Containerized deployment for consistent environments

Explore the full architecture and code here ๐Ÿ‘‰ GitHub - aekoky/ExpenseTracker: ExpenseTracker is a modular, event-sourced .NET Core application designed to manage personal finances. It uses Clean Architecture, Domain-Driven Design (DDD), and Event Sourcing to deliver a scalable and maintainable system.
 
Perhaps I'm missing how your Audit and Expense services are Microservices. The point of a microservice is that everything with it is self-contained and it can be modified and updated independently of other code that is part of the application. But it looks like both of your microservices share common code between the two of them in the form of the various types in ExpenseTracker.Application.Common and ExpenseTracker.Domain.Account. So if you modify anything in that common code to try to do some kind of product enhancement or bug fix for one or the other feature, you will now have to also update the other service.

Yes it may not be a single monolithic application where both services are within the same web service/web app, but you still effectively have monolithic application due to the tight coupling between your services.

Anecdote: A team told us that they wanted to deploy their application into our IIS farm and the had 20 microservices. We told them, sure no problem. We noticed that whenever they deployed in the QA environment, they were often doing 15-20 webservice deployments for revision they had. Later when they moved to production, their sprint end deployment would touch all 20. Even their emergency changes for single bug hotfixes would touch all 20. I've got a feeling that they bought into the "microservices" buzzword without really understanding the intent of the design pattern.
 
Perhaps I'm missing how your Audit and Expense services are Microservices. The point of a microservice is that everything with it is self-contained and it can be modified and updated independently of other code that is part of the application. But it looks like both of your microservices share common code between the two of them in the form of the various types in ExpenseTracker.Application.Common and ExpenseTracker.Domain.Account. So if you modify anything in that common code to try to do some kind of product enhancement or bug fix for one or the other feature, you will now have to also update the other service.

Yes it may not be a single monolithic application where both services are within the same web service/web app, but you still effectively have monolithic application due to the tight coupling between your services.

Anecdote: A team told us that they wanted to deploy their application into our IIS farm and the had 20 microservices. We told them, sure no problem. We noticed that whenever they deployed in the QA environment, they were often doing 15-20 webservice deployments for revision they had. Later when they moved to production, their sprint end deployment would touch all 20. Even their emergency changes for single bug hotfixes would touch all 20. I've got a feeling that they bought into the "microservices" buzzword without really understanding the intent of the design pattern.

You're absolutely right โ€” this isn't true microservices architecture. Sharing code between services, like having a common ExpenseTracker.Domain project, goes against the core principles of microservices. It's a clear microservices smell that leads to tight coupling and defeats service autonomy.

That said, to clarify my vision: I'm implementing microservices using the CQRS pattern, where each responsibility is isolated. I have one service dedicated to the write side โ€” responsible for saving events and modifying state โ€” and a separate service for the read side, focused on querying data. This separation allows both services to grow, scale, and evolve independently.

Thanks to your feedback, I now realize the mistake of sharing domain logic across services. The correct approach is to have a shared contracts library containing only integration event DTOs. This allows services to communicate effectively without violating boundaries โ€” preserving autonomy and maintaining a clean architecture.
 
Back
Top Bottom