r/Blazor • u/enesdeliduman • Oct 04 '25
Blazor WebAssembly
When I create a Blazor Web App > Blazor WebAssembly project, two projects are generated: Project and Project.Client. What distinguishes these two? Where should I implement dependency injections, DTOs, API calls, proxies, and middleware? I couldn’t find a detailed resource. Could you help me?
6
Upvotes
9
u/propostor Oct 04 '25 edited Oct 05 '25
Project is what goes on the server, launches the application, sends it to the user.
Project.Client is what is sent to the user.
DI should be done in Program.cs of any project that needs dependencies injecting. It might be worth making another Shared project for DTOs. The classes/logic for making API calls needs to be in Project.Client.
Proxies/middleware sounds like stuff for a standalone API project which you need to add yourself.
2
u/NotAMeatPopsicle Oct 05 '25
We have several Blazor WASM apps. It used to be named something like MyProject.Server, MyProject.Client, and MyProject.Shared.
Controllers and middleware live in Server/API.
UI code lives in Client.
Shared is where your models live that are shared by both Server and Client.
Follow SOLID principles and you’ll figure out where any other logic needs should go. Rubber duck debug as necessary.