.NET with Angular project structure

.NET with Angular project structure

Explorer

  • .confignew
  • dotnet-tools.jsonnew
  • .git…
  • OrdersApp.Server
  • bin…, not committed
  • obj…, not committed
  • appsettings.Development.json
  • appsettings.json
  • OrdersApp.Server.csproj
  • OrdersApp.Server.http
  • OrdersApp.Server.jsonnew
  • Program.cs
  • WeatherForecast.cs
  • OrdersApp.Server.Testsnew
  • OrdersApp.Server.Tests.csprojnew
  • ordersapp.client
  • dist…new, not committed
  • node_modules…, not committed
  • .editorconfig
  • .gitignore
  • .prettierrc
  • angular.json
  • aspnetcore-https.js
  • eslint.config.jsnew
  • ng-openapi-gen.jsonnew
  • ordersapp.client.esproj
  • package-lock.json
  • package.json
  • README.md
  • tsconfig.app.json
  • tsconfig.json
  • tsconfig.spec.json
  • .editorconfignew
  • .env.examplenew
  • .gitattributesnew
  • .gitignore
  • AGENTS.mdnew
  • CLAUDE.mdnew
  • Directory.Build.propsnew
  • Directory.Packages.propsnew
  • docker-compose.ymlnew
  • global.jsonnew
  • lefthook.ymlnew
  • OrdersApp.slnx
  • README.md
  1. # Easiest on Windows: the Visual Studio template creates both projects and wires them

    Visual Studio > Create a new project > Angular and ASP.NET Core
  2. # Or with the CLI on any OS: create the solution

    mkdir OrdersApp && cd OrdersApp && dotnet new sln -n OrdersApp
  3. # Create the Web API project with controllers

    dotnet new webapi -n OrdersApp.Server --use-controllers && dotnet sln add OrdersApp.Server
  4. # Create the Angular app next to it

    npx @angular/cli@latest new ordersapp.client --routing --style=css --ssr=false
  5. # Let the API start the Angular dev server

    dotnet add OrdersApp.Server package Microsoft.AspNetCore.SpaProxy
  6. # Run everything (the https profile is required)

    dotnet run --project OrdersApp.Server --launch-profile https
  7. # Growing: tests, shared build files and local tools

    dotnet new xunit -n OrdersApp.Server.Tests && dotnet sln add OrdersApp.Server.Tests && dotnet new buildprops && dotnet new packagesprops && dotnet new globaljson && dotnet new tool-manifest
  8. # Growing: linting and the generated API client in the Angular app

    cd ordersapp.client && ng add angular-eslint && npm install -D ng-openapi-gen
  9. # Production: Playwright end-to-end tests

    cd ordersapp.client && npm init playwright@latest
  10. # Expert: Aspire AppHost and ServiceDefaults

    dotnet new aspire-apphost -n OrdersApp.AppHost && dotnet new aspire-servicedefaults -n OrdersApp.ServiceDefaults