π§± Step 1 β Create Main Folder and Open Terminal
π Open a terminal (PowerShell / VS Code terminal) and type these commands one by one:
mkdir AccountingSuite
cd AccountingSuite
mkdir src tests
β
Check: After this you must have:
AccountingSuite/
βββ src/
βββ tests/
π§± Step 2 β Create Projects
Now go inside src and create the projects:
cd src
dotnet new webapi -n Accounting.API
dotnet new blazorwasm -n Accounting.UI
dotnet new classlib -n Accounting.Domain
dotnet new classlib -n Accounting.Infrastructure
dotnet new classlib -n Accounting.Shared
β
After this, inside src youβll see 5 folders.
If you get an error like βtemplate not foundβ, install the correct .NET SDK or re-open terminal.
π§± Step 3 β Create the Solution File and Add All Projects
cd ..
dotnet new sln -n AccountingSuite
dotnet sln AccountingSuite.sln add src/Accounting.API/Accounting.API.csproj
dotnet sln AccountingSuite.sln add src/Accounting.UI/Accounting.UI.csproj
dotnet sln AccountingSuite.sln add src/Accounting.Domain/Accounting.Domain.csproj
dotnet sln AccountingSuite.sln add src/Accounting.Infrastructure/Accounting.Infrastructure.csproj
dotnet sln AccountingSuite.sln add src/Accounting.Shared/Accounting.Shared.csproj
β
Youβll now have AccountingSuite.sln in the root folder.
Test build:
dotnet build
Expect βBuild succeeded.β
π§± Step 4 β Add Project References
Inside src:
cd src
dotnet add Accounting.API reference Accounting.Domain
dotnet add Accounting.API reference Accounting.Infrastructure
dotnet add Accounting.API reference Accounting.Shared
dotnet add Accounting.Infrastructure reference Accounting.Domain
dotnet add Accounting.Infrastructure reference Accounting.Shared
dotnet add Accounting.UI reference Accounting.Shared
β Output should show βReference added.β for each line.
π§± Step 5 β Add Base Folders
Use VS Code or File Explorer.
Create these folders:
Accounting.Domain
Entities/
Enums/
Interfaces/
Accounting.Infrastructure
Data/
Repositories/
Migrations/
Accounting.API
Controllers/
Services/
Helpers/
Middlewares/
Accounting.Shared
DTOs/
Responses/
Constants/
β Donβt add any code yet β only folders.
π§± Step 6 β Add Swagger + CORS and Test API
Open src/Accounting.API/Program.cs.
Replace all code with this ready-to-run version π
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = WebApplication.CreateBuilder(args);
// Add services
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll", p =>
p.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
});
var app = builder.Build();
// Middleware
app.UseCors("AllowAll");
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseAuthorization();
app.MapControllers();
app.Run();
β
Save and run:
cd src/Accounting.API
dotnet run
Open browser β https://localhost:5001/swagger (or port shown).
Youβll see Swagger page with βWeatherForecastβ example.
π§± Step 7 β Create a Health Check Controller
Create file:
src/Accounting.API/Controllers/HealthController.cs
Paste this:
using Microsoft.AspNetCore.Mvc;
namespace Accounting.API.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class HealthController : ControllerBase
{
[HttpGet]
public IActionResult Get() => Ok(new { status = "up" });
}
}
Save and run again:
dotnet run
Open Swagger β youβll now see GET /api/health β click Try it out β Execute.
β
Expected result:
{
"status": "up"
}
Congratulations π
Your Clean Architecture API is alive!
π§± Step 8 β Initialize Git + GitHub
From root folder (AccountingSuite/):
git init
git add .
git commit -m "Day1 - Initial Clean Architecture Setup"
If you use GitHub CLI:
gh repo create AccountingSuite --public --source=. --remote=origin
git push -u origin main
β Repo online with all 5 projects.
π§Ύ Step 9 β End of Day 1 Checklist
| Task | Done |
|---|---|
| Main folder + projects created | β |
| Solution file built successfully | β |
| Project references added | β |
| Base folders created | β |
| Swagger + CORS working | β |
| HealthController tested | β |
| Git repo initialized and pushed | β |
π¬ Now ask your teammate:
βDay 1 setup done β can you review folder structure and confirm before I start Day 2 (Database + Entities design)?β
Do you want me to give you the Day 2 (Database & Entity design) step-by-step next, in the same beginner-friendly style?
Top comments (0)