Skip to content

Commit 2da1878

Browse files
authored
Merge pull request #31 from nitin27may/feature/add-aspire
Feature/add aspire
2 parents 6bbce05 + 088f9b5 commit 2da1878

File tree

224 files changed

+6708
-3969
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+6708
-3969
lines changed

.github/workflows/api-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
push:
44
branches: main
55
paths:
6-
- 'backend/src/**'
6+
- 'backend/**'
77

88
jobs:
99
main:
@@ -24,5 +24,5 @@ jobs:
2424
id: docker_build
2525
uses: docker/build-push-action@v2
2626
with:
27-
context: backend/src/.
28-
file: backend/src/Dockerfile
27+
context: backend/.
28+
file: Dockerfile.api

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
*.user
1010
*.userosscache
1111
*.sln.docstates
12-
12+
.vs
13+
.playwright-mcp
1314
# User-specific files (MonoDevelop/Xamarin Studio)
1415
*.userprefs
1516
.env
Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 17
4-
VisualStudioVersion = 17.11.35208.52
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.0.11222.15 d18.0
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Contact.Api", "Contact.Api\Contact.Api.csproj", "{E71B9B65-032D-4CC7-86B9-4712CC4E4B8E}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Contact.Api", "backend\Contact.Api\Contact.Api.csproj", "{E71B9B65-032D-4CC7-86B9-4712CC4E4B8E}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contact.Infrastructure", "Contact.Infrastructure\Contact.Infrastructure.csproj", "{AD68A223-AFC1-4A11-B056-82D1DEF146F0}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contact.Infrastructure", "backend\Contact.Infrastructure\Contact.Infrastructure.csproj", "{AD68A223-AFC1-4A11-B056-82D1DEF146F0}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contact.Application", "Contact.Application\Contact.Application.csproj", "{42EF202E-6AA6-42B8-9AE6-E4B06C36EB36}"
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contact.Application", "backend\Contact.Application\Contact.Application.csproj", "{42EF202E-6AA6-42B8-9AE6-E4B06C36EB36}"
1111
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contact.Domain", "Contact.Domain\Contact.Domain.csproj", "{41338193-C8C7-4348-9011-C7D2C437B36C}"
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contact.Domain", "backend\Contact.Domain\Contact.Domain.csproj", "{41338193-C8C7-4348-9011-C7D2C437B36C}"
1313
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contact.Common", "Contact.Common\Contact.Common.csproj", "{32C9230B-EE1E-4F3C-806F-685EB36C55F4}"
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contact.Common", "backend\Contact.Common\Contact.Common.csproj", "{32C9230B-EE1E-4F3C-806F-685EB36C55F4}"
15+
EndProject
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contact.AppHost", "aspire\AppHost\Contact.AppHost.csproj", "{9E5B8B78-8F0B-403E-A7AA-71A75C60D128}"
17+
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contact.ServiceDefaults", "aspire\ServiceDefaults\Contact.ServiceDefaults.csproj", "{B649DAF0-42CE-92EA-0381-374285B927BF}"
1519
EndProject
1620
Global
1721
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -39,6 +43,14 @@ Global
3943
{32C9230B-EE1E-4F3C-806F-685EB36C55F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
4044
{32C9230B-EE1E-4F3C-806F-685EB36C55F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
4145
{32C9230B-EE1E-4F3C-806F-685EB36C55F4}.Release|Any CPU.Build.0 = Release|Any CPU
46+
{9E5B8B78-8F0B-403E-A7AA-71A75C60D128}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47+
{9E5B8B78-8F0B-403E-A7AA-71A75C60D128}.Debug|Any CPU.Build.0 = Debug|Any CPU
48+
{9E5B8B78-8F0B-403E-A7AA-71A75C60D128}.Release|Any CPU.ActiveCfg = Release|Any CPU
49+
{9E5B8B78-8F0B-403E-A7AA-71A75C60D128}.Release|Any CPU.Build.0 = Release|Any CPU
50+
{B649DAF0-42CE-92EA-0381-374285B927BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51+
{B649DAF0-42CE-92EA-0381-374285B927BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
52+
{B649DAF0-42CE-92EA-0381-374285B927BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
53+
{B649DAF0-42CE-92EA-0381-374285B927BF}.Release|Any CPU.Build.0 = Release|Any CPU
4254
EndGlobalSection
4355
GlobalSection(SolutionProperties) = preSolution
4456
HideSolutionNode = FALSE

Dockerfile.api

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
2+
WORKDIR /app
3+
EXPOSE 8000
4+
ENV ASPNETCORE_URLS=http://+:8000
5+
RUN groupadd -g 2000 dotnet \
6+
&& useradd -m -u 2000 -g 2000 dotnet
7+
USER dotnet
8+
9+
# This stage is used to build the service project
10+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
11+
ARG BUILD_CONFIGURATION=Release
12+
ARG DOTNET_SKIP_POLICY_LOADING=true
13+
WORKDIR /src
14+
COPY ["backend/Contact.Api/Contact.Api.csproj", "backend/Contact.Api/"]
15+
COPY ["backend/Contact.Application/Contact.Application.csproj", "backend/Contact.Application/"]
16+
COPY ["backend/Contact.Domain/Contact.Domain.csproj", "backend/Contact.Domain/"]
17+
COPY ["backend/Contact.Infrastructure/Contact.Infrastructure.csproj", "backend/Contact.Infrastructure/"]
18+
COPY ["backend/Contact.Common/Contact.Common.csproj", "backend/Contact.Common/"]
19+
COPY ["aspire/ServiceDefaults/Contact.ServiceDefaults.csproj", "aspire/ServiceDefaults/"]
20+
21+
RUN dotnet restore "./backend/Contact.Api/Contact.Api.csproj"
22+
COPY backend/ backend/
23+
COPY aspire/ServiceDefaults/ aspire/ServiceDefaults/
24+
WORKDIR "/src/backend/Contact.Api"
25+
RUN dotnet build "./Contact.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build
26+
27+
RUN ls /app/build
28+
29+
# This stage is used to publish the service project to be copied to the final stage
30+
FROM build AS publish
31+
ARG BUILD_CONFIGURATION=Release
32+
RUN dotnet publish "./Contact.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
33+
34+
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
35+
FROM base AS final
36+
WORKDIR /app
37+
# COPY --from=publish /app/publish/Contact.Api.dll .
38+
COPY --from=publish /app/publish .
39+
ENTRYPOINT ["dotnet", "Contact.Api.dll"]

README.md

Lines changed: 118 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
# 🚀 Clean Architecture Full-Stack Starter: .NET, Angular, and PostgreSQL
2-
3-
<!-- <p align="center">
4-
<img src="docs/logo.png" alt="Clean Architecture Logo" width="150px">
5-
<br>
6-
<em>Production-ready | Maintainable | Scalable</em>
7-
</p> -->
8-
1+
# Clean Architecture Full-Stack Starter: .NET, Angular, and PostgreSQL
2+
> Clean Architecture with RBAC implementation for API (.Net) and UI (Angular)
93
<p align="center">
104
<a href="https://github.com/nitin27may/clean-architecture-docker-dotnet-angular/actions/workflows/angular-build.yml">
115
<img src="https://github.com/nitin27may/clean-architecture-docker-dotnet-angular/actions/workflows/angular-build.yml/badge.svg" alt="Angular Build">
@@ -16,9 +10,10 @@
1610
<a href="LICENSE">
1711
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="MIT License">
1812
</a>
19-
<img src="https://img.shields.io/badge/Angular-19-DD0031.svg" alt="Angular 20">
20-
<img src="https://img.shields.io/badge/.NET-9-512BD4.svg" alt=".NET 9">
21-
<img src="https://img.shields.io/badge/PostgreSQL-16-336791.svg" alt="PostgreSQL 16">
13+
<img src="https://img.shields.io/badge/Angular-21-512BD4.svg" alt="Angular 21">
14+
<img src="https://img.shields.io/badge/.NET-10-512BD4.svg" alt=".NET 10">
15+
<img src="https://img.shields.io/badge/PostgreSQL-17-336791.svg" alt="PostgreSQL 17">
16+
<img src="https://img.shields.io/badge/Aspire-9.5-6C3483.svg" alt=".NET Aspire 9.5">
2217
</p>
2318
2419
<p align="center">
@@ -28,18 +23,19 @@
2823
<em>Contact Management Application with Role-Based Access Control</em>
2924
</p>
3025

31-
## What is this?
26+
## What is this?
3227

3328
A production-ready **full-stack starter kit** built with modern technologies and best practices:
3429

35-
- **Frontend**: Angular 20 with signals, Material Design, and TailwindCSS
36-
- **Backend**: .NET 9 API with Clean Architecture
37-
- **Database**: PostgreSQL with Dapper
30+
- **Frontend**: Angular 21 with signals, Material Design, TailwindCSS v4, and Fluent Design
31+
- **Backend**: .NET 10 API with Clean Architecture and Scalar API documentation
32+
- **Database**: PostgreSQL 17 with pgAdmin and Dapper ORM
33+
- **Orchestration**: .NET Aspire 9.5 for local development with service discovery
3834
- **DevOps**: Docker, GitHub Actions, NGINX
3935

4036
Perfect for developers who want to **focus on business logic** instead of configuring infrastructure.
4137

42-
## 🏗️ Why Clean Architecture?
38+
## Why Clean Architecture?
4339

4440
<p align="center">
4541
<img src="docs/screenshots/clean-architecture.png" alt="Clean Architecture Diagram" width="60%">
@@ -54,7 +50,44 @@ Clean Architecture provides **significant benefits** for your application:
5450

5551
[Clean Architecture Series](./docs/architecture-series.md) - Read more about it!
5652

57-
## 🚀 Quick Start
53+
## Quick Start
54+
55+
### Option 1: Using .NET Aspire (Recommended for Development)
56+
57+
**.NET Aspire** provides a streamlined local development experience with automatic service discovery, health monitoring, and an integrated dashboard.
58+
59+
#### Prerequisites
60+
61+
> **Important**: Make sure you have the correct versions installed before proceeding.
62+
63+
- [.NET SDK 10.0](https://dotnet.microsoft.com/download/dotnet/10.0) or later
64+
- [Node.js 22 LTS](https://nodejs.org/) (**not** Node 23 - use LTS version only)
65+
- [Docker Desktop](https://www.docker.com/products/docker-desktop) (for PostgreSQL container)
66+
67+
#### Steps
68+
69+
```bash
70+
# Clone the repository
71+
git clone https://github.com/nitin27may/clean-architecture-docker-dotnet-angular.git clean-app
72+
cd clean-app
73+
74+
# IMPORTANT: Install Angular dependencies first
75+
cd frontend
76+
npm install
77+
cd ..
78+
79+
# Run with Aspire
80+
dotnet run --project aspire/AppHost
81+
```
82+
83+
🔗 Then access:
84+
- **Aspire Dashboard**: https://localhost:17178 (see all services, logs, traces)
85+
- **Frontend**: http://localhost:4200
86+
- **API**: Check Aspire dashboard for the assigned port
87+
- **Scalar API Docs**: `{API_URL}/scalar/v1`
88+
- **pgAdmin**: Check Aspire dashboard for the assigned port
89+
90+
### Option 2: Using Docker Compose (Production-like)
5891

5992
```bash
6093
# Clone the repository
@@ -68,10 +101,10 @@ cp .env.example .env
68101
docker-compose up
69102
```
70103

71-
🔗 Then access:
104+
Then access:
72105
- Frontend: http://localhost
73106
- API: http://localhost/api
74-
- Swagger: http://localhost/swagger
107+
- Scalar API Docs: http://localhost/scalar/v1
75108

76109
### 👤 Default Users
77110

@@ -81,78 +114,126 @@ docker-compose up
81114
| editor@gmail.com | P@ssword#321 | Editor |
82115
| reader@gmail.com | P@ssword#321 | Reader |
83116

84-
## 🔥 Key Features
117+
## Key Features
85118

86119
<table>
87120
<tr>
88121
<td width="33%">
89-
<h3>📱 Modern Frontend</h3>
122+
<h3>Modern Frontend</h3>
90123
<ul>
91-
<li>Angular 20 with standalone components</li>
124+
<li>Angular 21 with standalone components</li>
92125
<li>Signal-based state management</li>
93-
<li>Material Design + TailwindCSS</li>
126+
<li>Material Design + TailwindCSS v4</li>
127+
<li>Fluent Design System tokens</li>
94128
<li>Dark/light theme support</li>
95129
<li>Responsive mobile-first design</li>
96-
<li>Role Based Routing and Menu</li>
130+
<li>Role-based routing and menu</li>
97131
</ul>
98132
</td>
99133
<td width="33%">
100-
<h3>🔒 Secure Backend</h3>
134+
<h3>Secure Backend</h3>
101135
<ul>
102136
<li>Clean Architecture implementation</li>
103137
<li>Generic Repository pattern</li>
104138
<li>JWT authentication</li>
105139
<li>Role-based permissions</li>
106-
<li>User Activity Logging</li>
107-
<li>Golbal Exception Handling</li>
108-
<li>PostgreSQL with Dapper</li>
140+
<li>User activity logging</li>
141+
<li>Global exception handling</li>
142+
<li>Scalar API documentation</li>
143+
<li>PostgreSQL 17 with Dapper</li>
109144
</ul>
110145
</td>
111146
<td width="33%">
112-
<h3>🚢 DevOps Ready</h3>
147+
<h3>DevOps Ready</h3>
113148
<ul>
149+
<li>.NET Aspire orchestration</li>
114150
<li>Docker containerization</li>
115151
<li>GitHub Actions workflows</li>
116152
<li>NGINX reverse proxy</li>
153+
<li>pgAdmin database management</li>
117154
<li>Multi-environment configs</li>
118-
<li>Database migrations</li>
155+
<li>Database seeding</li>
119156
</ul>
120157
</td>
121158
</tr>
122159
</table>
123160

124-
## 🧩 Architecture
161+
## Project Structure
162+
163+
```
164+
clean-architecture-docker-dotnet-angular/
165+
├── aspire/ # .NET Aspire orchestration
166+
│ ├── AppHost/ # Aspire host application
167+
│ │ └── AppHost.cs # Service configuration
168+
│ └── ServiceDefaults/ # Shared Aspire defaults
169+
├── backend/ # .NET 10 API (Clean Architecture)
170+
│ ├── Contact.Api/ # API Layer (Controllers, Middleware)
171+
│ ├── Contact.Application/ # Application Layer (Services, DTOs)
172+
│ ├── Contact.Domain/ # Domain Layer (Entities, Interfaces)
173+
│ ├── Contact.Infrastructure/ # Infrastructure Layer (Repositories)
174+
│ └── Contact.Common/ # Shared utilities
175+
├── frontend/ # Angular 21 SPA
176+
│ ├── src/app/@core/ # Core module (guards, interceptors, layout)
177+
│ ├── src/app/feature/ # Feature modules (contact, user, admin)
178+
│ └── src/app/styles/ # Global styles, Tailwind config
179+
├── scripts/ # Database initialization
180+
│ ├── 01-init-db.sh # Create database
181+
│ └── 02-seed-data.sql # Seed initial data
182+
├── api-collection/ # Bruno API collection for testing
183+
├── docs/ # Documentation
184+
├── loadbalancer/ # NGINX configuration
185+
├── Contact.Api.sln # .NET Solution file
186+
├── docker-compose.yml # Docker Compose configuration
187+
└── Dockerfile.api # API Dockerfile
188+
```
189+
190+
## Architecture
125191

126192
<p align="center">
127193
<img src="docs/screenshots/architecture.png" alt="Container Architecture" width="80%">
128194
<br>
129195
<em>Container Architecture Overview</em>
130196
</p>
131197

132-
## 📚 Documentation
198+
## Documentation
133199

134-
📖 Comprehensive documentation is available:
200+
Comprehensive documentation is available:
135201

202+
- [Aspire Guide](./docs/aspire-guide.md) - Running with .NET Aspire
136203
- [Development Guide](./docs/development-guide.md) - Get started with development
137204
- [Frontend Documentation](./docs/frontend.md) - Angular architecture details
138205
- [Backend Documentation](./docs/backend.md) - .NET API implementation
206+
- [Docker Guide](./docs/docker-guide.md) - Container configuration
139207
- [Feature List](./docs/visual-feature-guide.md) - Detailed feature breakdown
140208
- [Clean Architecture Series](./docs/architecture-series.md) - In-depth articles
141209
- [Roadmap](./docs/roadmap.md) - Upcoming features
142210

211+
## Technology Stack
212+
213+
| Layer | Technology | Version |
214+
|-------|------------|---------|
215+
| Frontend | Angular | 21.0 |
216+
| UI Components | Angular Material | 21.0 |
217+
| CSS Framework | TailwindCSS | 4.1 |
218+
| Backend | .NET | 10.0 |
219+
| API Docs | Scalar | 2.1 |
220+
| Database | PostgreSQL | 17 |
221+
| ORM | Dapper | 2.1 |
222+
| Orchestration | .NET Aspire | 9.5 |
223+
| Containerization | Docker | Latest |
143224

144225
## 🤝 Contributing
145226

146227
We welcome contributions! See our [contributing guide](./CONTRIBUTING.md) for details on how to get involved.
147228

148-
## 📄 License
229+
## License
149230

150231
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
151232

152-
## 📧 Contact
233+
## Contact
153234

154235
For questions or support, please contact Nitin Singh at nitin27may@gmail.com.
155236

156-
## 🌟 Star the Repository
237+
## Star the Repository
157238

158-
If you find this project useful, please consider giving it a star on GitHub to show your support!
239+
If you find this project useful, please consider giving it a star on GitHub to show your support!
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)