{"id":31396240,"url":"https://github.com/nimanikoo/structura","last_synced_at":"2026-05-15T13:07:32.333Z","repository":{"id":316278399,"uuid":"1061289669","full_name":"nimanikoo/Structura","owner":"nimanikoo","description":"Structura is a modular .NET 10 Clean Architecture template that implements CQRS with MediatR, uses EF Core for data access, supports InMemory and PostgreSQL databases, includes validation and logging pipeline behaviors, and comes with ready-to-use unit tests for scalable and maintainable back-end development.","archived":false,"fork":false,"pushed_at":"2025-12-26T18:52:27.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-27T22:43:37.672Z","etag":null,"topics":["architecture","clean-architecture","dotnet","software-architecture","software-engineering","testing"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nimanikoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-21T16:13:04.000Z","updated_at":"2025-12-26T18:52:30.000Z","dependencies_parsed_at":"2025-09-23T18:28:51.100Z","dependency_job_id":null,"html_url":"https://github.com/nimanikoo/Structura","commit_stats":null,"previous_names":["nimanikoo/structura"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nimanikoo/Structura","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimanikoo%2FStructura","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimanikoo%2FStructura/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimanikoo%2FStructura/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimanikoo%2FStructura/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nimanikoo","download_url":"https://codeload.github.com/nimanikoo/Structura/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimanikoo%2FStructura/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33067521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architecture","clean-architecture","dotnet","software-architecture","software-engineering","testing"],"created_at":"2025-09-29T11:11:04.500Z","updated_at":"2026-05-15T13:07:32.327Z","avatar_url":"https://github.com/nimanikoo.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Structura\n[![.NET 10](https://img.shields.io/badge/.NET-10.0-blueviolet?style=for-the-badge\u0026logo=dotnet)](https://dotnet.microsoft.com/download/dotnet/10.0)\n[![Docker](https://img.shields.io/badge/Docker-Orchestrated-blue?style=for-the-badge\u0026logo=docker)](https://www.docker.com/)\n\n\n**Structura** is a sample back-end project implemented with **.NET 10**, demonstrating **Clean Architecture** principles along with **CQRS** and **MediatR** for command/query separation. It uses **Entity Framework Core** for data access and supports both **InMemory** and **PostgreSQL** databases. The project is designed to be modular, scalable, and easily reusable for future projects.\n\n---\n\n## Features\n\n* **Clean Architecture**\n  Clear separation of concerns across layers:\n\n  * **Domain**: Core entities and business rules\n  * **Application**: Commands, Queries, Validators, and Pipeline Behaviors\n  * **Infrastructure**: Repositories, DbContext, external services\n  * **API**: Web API endpoints\n\n* **CQRS + MediatR**\n  Command and Query responsibilities are fully separated. Handlers, Notifications, and Pipeline Behaviors (e.g., Logging, Validation) are implemented using **MediatR**.\n\n* **Validation \u0026 Logging Pipeline**\n  Requests are automatically validated using **FluentValidation** before reaching handlers. Logging behavior captures request and response flow for easier debugging.\n\n* **Flexible Database Configuration**\n\n  * **InMemory Database** for development and testing\n  * **PostgreSQL** for production use  \n    Configuration is environment-aware and automatically switches between databases.\n\n* **Unit Testing Ready**\n  Comprehensive **unit tests** are included for:\n\n  * Handlers\n  * Pipeline Behaviors\n  * Repositories using InMemory database\n\n* **Extensible \u0026 Reusable**\n  Designed to allow easy addition of new features, modules, or external integrations without violating Clean Architecture principles.\n\n---\n\n## Getting Started\n\n### Prerequisites\n\n* .NET 10 SDK\n* PostgreSQL (optional for production)\n\n### Running the Project\n\n1. Clone the repository:\n\n```bash\ngit clone git@github.com:nimanikoo/Structura.git\ncd Structura\n```\n\n2. Configure the connection string in `appsettings.json`:\n\n```json\n{\n  \"ConnectionStrings\": {\n    \"DefaultConnection\": \"Host=localhost;Database=structura;Username=postgres;Password=postgres\"\n  }\n}\n```\n\n3. Run the application:\n\n```bash\ndotnet run --project src/Structura.Api\n```\n\n4. The API will be available at `https://localhost:5182` (or `http://localhost:5182` for non-HTTPS).  \n   Swagger UI is enabled in Development mode at `/swagger/index.html`.\n\n## 🐳 Docker \u0026 Running in Container\n\nYou can run **Structura API** inside a Docker container with PostgreSQL or InMemory database.\n\n### 🚀 Build Docker Image\n\nFrom the root of the project (where `Dockerfile` is located):\n\n```bash\ndocker build -t structura-api .\n````\n\n### 🏃‍♂️ Run the Container\n\n```bash\ndocker run -d -p 5182:8080 -e ASPNETCORE_ENVIRONMENT=Development --name structura-api structura-api\n```\n\n* `-p 5182:8080` maps the container port 8080 to your local port 5182.\n* `-e ASPNETCORE_ENVIRONMENT=Development` ensures Swagger is enabled.\n\n### 🌐 Access Swagger UI\n\nAfter the container starts, open your browser:\n\n```\nhttp://localhost:5182/swagger/index.html\n```\n   \n\n---\n\n## Project Structure\n\n```\nStructura/\n│\n├─ src/\n│  ├─ Structura.Api/              # ASP.NET Core Web API\n│  ├─ Structura.Application/      # Application layer: Commands, Queries, Validators, Behaviors\n│  ├─ Structura.Domain/           # Domain entities and business rules\n│  └─ Structura.Infrastructure/   # Repositories, DbContext, database configuration\n│\n└─ tests/\n   └─ Structura.Tests/            # Unit tests for Handlers, Behaviors, Repositories\n```\n\n---\n\n## Key Patterns\n\n* **Pipeline Behaviors**: Middleware-like handlers for cross-cutting concerns (Logging, Validation)\n* **CQRS**: Separation of read and write operations\n* **Repository Pattern**: Abstraction over EF Core DbContext for cleaner data access\n* **Unit Testing**: InMemory EF Core used for isolated, fast, reliable tests\n\n---\n\n## Contributing\n\nThis project is designed to be reused and extended. Contributions are welcome via pull requests. Please follow Clean Architecture principles and write tests for new features.\n\n---\n\n## License\n\nThis project is licensed under the MIT License.\n\n**Created with ❤️ by [Nima Nikoo](https://github.com/nimanikoo)**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimanikoo%2Fstructura","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnimanikoo%2Fstructura","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimanikoo%2Fstructura/lists"}