Correct solution structure: Blazor, API, Models and DTOs [closed]

I have the following structure of web application: Blazor (Wasm) Web API Models (shared library) In API project I created DTOs (right now they almost the same as models) and I use AutoMapper to map them to models. In API I use DTOs. in Blazor project I created services, which use HttpClient to connect to API. Right now I use models in my Blazor project, it works because Models and DTOs are practically the same. But probably I need to bind Blazor forms to DTOs, not to models. But my models in shared project and Blazor has reference to it, and doesn't have reference to API. Should I mode DTOs to the same library where I have Models or create second shared library or just add reference to API project. I'm a little bit confused whar is correct solution structure should be.

Mar 17, 2025 - 23:19
 0
Correct solution structure: Blazor, API, Models and DTOs [closed]

I have the following structure of web application:

  1. Blazor (Wasm)
  2. Web API
  3. Models (shared library)

In API project I created DTOs (right now they almost the same as models) and I use AutoMapper to map them to models. In API I use DTOs. in Blazor project I created services, which use HttpClient to connect to API. Right now I use models in my Blazor project, it works because Models and DTOs are practically the same. But probably I need to bind Blazor forms to DTOs, not to models. But my models in shared project and Blazor has reference to it, and doesn't have reference to API.

Should I mode DTOs to the same library where I have Models or create second shared library or just add reference to API project.

I'm a little bit confused whar is correct solution structure should be.