All Projects → AlphaYu → Adnc

AlphaYu / Adnc

Licence: mit
微服务框架,同时也适用于单体架构系统的开发。支持经典三层与DDD架构开发模式、集成了一系列主流稳定的微服务配套技术栈。一个前后端分离的框架,前端基于Vue、后端基于.Net Core 3.1构建。

Projects that are alternatives of or similar to Adnc

Go Api Boilerplate
Go Server/API boilerplate using best practices DDD CQRS ES gRPC
Stars: ✭ 373 (+67.26%)
Mutual labels:  microservices, restful, ddd
Ultimate Backend
Multi tenant SaaS starter kit with cqrs graphql microservice architecture, apollo federation, event source and authentication
Stars: ✭ 978 (+338.57%)
Mutual labels:  microservices, consul, ddd
Quiz
Example real time quiz application with .NET Core, React, DDD, Event Sourcing, Docker and built-in infrastructure for CI/CD with k8s, jenkins and helm
Stars: ✭ 100 (-55.16%)
Mutual labels:  microservices, dotnetcore, ddd
Cronus
Cronus is a lightweight framework for building event driven systems with DDD/CQRS in mind
Stars: ✭ 139 (-37.67%)
Mutual labels:  microservices, ddd
Mediator.net
A simple mediator for .Net for sending command, publishing event and request response with pipelines supported
Stars: ✭ 237 (+6.28%)
Mutual labels:  dotnetcore, ddd
Coolstore Microservices
A full-stack .NET microservices build on Dapr and Tye
Stars: ✭ 1,903 (+753.36%)
Mutual labels:  microservices, ddd
Designing Cloud Native Microservices On Aws
Introduce a fluent way to design cloud native microservices via EventStorming workshop, this is a hands-on workshop. Contains such topics: DDD, Event storming, Specification by example. Including the AWS product : Serverless Lambda , DynamoDB, Fargate, CloudWatch.
Stars: ✭ 131 (-41.26%)
Mutual labels:  microservices, ddd
Go Relax
Framework for building RESTful API's in Go
Stars: ✭ 155 (-30.49%)
Mutual labels:  microservices, restful
Interviews
A list of fancy questions I've been asked during the interviews I had. Some of them I ask when interviewing people.
Stars: ✭ 140 (-37.22%)
Mutual labels:  microservices, ddd
Event Sourcing Jambo
An Hexagonal Architecture with DDD + Aggregates + Event Sourcing using .NET Core, Kafka e MongoDB (Blog Engine)
Stars: ✭ 159 (-28.7%)
Mutual labels:  microservices, ddd
Kreta
Modern project management solution
Stars: ✭ 177 (-20.63%)
Mutual labels:  microservices, ddd
Todomvc Ddd Cqrs Eventsourcing
Implementation of basic Todo app via tastejs/todomvc in C#/Typescript with eventsourcing, cqrs, and domain driven design
Stars: ✭ 134 (-39.91%)
Mutual labels:  microservices, ddd
Hippo
💨A well crafted go packages that help you build robust, reliable, maintainable microservices.
Stars: ✭ 134 (-39.91%)
Mutual labels:  microservices, consul
Nlayerappv3
Domain Driven Design (DDD) N-LayeredArchitecture with .Net Core 2
Stars: ✭ 138 (-38.12%)
Mutual labels:  dotnetcore, ddd
Eventflow.example
DDD+CQRS+Event-sourcing examples using EventFlow following CQRS-ES architecture. It is configured with RabbitMQ, MongoDB(Snapshot store), PostgreSQL(Read store), EventStore(GES). It's targeted to .Net Core 2.2 and include docker compose file.
Stars: ✭ 131 (-41.26%)
Mutual labels:  dotnetcore, ddd
Dasync
Every developer deserves the right of creating microservices without using any framework 🤍
Stars: ✭ 154 (-30.94%)
Mutual labels:  microservices, ddd
Viennanet
Framework for quickly creating enterprise microservices on .NET Core https://habr.com/ru/company/raiffeisenbank/blog/516540/
Stars: ✭ 170 (-23.77%)
Mutual labels:  microservices, ddd
Eventstormingworkshop
EventStorming workshop, this is a hands-on workshop. Contains such topics: DDD, Event storming, Specification by example. Including the AWS product : Serverless Lambda , DynamoDB, Fargate, CloudWatch.
Stars: ✭ 184 (-17.49%)
Mutual labels:  microservices, ddd
Digital Restaurant
DDD. Event sourcing. CQRS. REST. Modular. Microservices. Kotlin. Spring. Axon platform. Apache Kafka. RabbitMQ
Stars: ✭ 222 (-0.45%)
Mutual labels:  microservices, ddd
Eshoponcontainersddd
Fork of dotnet-architecture/eShopOnContainers in full DDD/CQRS design using my own patterns
Stars: ✭ 126 (-43.5%)
Mutual labels:  microservices, ddd

