A pragmatic .NET 8 framework for modular monoliths to evolve seamlessly into distributed microservices.
A pragmatic .NET 8 framework for modular monoliths to evolve seamlessly into distributed microservices.
A pragmatic .NET 8 framework for modular monoliths to evolve seamlessly into distributed microservices.
Why ADNC · Design Principles · Architecture · Getting Started · Documentation
简体中文 · English
ADNC is an open-source .NET 8 framework for building modular business systems that can evolve from modular monoliths into distributed microservices. It brings together the infrastructure, conventions, and sample services that teams typically need when building production-grade systems: gateway routing, service discovery, centralized configuration, authentication, inter-service communication, event-driven integration, persistence, caching, observability, resilience, and deployment support.
The repository is both a framework and a working reference implementation. It includes reusable Adnc.Infra.* packages, shared service-layer packages, an Ocelot gateway, a multi-service demo domain, database scripts, Docker Compose infrastructure assets, and English/Chinese documentation.
ADNC is intentionally not a one-size-fits-all template. It demonstrates how different service shapes can coexist in the same system: classic layered services, compact single-project services, and DDD-style services with explicit domain layers.
Distributed systems fail most often at the boundaries. Service ownership, data consistency, configuration drift, and integration contracts are where real complexity lies. ADNC focuses on solving these boundary challenges rather than just scaffolding simple controllers and repositories.
ADNC is built on three core pillars:
Modular first, distributed when necessary Service boundaries should be explicit before deployment boundaries become expensive. ADNC helps teams establish clear modular boundaries first and introduce distributed deployment only when it is actually needed.
Different domains deserve different shapes A simple CRUD service shouldn't be forced into the same complexity as a domain-heavy service. ADNC promotes informed trade-offs across different project styles.
Shared Infrastructure, Owned Business Logic Cross-cutting concerns (Caching, Repositories, Events, Logging) are centralized in reusable building blocks. Business logic remains pure and isolated within service-specific Application and Domain layers.
Operational concerns are first-class citizens Configuration, Tracing, Gateway routing, and HealthChecks are treated as core architectural requirements, not operational afterthoughts.
Prefer replaceable integrations over reinvention ADNC orchestrates the best of the .NET ecosystem—Consul, Cap, EF Core, Dapper, Redis, SkyAPM—behind consistent conventions rather than reinventing the wheel.
At a high level, ADNC is organized into four parts:
| Layer | Responsibility |
|---|---|
| Gateway | Ocelot-based API gateway, routing, authentication integration, Consul provider, resilience policies |
| Infrastructure | Reusable packages for Consul, Redis, repositories, event bus, ID generation, helpers, and core primitives |
| Shared Service Layer | Common application, domain, repository, remote-call, and web API building blocks |
| Demo Services | Business services that show layered, compact, and DDD-oriented service structures |
The src/Infrastructures directory contains reusable packages under the Adnc.Infra.* namespace.
| Area | Projects |
|---|---|
| Core primitives | Adnc.Infra.Core, Adnc.Infra.Helper |
| Service discovery and configuration | Adnc.Infra.Consul |
| Event bus | Adnc.Infra.EventBus |
| ID generation | Adnc.Infra.IdGenerater |
| Redis | Adnc.Infra.Redis, Adnc.Infra.Redis.Caching |
| Repository abstraction | Adnc.Infra.Repository |
| Repository implementations | Adnc.Infra.Repository.Dapper, Adnc.Infra.Repository.EfCore, Adnc.Infra.Repository.EfCore.MySql, Adnc.Infra.Repository.EfCore.SqlServer, Adnc.Infra.Repository.EfCore.MongoDB |
adnc.infraThe src/ServiceShared directory contains reusable service-level building blocks under the Adnc.Shared.* namespace.
| Area | Projects |
|---|---|
| Shared constants and context | Adnc.Shared |
| Application layer | Adnc.Shared.Application, Adnc.Shared.Application.Contracts |
| Domain layer | Adnc.Shared.Domain |
| Repository layer | Adnc.Shared.Repository |
| Remote calls | Adnc.Shared.Remote |
| Web API infrastructure | Adnc.Shared.WebApi |
| Capability | ADNC Direction |
|---|---|
| API gateway | Ocelot gateway with routing, Consul integration, authentication, and Polly support |
| Service discovery | Consul-based registration and discovery |
| Configuration | Local environment settings plus Consul-backed configuration center |
| Service communication | Refit-based HTTP clients and gRPC clients via Grpc.Net.ClientFactory |
| Event integration | CAP, RabbitMQ, integration event contracts, and event tracking support |
| Persistence | EF Core, Dapper, MySQL, SQL Server, and MongoDB-oriented infrastructure |
| Transactions | Unit of Work support and eventual consistency through CAP |
| Caching | Redis provider, distributed cache abstraction, distributed locks, and Bloom filter support |
| Security | JWT authentication, authorization helpers, shared web API infrastructure |
| Observability | NLog, Loki target, SkyAPM/SkyWalking, HealthChecks, Prometheus-related packages |
| Resilience | Polly-based transient fault handling at gateway and service-call boundaries |
| Engineering baseline | Central Package Management, shared build props, editor configuration, solution slicing |
| Category | Technologies |
|---|---|
| Runtime | .NET 8 |
| Gateway | Ocelot |
| Registry and configuration | Consul |
| Remote calls | Refit, gRPC |
| Persistence | EF Core, Dapper, MySQL, SQL Server, MongoDB |
| Messaging and consistency | CAP, RabbitMQ |
| Cache | Redis |
| Resilience | Polly |
| Logging and tracing | NLog, Loki, SkyAPM, SkyWalking |
| Metrics and health | Prometheus packages, AspNetCore HealthChecks |
| API and validation | Swashbuckle, FluentValidation |
| Mapping | AutoMapper |
…| Path | Purpose |
|---|---|
src/Adnc.sln |
Main solution containing the ADNC framework projects |
src/Infrastructures/Adnc.Infra.sln |
Infrastructure-only solution |
src/ServiceShared/Adnc.Shared.sln |
Shared service-layer solution |
src/Demo/Adnc.Demo.sln |
Demo service solution |
src/Gateways/Ocelot/Adnc.Ocelot.sln |
Ocelot gateway solution |
Build configuration is centralized through:
src/Directory.Build.props: shared build settings, including net8.0, nullable reference types, implicit usings, package metadata, and documentation generation.src/Directory.Packages.props: Central Package Management for NuGet versions.src/.editorconfig: cross-editor code style configuration.The fastest way to get started is to follow the quick start guide. The demo requires infrastructure such as Consul, Redis, RabbitMQ, MySQL, logging components, and service configuration, so the startup sequence matters.
.NET 8 SDK.src/Adnc.sln for framework packages or src/Demo/Adnc.Demo.sln for demo services.deploy/staging.database/mysql/adnc.sql.For Docker-oriented setup, use the Quick Docker Deployment Guide.
The demo contains five business services and shared cross-service contracts. Each service uses a different structure to make the architectural trade-offs visible.
| Service | Business Scope | Architecture Style
No open issues yet, or sync has not completed.