|
| 1 | +# Solution Folder Guide |
| 2 | + |
| 3 | +This guide defines what belongs in each folder represented by the solution and |
| 4 | +its projects. |
| 5 | + |
| 6 | +## Top-Level Solution Folders |
| 7 | + |
| 8 | +### src/ |
| 9 | + |
| 10 | +Production code lives here. Keep reusable and deployable components under |
| 11 | +project-specific folders. |
| 12 | + |
| 13 | +Contains: |
| 14 | + |
| 15 | +- `AppHost/`: Aspire orchestration and deployment composition. |
| 16 | +- `Api/`: ASP.NET Core application with domain and infrastructure. |
| 17 | +- `Generators/`: Roslyn source generators and analyzers. |
| 18 | +- `ServiceDefaults/`: Shared service configuration extensions. |
| 19 | +- `WebUi/`: Frontend app and embedded static assets. |
| 20 | + |
| 21 | +Does not contain: |
| 22 | + |
| 23 | +- Unit tests. |
| 24 | +- Temporary scripts or scratch files. |
| 25 | +- Build artifacts (bin/obj output only). |
| 26 | + |
| 27 | +### test/ |
| 28 | + |
| 29 | +Automated tests live here. |
| 30 | + |
| 31 | +Contains: |
| 32 | + |
| 33 | +- `Template.Tests/`: Domain and feature tests for the template API. |
| 34 | + |
| 35 | +Does not contain: |
| 36 | + |
| 37 | +- Production implementation code. |
| 38 | +- Manual test notes or ad-hoc run output. |
| 39 | + |
| 40 | +## Project Folder Responsibilities |
| 41 | + |
| 42 | +### src/AppHost/ |
| 43 | + |
| 44 | +Use this project for distributed application orchestration. |
| 45 | + |
| 46 | +Put here: |
| 47 | + |
| 48 | +- Resource wiring for API, Redis, PostgreSQL, and related infrastructure. |
| 49 | +- Deployment and image publishing configuration used by Aspire. |
| 50 | +- Environment-specific orchestration settings. |
| 51 | + |
| 52 | +Avoid here: |
| 53 | + |
| 54 | +- Business logic. |
| 55 | +- HTTP endpoint handlers. |
| 56 | + |
| 57 | +### src/Api/ |
| 58 | + |
| 59 | +Core backend application code. |
| 60 | + |
| 61 | +Put here: |
| 62 | + |
| 63 | +- API endpoints and request handlers. |
| 64 | +- Domain entities, value objects, and domain abstractions. |
| 65 | +- Infrastructure integrations (data access, event bus, persistence). |
| 66 | +- Runtime configuration and middleware registration. |
| 67 | + |
| 68 | +Avoid here: |
| 69 | + |
| 70 | +- Frontend-only assets. |
| 71 | +- Test-only helper code. |
| 72 | + |
| 73 | +### src/Api/Configuration/ |
| 74 | + |
| 75 | +Application setup and runtime wiring. |
| 76 | + |
| 77 | +Put here: |
| 78 | + |
| 79 | +- DI registrations. |
| 80 | +- options classes and binding. |
| 81 | +- Middleware and host configuration extensions. |
| 82 | + |
| 83 | +### src/Api/Domain/ |
| 84 | + |
| 85 | +Business rules and domain model. |
| 86 | + |
| 87 | +Put here: |
| 88 | + |
| 89 | +- Entities and aggregates. |
| 90 | +- Value objects and IDs. |
| 91 | +- Domain events and domain interfaces. |
| 92 | + |
| 93 | +Keep this layer independent from infrastructure details. |
| 94 | + |
| 95 | +### src/Api/Features/ |
| 96 | + |
| 97 | +Vertical slices for use cases. |
| 98 | + |
| 99 | +Put here: |
| 100 | + |
| 101 | +- Endpoint mapping for each feature area. |
| 102 | +- Command/query handlers for API operations. |
| 103 | + |
| 104 | +Avoid direct coupling to infrastructure implementation types when domain |
| 105 | +abstractions can be used. |
| 106 | + |
| 107 | +### src/Api/Infrastructure/ |
| 108 | + |
| 109 | +Technical implementation details. |
| 110 | + |
| 111 | +Put here: |
| 112 | + |
| 113 | +- EF Core DbContext, migrations, and query implementations. |
| 114 | +- Event bus implementation and serialization. |
| 115 | +- Persistence-related services. |
| 116 | + |
| 117 | +### src/Generators/ |
| 118 | + |
| 119 | +Compile-time analyzers and source generation. |
| 120 | + |
| 121 | +Put here: |
| 122 | + |
| 123 | +- Analyzer diagnostics and rules. |
| 124 | +- Code-generation templates and generator implementations. |
| 125 | +- Release notes for analyzer versions. |
| 126 | + |
| 127 | +### src/ServiceDefaults/ |
| 128 | + |
| 129 | +Cross-cutting service behavior shared by applications. |
| 130 | + |
| 131 | +Put here: |
| 132 | + |
| 133 | +- Logging, telemetry, resilience, and discovery defaults. |
| 134 | +- Extension methods consumed by host projects. |
| 135 | + |
| 136 | +### src/WebUi/ |
| 137 | + |
| 138 | +Frontend source and build packaging for embedding in .NET artifacts. |
| 139 | + |
| 140 | +Put here: |
| 141 | + |
| 142 | +- Vite and TypeScript configuration. |
| 143 | +- Vue components and static frontend assets. |
| 144 | +- Build output packaging logic used by the .NET project. |
| 145 | + |
| 146 | +Avoid here: |
| 147 | + |
| 148 | +- Backend domain logic. |
| 149 | + |
| 150 | +### test/Template.Tests/ |
| 151 | + |
| 152 | +Test project for template behavior. |
| 153 | + |
| 154 | +Put here: |
| 155 | + |
| 156 | +- Unit and feature tests for domain and API handlers. |
| 157 | +- Test doubles and helper fixtures used by tests. |
| 158 | + |
| 159 | +Avoid here: |
| 160 | + |
| 161 | +- Application startup or deployment code. |
| 162 | + |
| 163 | +## Non-Solution Support Folders |
| 164 | + |
| 165 | +These folders support development but are not primary solution code folders. |
| 166 | + |
| 167 | +- `.github/`: CI/CD and automation workflows. |
| 168 | +- `docs/`: Documentation source files for DocFX and Pages. |
| 169 | +- `assets/`: Shared documentation assets. |
| 170 | +- `artifacts/`: Generated build outputs. |
0 commit comments