Adnc是一个微服务开发框架 代码改变世界 开源活跃社区

    Adnc是一个轻量级的.Net Core微服务开发框架,同时也适用于单体架构系统的开发。支持经典三层与DDD架构开发模式、集成了一系列主流稳定的微服务配套技术栈。一个前后端分离的框架,前端基于Vue、后端基于.Net Core 3.1构建。Webapi遵循RESTful设计规范、基于JWT认证授权、基于Maxscale实现了读写分离、部署灵活、代码简洁、开箱即用、容器化微服务的最佳实践。

  • 用户中心:系统支撑服务,实现了用户管理、角色管理、权限管理、菜单管理、组织架构管理
  • 运维中心:系统支撑服务,实现了登录日志、审计日志、异常日志、字典管理、配置参数管理
  • 客户中心:经典三层开发模式demo
  • 订单中心:DDD开发模式demo
  • 仓储中心:DDD开发模式demo

演示

问题交流

  • 780634162(QQ群)

GitHub

文档

如何快速跑起来

如何手动部署到服务器

  • 详细介绍如何使用docker安装consul集群、使用consul注册中心、安装配置Skywalking,以及相关项目dockerfile文件编写和配置等。
    请点击链接,查看详细介绍

如何实现读写分离

如何使用EFCore仓储

目录结构

  • src
    • clientApp 前端项目(Vue)
    • serverApi 后端项目(.NET Core 3.1)
  • doc 项目相关文档(sql脚本、docker脚本、docker-compose.yaml文件)
  • tools 工具软件
  • test 测试工程

ClientApp

  • clientApp基于Vue-Element-Admin以及Web-Flash搭建,感谢两位作者。
  • 前端主要技术栈 Vue + Vue-Router + Vuex + Axios
  • 构建步骤
    # Install dependencies 
    npm install --registry=https://registry.npm.taobao.org
    # Serve with hot reload at localhost:5001
    npm run dev
    # Build for production with minification
    npm run build:prod
    
  • 界面 .NET微服务开源框架-异常日志界面 .NET微服务开源框架-角色管理界面

ServerApi

  • ServerApi基于.NET CORE 3.1搭建。
  • 后端主要技术栈
名称 描述
Ocelot 基于 .NET Core 编写的开源网关
Consul 配置中心、注册中心组件
Refit 一个声明式自动类型安全的RESTful服务调用组件,用于同步调用其他微服务
SkyAPM.Agent.AspNetCore Skywalking .NET Core探针,性能链路监测组件
AspNetCore.HealthChecks 健康监测组件,搭配consul的健康监测
Autofac IOC容器组件
Autofac.Extras.DynamicProxy Autfac AOP扩展
Pomelo.EntityFrameworkCore.MySql EFCore ORM组件
Dapper 轻量级ORM组件
Z.EntityFramework.Plus.EFCore 第三方高性能的EfCore组件
NLog 日志记录组件
AutoMapper 模型映射组件
Swashbuckle.AspNetCore APIs文档生成工具(swagger)
EasyCaching 实现了一、二级缓存管理的一个开源的组件
CAP 实现事件总线及最终一致性(分布式事务)的一个开源的组件
RabbitMq 异步消息队列组件
Polly 一个 .NET 弹性和瞬态故障处理库,允许开发人员以 Fluent 和线程安全的方式来实现重试、断路、超时、隔离和回退策略
FluentValidation 一个 .NET 验证框架,支持链式操作,易于理解,功能完善,组件内提供十几种常用验证器,可扩展性好,支持自定义验证器,支持本地化多语言
Maxscale Mariadb开发的一款成熟、高性能、免费开源的数据库中间件

后端解决方案

整体架构图

  • Adnc.Infras 基础架构相关工程
  • Adnc.Portal 微服务相关工程
  • Adnc.Tests 框架测试相关工程

.NET微服务开源框架-整体架构图

Adnc.Infras 基础架构相关工程

01.Adnc.WebApi.Shared

该层实现了认证、鉴权、异常捕获等公共类和中间件。所有微服务WebApi层的共享层,并且都需要依赖该层。
.NET微服务开源框架-webpai-shared层

02.Adnc.Application.Shared

该层定义了DTO对象的基类、Rpc服务通用服务、应用服务类基类以及操作日志拦截器。所有微服务Application层的共享层,并且都需要依赖该层。
.NET微服务开源框架-application-shared层

03.Adnc.Core.Shared

该层定义了Entity对象的基类、业务服务接口基类、UOW接口与拦截器、仓储接口、以及处理本地事务与分布式事务。所有微服务Core层的共享层,并且都需要依赖该层。
.NET微服务开源框架-core-shared层

04.Adnc.Infr.Common

该层实现了一些通用帮助类。该层不依赖任何层。
.NET微服务开源框架-基础机构-common层

10.Adnc.Infr.Gateway

