What is this project about?
ContainerNinja is a boilerplate template project to demonstrate building a multi-container Full Stack application with ASP.NET Core (.NET 6) Web API following Clean Architecture, and Angular. The solution uses Docker Compose to orchestrate deployment of this entire stack to Docker.
What does the Solution offer?
The Solution is built keeping in mind the most fundamental blocks an API must have in order to build a scalable and near-perfect API component. The solution offers a complete implementation of the following:
- Clean Architecture with separated layers for API, Core, Contracts, Infra and Migrations
- UnitOfWork with Generic Repository
- Entity Framework Core migrations with SQLite
- Complete CRUD for an Entity following CQRS, with segregated Commands and Queries
- Fluent Validation of input inside the Command classes
- Preconfigured Swagger UI
- ETag generation and validation on the API side for Response Caching (GET) and Collision detection (PUT)
- Ready to use Docker configuration with Dockerfiles
- In-Memory Caching for single Entity via IMemoryCache
- Distributed Caching implementation via IDistributedCache, with NCache
- JWT Token API for Generation and Configured JWT Validation
- Roles based Authorization with predefined Roles
- Auditable Entities with User Tracking
- Complete Client Implementation of Entity CRUD and Token management in Angular
- API Versioning with separated Swagger Documentation
- AutoMapper implementation for Entity-to-DTO conversion
- One Command deployment in Docker with Docker Compose
- ILogger logging implementation
- Database Seeding with a Single User and Roles added as the application starts
Technologies Used
- ASP.NET Core (.NET 6) Web API
- Entity Framework Core (EFCore 6)
- MediatR for .NET 6
- Fluent Validation for .NET 6
- SQLite
- SwaggerUI
- AutoMapper
- Angular 13 (Client)
- Bootstrap 4 (CSS Framework)
- Nginx (Proxy)
- Docker Compose
How do I get started with Docker Compose?
To get started, follow the below steps:
- Install .NET 6 SDK
- Install the latest NodeJS
- Install Docker Desktop (for Windows) / Docker (for Linux/Mac)
- Clone the Solution into your Local Directory
- On the Repository root you can find the docker-compose.yml file
- Run the below command to build and run the solution in Docker (requires a working Docker installation)
> docker-compose build --force-rm --no-cache && docker-compose up
- Once the containers start successfully navigate to http://localhost
I'm not into Docker. How do I get started?
You can also just run the solution without Docker by following the steps below:
- Install .NET 6 SDK
- Install the latest NodeJS
- Clone the Solution into your Local Directory
- Navigate to the API directory (./API) and run the below command to get the API running:
> dotnet run --project ./ContainerNinja.API
- Navigate to the Client directory (./Client) and run the below commands to get the Angular application running:
> npm install && npm start
- Open a browser, navigate to http://localhost:4200 and you're all set!
Default User:
The solution adds a default user to the database while starting up as a part of Seeding. You can use the below credentials to Login and start adding items.
EmailAddress: [email protected]; Password: admin
What is Docker Compose?
Docker-Compose is a configuration file which contains instructions for the Docker about how services should be built from respective Dockerfiles. While a Dockerfile aims at creating and customizing application containers by means of base images and instructions, the Docker-Compose file works on top of the Dockerfile and helps developers in running docker containers with complex runtime specifications such as ports, volumes and so on.
Read more: Dockerizing a Full Stack Application with Docker Compose
Issues or Ideas?
If you face any issues or would like to drop a suggestion,
License
The solution is completely open source and is licensed with MIT License.
Show your Support
I really hope this solution helps developers get started on building awesome things with ASP.NET Core (.NET 6) Web API and get into the world of containerized development real quick.
Found this solution helpful and useful? You can do these to help this reach greater audience.
- Leave a star on this repository
β - Recommend this solution to your colleagues and dev community
- Join my Twitter family. I regularly post awesome content on dev over there.
- Join my Facebook community. I regularly post interesting content over there as well.
- You can also buy me a cup of great coffee
β !
For more detailed articles and how-to guides, visit https://referbruv.com