Skip to content

A modern, full-stack solution featuring Angular 21 frontend with signals and standalone components paired with a .NET 10 backend following Clean Architecture principles. Includes role-based access control, activity logging, and Docker containerization. Built with PostgreSQL, Material Design, and TailwindCSS for robust, scalable web applications.

License

Notifications You must be signed in to change notification settings

nitin27may/clean-architecture-docker-dotnet-angular

Repository files navigation

Clean Architecture Full-Stack Starter: .NET, Angular, and PostgreSQL

Clean Architecture with RBAC implementation for API (.Net) and UI (Angular)

Angular Build API Build MIT License Angular 21 .NET 10 PostgreSQL 17 .NET Aspire 9.5

Application Demo

Contact Management Application with Role-Based Access Control

What is this?

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

  • Frontend: Angular 21 with signals, Material Design, TailwindCSS v4, and Fluent Design
  • Backend: .NET 10 API with Clean Architecture and Scalar API documentation
  • Database: PostgreSQL 17 with pgAdmin and Dapper ORM
  • Orchestration: .NET Aspire 9.5 for local development with service discovery
  • DevOps: Docker, GitHub Actions, NGINX

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

Why Clean Architecture?

Clean Architecture Diagram

Clean Architecture provides significant benefits for your application:

  • βœ… Maintainability: Separate concerns to make your code easier to understand and modify
  • βœ… Testability: Independent components that can be tested in isolation
  • βœ… Flexibility: Swap frameworks or technologies without rewriting your core business logic
  • βœ… Scalability: Grow your application with a clear structure that new team members can quickly understand

Clean Architecture Series - Read more about it!

Quick Start

Option 1: Using .NET Aspire (Recommended for Development)

.NET Aspire provides a streamlined local development experience with automatic service discovery, health monitoring, and an integrated dashboard.

Prerequisites

Important: Make sure you have the correct versions installed before proceeding.

Steps

# Clone the repository
git clone https://github.com/nitin27may/clean-architecture-docker-dotnet-angular.git clean-app
cd clean-app

# IMPORTANT: Install Angular dependencies first
cd frontend
npm install
cd ..

# Run with Aspire
dotnet run --project aspire/AppHost

πŸ”— Then access:

  • Aspire Dashboard: https://localhost:17178 (see all services, logs, traces)
  • Frontend: http://localhost:4200
  • API: Check Aspire dashboard for the assigned port
  • Scalar API Docs: {API_URL}/scalar/v1
  • pgAdmin: Check Aspire dashboard for the assigned port

Option 2: Using Docker Compose (Production-like)

# Clone the repository
git clone https://github.com/nitin27may/clean-architecture-docker-dotnet-angular.git clean-app
cd clean-app

# Create .env file (required)
cp .env.example .env

# Start all services with Docker Compose
docker-compose up

Then access:

πŸ‘€ Default Users

Username Password Role
nitin27may@gmail.com P@ssword#321 Admin
editor@gmail.com P@ssword#321 Editor
reader@gmail.com P@ssword#321 Reader

Key Features

Modern Frontend

  • Angular 21 with standalone components
  • Signal-based state management
  • Material Design + TailwindCSS v4
  • Fluent Design System tokens
  • Dark/light theme support
  • Responsive mobile-first design
  • Role-based routing and menu

Secure Backend

  • Clean Architecture implementation
  • Generic Repository pattern
  • JWT authentication
  • Role-based permissions
  • User activity logging
  • Global exception handling
  • Scalar API documentation
  • PostgreSQL 17 with Dapper

DevOps Ready

  • .NET Aspire orchestration
  • Docker containerization
  • GitHub Actions workflows
  • NGINX reverse proxy
  • pgAdmin database management
  • Multi-environment configs
  • Database seeding

Project Structure

clean-architecture-docker-dotnet-angular/
β”œβ”€β”€ aspire/                      # .NET Aspire orchestration
β”‚   β”œβ”€β”€ AppHost/                 # Aspire host application
β”‚   β”‚   └── AppHost.cs           # Service configuration
β”‚   └── ServiceDefaults/         # Shared Aspire defaults
β”œβ”€β”€ backend/                     # .NET 10 API (Clean Architecture)
β”‚   β”œβ”€β”€ Contact.Api/             # API Layer (Controllers, Middleware)
β”‚   β”œβ”€β”€ Contact.Application/     # Application Layer (Services, DTOs)
β”‚   β”œβ”€β”€ Contact.Domain/          # Domain Layer (Entities, Interfaces)
β”‚   β”œβ”€β”€ Contact.Infrastructure/  # Infrastructure Layer (Repositories)
β”‚   └── Contact.Common/          # Shared utilities
β”œβ”€β”€ frontend/                    # Angular 21 SPA
β”‚   β”œβ”€β”€ src/app/@core/           # Core module (guards, interceptors, layout)
β”‚   β”œβ”€β”€ src/app/feature/         # Feature modules (contact, user, admin)
β”‚   └── src/app/styles/          # Global styles, Tailwind config
β”œβ”€β”€ scripts/                     # Database initialization
β”‚   β”œβ”€β”€ 01-init-db.sh            # Create database
β”‚   └── 02-seed-data.sql         # Seed initial data
β”œβ”€β”€ api-collection/              # Bruno API collection for testing
β”œβ”€β”€ docs/                        # Documentation
β”œβ”€β”€ loadbalancer/                # NGINX configuration
β”œβ”€β”€ Contact.Api.sln              # .NET Solution file
β”œβ”€β”€ docker-compose.yml           # Docker Compose configuration
└── Dockerfile.api               # API Dockerfile

Architecture

Container Architecture
Container Architecture Overview

Documentation

Comprehensive documentation is available:

Technology Stack

Layer Technology Version
Frontend Angular 21.0
UI Components Angular Material 21.0
CSS Framework TailwindCSS 4.1
Backend .NET 10.0
API Docs Scalar 2.1
Database PostgreSQL 17
ORM Dapper 2.1
Orchestration .NET Aspire 9.5
Containerization Docker Latest

🀝 Contributing

We welcome contributions! See our contributing guide for details on how to get involved.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

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

Star the Repository

If you find this project useful, please consider giving it a star on GitHub to show your support!

About

A modern, full-stack solution featuring Angular 21 frontend with signals and standalone components paired with a .NET 10 backend following Clean Architecture principles. Includes role-based access control, activity logging, and Docker containerization. Built with PostgreSQL, Material Design, and TailwindCSS for robust, scalable web applications.

Topics

Resources

License

Stars

Watchers

Forks