该层是一个输出项目,基于Ocelot实现的Api网关,如果项目采用整体结构开发,该项目可以直接删除。ocelot网关包含路由、服务聚合、服务发现、认证、鉴权、限流、熔断、缓存、Header头传递等功能。市面上主流网关还有Kong,Traefik,Ambassador,Tyk等。
.NET微服务开源框架-基础机构-gateway层

11.Adnc.Infr.HealthCheckUI

该层是一个输出项目, AspNetCore.HealthChecks组件的Dashboard,直接配置需要监测的服务地址就可以了,没有代码,关键的代码参考webapi层的AddHealthChecks()方法。
.NET微服务开源框架-基础机构-healthchecksui层

20.Adnc.Infr.Consul

该层集成了Consul,提供服务的自动注册、发现以及系统配置读写。
.NET微服务开源框架-基础机构-cosnul层

21.Adnc.Infr.EasyCaching

该层集成了EasyCaching,负责一、二级缓存的管理,并重写了EasyCaching拦截器部分代码。
.NET微服务开源框架-基础机构-easycaching层

22.Adnc.Infr.EfCore

该层负责Adnc.Core.Shared仓储接口与Uow的EfCore的实现,负责mysql数据库的操作。同时也集成了Dapper部分接口,用来处理复杂查询。
.NET微服务开源框架-基础机构-efcore层

23.Adnc.Infr.Mongo

该层负责Adnc.Core.Shared仓储接口的Mongodb实现,负责mongodb数据库的操作。
.NET微服务开源框架-基础机构-mongodb层

23.Adnc.Infr.RabbitMq

该层集成了RabbitMq。封装了发布者与订阅者等公共类,方便更加便捷的调用rabbitmq。
.NET微服务开源框架-基础机构-rabbitmq层

Adnc.Portal 微服务相关工程

该目录都是具体微服务业务的实现。

  • Adnc.Usr 用户中心微服务,系统支撑服务,实现了用户管理、角色管理、权限管理、菜单管理、组织架构管理。
  • Adnc.Maint 运维中心微服务,系统支撑服务,实现了登录日志、审计日志、异常日志、字典管理、配置参数管理。
  • Adnc.Cus 客户中心微服务,经典三层开发模式demo。
  • Adnc.Ord 订单中心微服务,DDD开发模式demo。
  • Adnc.Whse 仓储中心微服务,DDD开发模式demo。

每个微服务的Migrations层是Efcore用来做数据迁移的,迁移的日志文件存放在各自Migrations目录中。
.NET微服务开源框架-微服务层

代码片段

    [Route("usr/session")]
    [ApiController]
    public class AccountController : ControllerBase
    {
        private readonly JWTConfig _jwtConfig;
        private readonly IAccountAppService _accountService;
        private readonly ILogger<AccountController> _logger;

        public AccountController(IOptionsSnapshot<JWTConfig> jwtConfig
            , IAccountAppService accountService
            , ILogger<AccountController> logger)
        {
            _jwtConfig = jwtConfig.Value;
            _accountService = accountService;
            _logger = logger;
        }

        /// <summary>
        /// 登录/验证
        /// </summary>
        /// <param name="userDto"><see cref="UserValidateInputDto"/></param>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost()]
        public async Task<UserTokenInfoDto> Login([FromBody]UserValidateInputDto userDto)
        {
            var userValidateDto = await _accountService.Login(userDto);

            return new UserTokenInfoDto
            {
                Token = JwtTokenHelper.CreateAccessToken(_jwtConfig, userValidateDto),
                RefreshToken = JwtTokenHelper.CreateRefreshToken(_jwtConfig, userValidateDto)
            };
        }
    }
    public class AccountAppService : IAccountAppService
    {
        private readonly IMapper _mapper;
        private readonly IEfRepository<SysUser> _userRepo;
        private readonly RabbitMqProducer _mqProducer;
        public AccountAppService(IMapper mapper,
            IEfRepository<SysUser> userRepo,
            RabbitMqProducer mqProducer)
        {
            _mapper = mapper;
            _userRepo = userRepo;
            _mqProducer = mqProducer;
        }

        public async Task<UserValidateDto> Login(UserValidateInputDto inputDto)
        {
            var user = await _userRepo.FetchAsync(x => new { x.Password, x.Salt, x.Name, x.Email, x.RoleId,x.Account,x.ID,x.Status }
            , x => x.Account == inputDto.Account);
            //todo......
            //..........
            _mqProducer.BasicPublish(MqConsts.Exchanges.Logs, MqConsts.RoutingKeys.Loginlog, log);
            return _mapper.Map<UserValidateDto>(user);
        }
    }

下一步计划

  • 完善框架文档。
  • 优化现有功能
  • 开发微服务项目生成工具
  • 集成Quartz.Net实现框架计划调度功能。

问题交流

License

MIT
Free Software, Hell Yeah!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].