Welcome to Cpnucleo – a cutting-edge sample solution that embodies the best practices for building robust and scalable .NET projects. This project is your blueprint for modern application development using C# and Docker, designed to help developers kickstart their journey with high-quality code, organized structure, and industry-standard patterns.
- Introduction
- Project Overview
- Key Features
- Architecture
- Technologies Used
- Prerequisites
- Getting Started
- Installation
- Configuration
- Building and Running
- Testing
- Deployment
- Contribution Guidelines
- License
- Troubleshooting & FAQ
- Contact & Support
- Acknowledgements
Cpnucleo is a sample solution that demonstrates how to implement industry best practices when developing .NET projects. The purpose of this repository is to serve as a learning tool and a reference implementation that covers everything from clean architecture principles and dependency injection to unit testing and containerization.
This repository is designed for:
- Beginners aiming to learn best practices in modern .NET projects.
- Experienced developers looking for a reliable reference implementation.
- Teams seeking to set a standard for coding conventions, project structure, and CI/CD pipeline integration.
Highlights:
- Clean and modular project structure
- Robust error handling and logging
- Comprehensive unit and integration tests
- Docker integration for containerized deployments
- Extensive documentation for ease of onboarding
- Modular Architecture: Clear separation of concerns using layered architecture, domain-driven design, and SOLID principles.
- Extensible Design: Easily extend and customize the solution to fit your specific requirements.
- Robust Error Handling: Integrated logging and detailed exception management.
- Test Coverage: Extensive unit and integration tests ensuring high reliability.
- Containerized Environment: Dockerfile provided for building and running the app in a containerized environment.
- CI/CD Ready: Sample configurations and scripts for automated build, test, and deployment processes.
The solution follows an organized structure that promotes:
- Separation of Concerns: Clear distribution between UI, Business Logic, and Data Access layers.
- Dependency Injection: Decoupled components for easy testing and maintainability.
- Configuration Management: Centralized configuration that adapts to different environments.
A high-level diagram of the architecture is provided below:
+---------------------+
| Client / Frontend |
+---------------------+
|
v
+---------------------+
| API Gateway |
| (Controllers/Routes)|
+---------------------+
|
v
+---------------------+
| Business Logic Layer|
| (Services/Managers) |
+---------------------+
|
v
+---------------------+
| Data Access Layer |
| (Repositories) |
+---------------------+
- C# & .NET: Primary language and framework.
- Docker: Containerization via provided Dockerfile.
- Entity Framework Core: ORM for database interactions.
- xUnit: For unit testing.
- AutoMapper: Object-to-object mapping.
- Logging Framework: Integrated logging (e.g., Serilog, NLog) for monitoring and troubleshooting.
Before getting started, ensure you have the following installed:
- .NET SDK
- Docker (if you plan to run in a container)
- A code editor or IDE (e.g., Visual Studio Code)
Clone this repository to your local machine:
git clone https://github.com/jonathanperis/cpnucleo.git
cd cpnucleo
Restore the NuGet packages and build the solution:
dotnet restore
dotnet build
All configuration settings are located in the appsettings.json
file. Adjust connection strings and other environment-specific settings as needed.
To run the application locally, use the following command:
dotnet run --project WebApi
Alternatively, to build and run using Docker, execute:
docker build -t cpnucleo .
docker run -d -p 5000:80 cpnucleo
Run all tests using the following command:
dotnet test
Ensure that all tests pass and review the detailed test reports generated during the test run.
The project supports multiple deployment strategies including:
- Dockerized Deployment: Use the provided Dockerfile to package and deploy your application.
- Cloud Providers: Suitable for Azure App Services, AWS Elastic Beanstalk, and more.
- CI/CD Integration: Sample CI/CD configurations are included to facilitate automated pipelines.
We welcome contributions from the community! To contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Write tests for your changes.
- Submit a pull request with a detailed description of your changes.
This project is licensed under the MIT License. Feel free to use, modify, and distribute this software in accordance with the license terms.
Q: How do I encounter a build error?
A: Please review the error logs and ensure that all dependencies are correctly installed. Check the configuration files for any mismatches.
Q: How do I run tests?
A: Run dotnet test
in the root directory; detailed test results will be displayed in the terminal.
If you have any questions, issues, or would like to contribute, please open an issue on GitHub.
Stay connected:
- GitHub: jonathanperis/cpnucleo
- Bluesky: @jperis.bsky.social
- Inspiration from industry-leading projects and best practices.
- Contributions from the open-source community.
- Special thanks to all the developers and maintainers who helped shape this project.
Elevate your development process with Cpnucleo – where quality meets innovation.