Welcome to the team! This guide is designed to help you understand our project structure and how to build new features or even start a new project using our Feature-based Organization.
Our projects follow a Feature-based Organization. Instead of grouping code by technical layers (all controllers here, all services there), we group everything by Business Feature.
This structure focuses on a simple, direct flow:
Controller (API/Web) → Service (Domain Logic) → Database (EF Core)
The solution is divided into several projects:
-
Project.ApiThe RESTful API layer. Controllers here receive requests and call the corresponding Domain Service.
-
Project.DomainThe heart of the application. It contains all business logic organized by Features.
-
Project.FrontendThe frontend UI (ReactJS). Pages here interact with Domain Services or the API.
-
Project.SharedCommon utilities, constants, and the Result Pattern models used by everyone.
-
Project.DatabaseEntity Framework Core context, migrations, and database scripts.
Every business module (e.g., User Management, Orders) is a folder under Features/ in the Domain project.
Inside a feature folder (e.g., Features/Invoices), you will find:
Models/: Contains Request and Response DTOs specific to this feature.[FeatureName]Service.cs: The service class containing all methods for this feature (Create, Get, Update, Delete).
We don't return raw data or throw exceptions for business logic errors. Instead, we use a Result Pattern. Every service method should return a Result<T> or Result object.
public async Task<Result<InvoiceResponse>> CreateInvoiceAsync(InvoiceRequest request)
{
// 1. Logic
// 2. Database save with EF Core
// 3. Return Result.Success(data) or Result.Failure(error)
}Follow these steps to initialize a new project with our structure:
- Create a blank .NET Solution.
- Add the following:
- ASP.NET Core Web API (
.Api) - Class Library (
.Domainand.Shared) - Blazor Web App (
.WebApp)
- ASP.NET Core Web API (
.Domainreferences.Sharedand.Database..Apiand.WebAppreference.Domain.
- In the
.Domainproject, create aFeatures/folder. - Inside
Features/, create your feature folder (e.g.,ProductCatalog/). - Inside that, create a
Models/folder.
- Create your Service class (e.g.,
ProductService.cs) directly inside the feature folder. - Use Entity Framework Core directly in the service to perform CRUD operations.
- Use the Result Pattern for all return types.
-
One Feature, One Folder
Everything related to a feature should stay inside its folder.
-
Service Responsibility
Keep your business logic in the Service, not in the Controller or the UI.
-
Result, Not Exceptions
Use
Result.Failure("Error message")for things like "User not found" or "Insufficient balance". Reserve Exceptions for truly unexpected system crashes. -
Keep it Simple
No need for complex patterns like Mediator or CQRS. Just call the service method you need.
-
Small Commits
Small changes are easier to review and harder to break.
- Step-by-step reasoning first
- Output in this exact format: [specify]
- Make it visually appealing and demo-ready
Happy coding! If you're stuck, remember:
The "Features" folder is where the magic happens. 🚀