🧱 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)