README.md

April 29, 2026 · View on GitHub

GitHub license GitHub stars GitHub forks Visitors

A pragmatic .NET 8 framework for modular monoliths to evolve seamlessly into distributed microservices.

Why ADNC · Design Principles · Architecture · Getting Started · Documentation

简体中文 · English

What Is ADNC?

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.

Why ADNC

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 Monolith First – Design with strict boundaries from day one. Stop the "Big Ball of Mud" before it starts.
  • Strategic Evolution – Extract services only when scale justifies complexity. Distributed systems are a cost, not a feature.
  • Enterprise Infrastructure – Production-ready building blocks for .NET 8. Focus on business behavior, not plumbing.

Use ADNC when you need:

  • A Strategic Baseline: A pragmatic .NET 8 framework that balances simplicity and scalability.
  • Seamless Evolution: A path to evolve modular monoliths into distributed microservices without massive rewrites.
  • Architectural Discipline: Consistent infrastructure abstractions (Caching, Messaging, Auth) across services.
  • Production Realism: A demo including Gateway, Identity, CAP (Event Bus), SkyWalking (Tracing), and more.

ADNC is not:

  • A black-box platform that hides .NET application architecture.
  • A code generator that produces architecture without intent.
  • A microservice-only template that forces every bounded context to be deployed independently from day one.
  • A benchmark claim. Performance notes are scenario references, not guarantees.

Design Principles

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.

Architecture at a Glance

adnc-framework

At a high level, ADNC is organized into four parts:

LayerResponsibility
GatewayOcelot-based API gateway, routing, authentication integration, Consul provider, resilience policies
InfrastructureReusable packages for Consul, Redis, repositories, event bus, ID generation, helpers, and core primitives
Shared Service LayerCommon application, domain, repository, remote-call, and web API building blocks
Demo ServicesBusiness services that show layered, compact, and DDD-oriented service structures

Infrastructure Packages

The src/Infrastructures directory contains reusable packages under the Adnc.Infra.* namespace.

AreaProjects
Core primitivesAdnc.Infra.Core, Adnc.Infra.Helper
Service discovery and configurationAdnc.Infra.Consul
Event busAdnc.Infra.EventBus
ID generationAdnc.Infra.IdGenerater
RedisAdnc.Infra.Redis, Adnc.Infra.Redis.Caching
Repository abstractionAdnc.Infra.Repository
Repository implementationsAdnc.Infra.Repository.Dapper, Adnc.Infra.Repository.EfCore, Adnc.Infra.Repository.EfCore.MySql, Adnc.Infra.Repository.EfCore.SqlServer, Adnc.Infra.Repository.EfCore.MongoDB

ADNC infrastructure packages

Shared Service Packages

The src/ServiceShared directory contains reusable service-level building blocks under the Adnc.Shared.* namespace.

AreaProjects
Shared constants and contextAdnc.Shared
Application layerAdnc.Shared.Application, Adnc.Shared.Application.Contracts
Domain layerAdnc.Shared.Domain
Repository layerAdnc.Shared.Repository
Remote callsAdnc.Shared.Remote
Web API infrastructureAdnc.Shared.WebApi
ADNC shared service packages

Core Capabilities

CapabilityADNC Direction
API gatewayOcelot gateway with routing, Consul integration, authentication, and Polly support
Service discoveryConsul-based registration and discovery
ConfigurationLocal environment settings plus Consul-backed configuration center
Service communicationRefit-based HTTP clients and gRPC clients via Grpc.Net.ClientFactory
Event integrationCAP, RabbitMQ, integration event contracts, and event tracking support
PersistenceEF Core, Dapper, MySQL, SQL Server, and MongoDB-oriented infrastructure
TransactionsUnit of Work support and eventual consistency through CAP
CachingRedis provider, distributed cache abstraction, distributed locks, and Bloom filter support
SecurityJWT authentication, authorization helpers, shared web API infrastructure
ObservabilityNLog, Loki target, SkyAPM/SkyWalking, HealthChecks, Prometheus-related packages
ResiliencePolly-based transient fault handling at gateway and service-call boundaries
Engineering baselineCentral Package Management, shared build props, editor configuration, solution slicing

Technology Stack

CategoryTechnologies
Runtime.NET 8
GatewayOcelot
Registry and configurationConsul
Remote callsRefit, gRPC
PersistenceEF Core, Dapper, MySQL, SQL Server, MongoDB
Messaging and consistencyCAP, RabbitMQ
CacheRedis
ResiliencePolly
Logging and tracingNLog, Loki, SkyAPM, SkyWalking
Metrics and healthPrometheus packages, AspNetCore HealthChecks
API and validationSwashbuckle, FluentValidation
MappingAutoMapper

Repository Structure

