An open API service indexing awesome lists of open source software.

https://github.com/jonathanperis/cpnucleo

This sample solution demonstrates modern .NET best practices—featuring clean architecture, robust testing, dependency injection, and Docker containerization—to help you build scalable, maintainable applications.
https://github.com/jonathanperis/cpnucleo

best-practices chsarp clean-architecture clean-code code-quality continuous-integration dependency-injection devops docker dotnet integration-testing sample-solution software-architecture solid-principles unit-testing

Last synced: 20 days ago
JSON representation

This sample solution demonstrates modern .NET best practices—featuring clean architecture, robust testing, dependency injection, and Docker containerization—to help you build scalable, maintainable applications.

Awesome Lists containing this project

README

        

# Cpnucleo

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.

---

## Table of Contents

- [Introduction](#introduction)
- [Project Overview](#project-overview)
- [Key Features](#key-features)
- [Architecture](#architecture)
- [Technologies Used](#technologies-used)
- [Prerequisites](#prerequisites)
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Configuration](#configuration)
- [Building and Running](#building-and-running)
- [Testing](#testing)
- [Deployment](#deployment)
- [Contribution Guidelines](#contribution-guidelines)
- [License](#license)
- [Troubleshooting & FAQ](#troubleshooting--faq)
- [Contact & Support](#contact--support)
- [Acknowledgements](#acknowledgements)

---

## Introduction

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.

---

## Project Overview

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

---

## Key Features

- **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.

---

## Architecture

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) |
+---------------------+
```

---

## Technologies Used

- **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.

---

## Prerequisites

Before getting started, ensure you have the following installed:

- [.NET SDK](https://dotnet.microsoft.com/download/dotnet)
- [Docker](https://www.docker.com/get-started) (if you plan to run in a container)
- A code editor or IDE (e.g., [Visual Studio Code](https://code.visualstudio.com/))

---

## Getting Started

Clone this repository to your local machine:

```bash
git clone https://github.com/jonathanperis/cpnucleo.git
cd cpnucleo
```

### Installation

Restore the NuGet packages and build the solution:

```bash
dotnet restore
dotnet build
```

### Configuration

All configuration settings are located in the `appsettings.json` file. Adjust connection strings and other environment-specific settings as needed.

---

## Building and Running

To run the application locally, use the following command:

```bash
dotnet run --project WebApi
```

Alternatively, to build and run using Docker, execute:

```bash
docker build -t cpnucleo .
docker run -d -p 5000:80 cpnucleo
```

---

## Testing

Run all tests using the following command:

```bash
dotnet test
```

Ensure that all tests pass and review the detailed test reports generated during the test run.

---

## Deployment

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.

---

## Contribution Guidelines

We welcome contributions from the community! To contribute:

1. **Fork** the repository.
2. **Create a new branch** for your feature or bugfix.
3. **Write tests** for your changes.
4. **Submit a pull request** with a detailed description of your changes.

---

## License

This project is licensed under the [MIT License](LICENSE). Feel free to use, modify, and distribute this software in accordance with the license terms.

---

## Troubleshooting & FAQ

**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.

---

## Contact & Support

If you have any questions, issues, or would like to contribute, please open an issue on GitHub.

Stay connected:

- **GitHub:** [jonathanperis/cpnucleo](https://github.com/jonathanperis/cpnucleo)
- **Bluesky:** [@jperis.bsky.social](https://bsky.app/profile/jperis.bsky.social)

---

## Acknowledgements

- 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.