APIAPPINFRADOMAINCOMMON DOTNET SOLUTION KIT

A dotnet new template for .NET 8 and PostgreSQL. It creates the structure of a solution and the projects of its microservices, already wired together. The rest comes with flags.

Шаблон dotnet new для .NET 8 и PostgreSQL. Создаёт структуру решения и проекты микросервисов, уже связанные между собой. Остальное включается флагами.

dotnet new DotNetSolutionKit -N MyCompany -P MyProduct -S Orders -M false

Start with the business logic

Начните сразу с бизнес-логики

Setting up a new microservice usually eats a week: layers, errors, auth, logging, tests, Docker, CI. Here it takes one command, and the first commit is already the product.

Настройка нового микросервиса обычно съедает неделю: слои, ошибки, авторизация, логи, тесты, Docker, CI. Здесь это одна команда, и первый коммит уже про продукт.

A new service in one command. dotnet new adds it to the solution with its layers, references, tests and deployment files in place.

Новый сервис одной командой. dotnet new добавляет его в решение сразу со слоями, ссылками, тестами и файлами деплоя.

The boring part is done. Errors in one format, validation, authorization, health checks, background jobs and one request ID that follows a call through every service and log.

Рутина уже сделана. Ошибки в одном формате, валидация, авторизация, проверки здоровья, фоновые задачи и один ID запроса, который проходит через все сервисы и логи.

Only what you need. A message bus, secrets from Infisical, object storage, ClickHouse, an audit journal, an API gateway - each is a flag, switched on when you need it.

Только то, что нужно. Шина сообщений, секреты из Infisical, объектное хранилище, ClickHouse, журнал аудита, API-шлюз - каждое включается флагом, когда понадобится.

Ready for production. Docker images, compose or Kubernetes, blue-green deployment and CI on GitHub Actions with tests on a real database.

Готово к продакшену. Docker-образы, compose или Kubernetes, blue-green деплой и CI на GitHub Actions с тестами на настоящей базе.

See it before you use it. DotNetSolutionKit.Samples holds generated solutions to read through: the full kit, a single service, and a gateway with services.

Посмотрите до того, как взять. В DotNetSolutionKit.Samples лежат сгенерированные решения: полный комплект, один сервис и шлюз с сервисами.

Try it in a minute

Попробуйте за минуту

Download SawKing.DotNetSolutionKit.<version>.nupkg from the releases and install it:

Скачайте SawKing.DotNetSolutionKit.<version>.nupkg со страницы релизов и установите:

dotnet new install SawKing.DotNetSolutionKit.<version>.nupkg

The shared libraries, the solution and the first service:

Общие библиотеки, решение и первый сервис:

dotnet new DotNetSolutionKit -N MyCompany -P MyProduct -S Orders -M false

Every next service:

Каждый следующий сервис:

dotnet new DotNetSolutionKit -N MyCompany -P MyProduct -S Billing

Parameters

Параметры

ParameterПараметрDefaultПо умолчаниюWhat it doesЧто делает
-N, --NamespaceRootMyCompanyOrganization name, the root namespace. May be dotted.Название организации, корневое пространство имён. Может быть с точками.
-P, --ProductNameProductProduct name. May be dotted.Название продукта. Может быть с точками.
-S, --ServiceNameOrCustomServiceService name. May be dotted.Название сервиса. Может быть с точками.
-M, --Minimaltruetrue generates only the service folder, false the full kit.true создаёт только папку сервиса, false весь комплект.
-H, --HangfiretrueBackground jobs on Hangfire.Фоновые задачи на Hangfire.
--MessagingnoneMessage bus: outbox or direct.Шина сообщений: outbox или direct.
-I, --InfisicalfalseSecrets and settings from Infisical.Секреты и настройки из Infisical.
--DiffApifalseAPI contract diff on pull requests.Дифф контракта API в пулл-реквестах.
--GitHubCiCdfalseCI on GitHub Actions: build, tests on real servers, coverage, secret scan.CI на GitHub Actions: сборка, тесты на настоящих серверах, покрытие, поиск секретов.
--FeatureFlagsfalseFeature flags.Фича-флаги.
--HierarchyRulesfalseAccess rules over a tenant tree.Правила доступа по дереву тенантов.
--StoragefalseObject storage, S3-compatible.Объектное хранилище, совместимое с S3.
--ClickHousefalseClickHouse: connections, schema check, readiness.ClickHouse: подключения, проверка схемы, готовность.
--TestFrameworknunitTest framework of the service's tests: nunit or xunit (v3).Тестовый фреймворк тестов сервиса: nunit или xunit (v3).
--AuditfalseAudit journal of entity changes, through the outbox; with --Messaging outbox.Журнал аудита изменений сущностей, через outbox; с --Messaging outbox.
--ApiGatewayfalseAn API gateway on YARP in place of a service, with -M true.API-шлюз на YARP вместо сервиса, с -M true.
--DeploycomposeDeployment files: compose, k8s or none.Файлы развёртывания: compose, k8s или none.
--HttpPortfree portсвободный портPort in launchSettings.json and on the host under compose.Порт в launchSettings.json и на хосте под compose.

Details, dotted names and running locally: generating a solution.

Подробности, имена с точками и локальный запуск: генерация решения.

Documentation

Документация

Everything else is in the docs: the architecture, each feature, operations, the decisions behind the parts that depart from common practice, and the roadmap.

Всё остальное - в документации: архитектура, каждая возможность, эксплуатация, решения по тем частям, что отходят от общепринятой практики, и дорожная карта.

Version 2 is not compatible with version 1: do not apply it with --force over a solution generated from v1. How to move an existing solution: what changed in v2.

Версия 2 несовместима с версией 1: не накатывайте её с --force поверх решения из v1. Как перенести существующее решение: что изменилось в v2.

What each version brings: version.json and the releases. How versions are made: contributing.

Что приносит каждая версия: version.json и релизы. Как выпускаются версии: contributing.

License

Лицензия

This project is licensed under the MIT License. See the LICENSE file for details.

Проект распространяется по лицензии MIT. Подробности - в файле LICENSE.