adnc
├── .github/                   GitHub Actions workflows
├── database/                  Database initialization script
├── deploy/                    Docker Compose assets for staging-like infrastructure
├── docs/
│   ├── architecture/          Architecture decision records
│   └── wiki/                  English and Chinese documentation source
├── src/
│   ├── Infrastructures/       ADNC infrastructure packages
│   ├── ServiceShared/         Shared service-layer building blocks
│   ├── Gateways/              Ocelot gateway
│   └── Demo/                  Demo microservices
├── test/                      Test-related projects
├── README.md
├── README_ZH.md
└── LICENSE

Important Solutions

PathPurpose
src/Adnc.slnMain solution containing the ADNC framework projects
src/Infrastructures/Adnc.Infra.slnInfrastructure-only solution
src/ServiceShared/Adnc.Shared.slnShared service-layer solution
src/Demo/Adnc.Demo.slnDemo service solution
src/Gateways/Ocelot/Adnc.Ocelot.slnOcelot 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.

Getting Started

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.

  1. Install the .NET 8 SDK.
  2. Read the ADNC Quick Start Guide.
  3. Open src/Adnc.sln for framework packages or src/Demo/Adnc.Demo.sln for demo services.
  4. Prepare infrastructure from the quick start guide or the Docker Compose assets in deploy/staging.
  5. Initialize demo data from database/mysql/adnc.sql.
  6. Start the gateway and demo services in the documented order.

For Docker-oriented setup, use the Quick Docker Deployment Guide.

Demo Domain

The demo contains five business services and shared cross-service contracts. Each service uses a different structure to make the architectural trade-offs visible.

ServiceBusiness ScopeArchitecture Style
AdminOrganization, users, roles, permissions, dictionaries, and configurationClassic layered architecture with separated application contracts
MaintLogs, audits, and operations managementClassic layered architecture with contracts merged into the application layer
CustCustomer managementMinimal single-project service
OrdOrder managementDDD-style service with a domain layer
WhseWarehouse managementDDD-style service with a domain layer

Shared Contracts

src/Demo/Shared
├── Remote.Event/      Integration event contracts
├── Remote.Grpc/       gRPC client definitions
├── Remote.Http/       HTTP client definitions
├── protos/            gRPC protocol definitions
└── resources/         Shared configuration and resources

Service Layouts

Admin/
├── Api/
├── Application/
├── Application.Contracts/
└── Repository/

Maint/
├── Api/
├── Application/
└── Repository/

Cust/
└── Api/

Ord/
├── Api/
├── Application/
├── Domain/
└── Migrations/

Whse/
├── Api/
├── Application/
├── Domain/
└── Migrations/

Documentation

IndexTopic
01ADNC Project Tour: A Practical .NET 8 Implementation
02ADNC Quick Start Guide
03ADNC Quick Docker Deployment Guide
04ADNC Configuration Nodes Detailed Explanation
05ADNC Development Workflow
06ADNC Repository Layer Development Guide
07ADNC Service Layer Development Guide
08ADNC API Layer Development Guide
09ADNC Authentication and Authorization
10ADNC Repository Usage: Basic Functionality
11ADNC Repository Usage: Code First
12ADNC Repository Usage: Switching Database Types
13ADNC Repository Usage: Transactions and Unit of Work
14ADNC Repository Usage: Executing Raw SQL
15ADNC Repository Usage: Read/Write Splitting
16ADNC ID Generator: Snowflake Algorithm
17ADNC Cache: Redis, Distributed Locks, and Bloom Filters
18ADNC Inter-service Communication: HTTP with Refit
19ADNC Inter-service Communication: gRPC
20ADNC Inter-service Communication: Events with CAP
21ADNC Observability: Enabling SkyAPM and SkyWalking
22ADNC Configuration Center: Consul
23ADNC Service Registry: Consul

Ecosystem

Front-end

ADNC has a companion admin front-end built with Vue 3, Vite, TypeScript, and Element Plus.

ADNC exception log page

ADNC role management page

Performance Notes

The project includes JMeter-oriented notes from a demo environment covering gateway routing, service discovery, configuration center access, synchronous service calls, CRUD operations, local transactions, distributed transactions, caching, Bloom filters, tracing, logging, and operation logs.

Reference environment:

  • ECS server: 4 vCPU, 8 GB RAM, 8 Mbps bandwidth.
  • Approximate remaining capacity during testing: 50 percent CPU and 50 percent memory.
  • Observed throughput around 1000 requests per second, constrained by bandwidth.
  • Simulated concurrency: 1200 concurrent threads.
  • Read/write ratio: 7:3.

These numbers are environment-specific and should be treated as scenario notes, not benchmark guarantees.

Contributing

Issues, discussions, and pull requests are welcome. For larger changes, start by opening an issue that explains the problem, proposed direction, and expected impact on existing packages, demo services, or documentation.

When contributing code, try to preserve the project intent:

  • Keep infrastructure concerns reusable and service-agnostic.
  • Keep business behavior inside the relevant demo service.
  • Prefer established .NET ecosystem components over custom infrastructure unless there is a clear reason.
  • Update documentation when behavior, configuration, or startup flow changes.

Community

If ADNC helps you evaluate, teach, or build .NET distributed systems, consider giving the repository a star.

License

ADNC is released under the MIT License.