feat(backend): restructure API into layers with OpenAPI, versioning and error handling

Split the backend into API host, Domain, Application and Infrastructure projects. Add Swagger/OpenAPI per API version, Asp.Versioning (query/header), ProblemDetails with a global exception handler and SurrealQL migrations applied at startup (namespace/database ensured). Infrastructure owns the SurrealDB client, settings and DI.
This commit is contained in:
Rafał Tyński
2026-10-04 01:49:51 +02:00
parent 0a5ef715eb
commit b3756238a3
26 changed files with 437 additions and 63 deletions
+24 -3
View File
@@ -9,9 +9,30 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.12" />
<PackageReference Include="SurrealDb.Embedded.RocksDb" Version="1.0.0" />
<PackageReference Include="SurrealDb.Net" Version="1.0.0" />
<!-- Layered projects are nested under backend/ for deployment; exclude their
sources from the API host compile (they are referenced as projects). -->
<Compile Remove="Application/**/*.cs" />
<Compile Remove="Domain/**/*.cs" />
<Compile Remove="Infrastructure/**/*.cs" />
<Content Remove="Application/**" />
<Content Remove="Domain/**" />
<Content Remove="Infrastructure/**" />
</ItemGroup>
<ItemGroup>
<Content Include="migrations/**/*.surql" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Asp.Versioning.Mvc" Version="10.2.1" />
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="10.2.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="Application/TarninaHub.Application.csproj" />
<ProjectReference Include="Domain/TarninaHub.Domain.csproj" />
<ProjectReference Include="Infrastructure/TarninaHub.Infrastructure.csproj" />
</ItemGroup>
</Project>