---
name: dotnet-structure
description: .NET Clean Architecture 4-layer SmartStack
group: A
allowed-tools: [Read, Glob, Grep]
---

# Skill: .NET Clean Architecture SmartStack

## 4-Layer Architecture

```
{App}.Domain/          # Entities, value objects, enums
{App}.Application/     # Services, DTOs, validators
{App}.Infrastructure/  # EF Core, repositories, external services
{App}.Api/             # Controllers, Program.cs, appsettings
```

## Project References
```
Domain  ←──  Application  ←──  Api
   ↑              ↑
   └──  Infrastructure  ──→  Api
```

## Dual-DbContext
- `ExtensionsDbContext` inherits from SmartStack `ApplicationDbContext`
- `IExtensionsDbContext` inherits from `IApplicationDbContext`

## Program.cs — 4 Mandatory Calls
```csharp
builder.Services.AddSmartStack(builder.Configuration);
await app.InitializeSmartStackAsync();
app.UseSmartStack();
app.MapSmartStack();
```

## Directory.Build.props
```xml
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
```

## Standard Ports
- API HTTP: `localhost:5142` / HTTPS: `localhost:7142`
- Frontend dev: `localhost:3000`
