APIAPPINFRADOMAINCOMMON DOTNET SOLUTION KIT

A configurable dotnet new template and lifecycle toolkit for .NET 8 solutions on PostgreSQL or SQL Server. The template generates microservices with CI, deployment and tests, wired together; flags add the rest. The tool dotskit adds services and flags to a solution and upgrades it to a new version, keeping the team's code.

Настраиваемый шаблон dotnet new и инструмент сопровождения решений на .NET 8 с PostgreSQL или SQL Server. Шаблон генерирует связанные между собой микросервисы с CI, деплоем и тестами, остальное включается флагами. Инструмент dotskit добавляет в решение сервисы и флаги и обновляет его до новой версии, сохраняя код команды.

NuGetSawKing.DotNetSolutionKit NuGetSawKing.DotsKit.Tool

dotnet new DotNetSolutionKit -N MyCompany -P MyProduct -S Orders --Solution

Start with the business logic

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

Layers, errors, auth, logging, tests, Docker and CI are in place after the first command. The solution is an ordinary .NET project the team owns, and its first commit is about the product.

Слои, ошибки, авторизация, логи, тесты, Docker и CI на месте после первой команды. Решение - обычный .NET-проект, которым владеет команда, и её первый коммит уже про продукт.

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 добавляет его в решение сразу со слоями, ссылками, тестами и файлами деплоя.

A solution that keeps up. dotskit adds a service or a flag to an existing solution and upgrades it to a new version of the template, keeping the team's changes.

Решение не отстаёт. dotskit добавляет в готовое решение сервис или флаг и обновляет его до новой версии шаблона, сохраняя правки команды.

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 or Vault, object storage, ClickHouse, MongoDB, email, an audit journal, an API gateway - each is a flag, switched on when you need it.

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

Deployment included. 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, generated again from every release, and full-dev, generated from dev, where the next release is built. Each runs its own CI.

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

Try it in a minute

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

Install the template from nuget.org:

Установите шаблон с nuget.org:

dotnet new install SawKing.DotNetSolutionKit

The shared libraries, the solution and the first service:

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

dotnet new DotNetSolutionKit -N MyCompany -P MyProduct -S Orders --Solution

Every next service, by the template's short name dotskit:

Каждый следующий сервис, по короткому имени шаблона dotskit:

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

Or with dotskit, the template's tool, which also adds a flag to a service and upgrades a solution to a new version:

Или через dotskit, инструмент шаблона, который также добавляет флаг сервису и обновляет решение до новой версии:

dotnet tool install -g SawKing.DotsKit.Tool

dotskit new -N MyCompany -P MyProduct -S Orders

dotskit upgrade

🤗 What's new

🤗 Что нового

v2.8.0 dotskit keeps a solution up with the template, keeping the team's changes.

  • A solution keeps up with the template: dotskit adds services and flags to it and upgrades it to a new version, keeping the team's changes.
  • A service generated into a solution adds itself to All.sln.
  • Email by flag, with a sandbox that keeps a test stand from mailing real people.
  • MongoDB by flag, beside the main database.
  • Containers run on a read-only filesystem.
  • The test servers start with one command, the same on a developer's machine as in CI.
  • Coverage on demand, with a report per service.
  • The solution is generated with --Solution; -M false still works.
  • The template answers to the short name dotskit too: dotnet new dotskit.

v2.7.0 SQL Server, HashiCorp Vault and a stronger API gateway.

  • Generate a solution on SQL Server with --Database mssql.
  • Read secrets from HashiCorp Vault with --Vault.
  • Improved the API gateway and its Swagger documents.
  • Settings read on each use change without a redeploy.
  • Simplified feature flags.
  • Secrets live only in their store and in memory.

v2.6.2 Install the template from nuget.org.

  • The package has its own page on nuget.org.

v2.6.1 The first push of a generated solution passes the secret scan.

v2.6.0 Write a service's tests in NUnit or xUnit.

  • One shared test infrastructure for both.

v2.5.0 An audit journal of entity changes.

  • Changes are published through the outbox in the same transaction.
  • Guards catch writes the journal cannot see.

v2.4.0 Tokens in HttpOnly cookies with CSRF protection.

  • Cookie settings come from the deployment and are checked at startup.

v2.3.0 Services ride out a secret store outage.

  • A feature flag can be pinned in features.json.

v2.2.0 Commands a client may repeat run once per key.

v2.1.3 Two solutions on one host keep their own images.

v2.1.2 Blue-green deployment keeps serving when a deploy fails.

v2.1.1 Services are added to All.sln in CI too.

v2.1.0 Deployment, an API gateway, CI and one correlation identifier end to end.

  • Docker Compose or Kubernetes files, with blue-green deployment under Compose.
  • A YARP API gateway that validates the token once.
  • GitHub Actions CI with tests on real servers and a secret scan.
  • S3-compatible object storage and ClickHouse by flag.
  • Every dependency can be switched off in configuration.

v2.0.0 A layered microservice solution with a shared web host.

  • Domain events in three phases tied to the transaction.
  • Errors as RFC 9457 problems.
  • Permissions declared on actions and checked from the token.
  • Infrastructure by flag: Hangfire, MassTransit, Infisical, feature flags and more.

v1.0.0 The template before the breaking changes of 2026.

Every release on GitHubВсе релизы на GitHub

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.Название сервиса. Может быть с точками.
--SolutionfalseGenerates the solution: Common, All.sln and the root files, with the first service. Without it, only the service folder, into a solution already there.Генерирует решение: Common, All.sln и корневые файлы вместе с первым сервисом. Без него - только папка сервиса, в уже существующее решение.
-H, --HangfiretrueBackground jobs on Hangfire.Фоновые задачи на Hangfire.
--DatabasepostgresDatabase: postgres or mssql (SQL Server).СУБД: postgres или mssql (SQL Server).
--MessagingnoneMessage bus: outbox or direct.Шина сообщений: outbox или direct.
-I, --InfisicalfalseSecrets and settings from Infisical.Секреты и настройки из Infisical.
--VaultfalseSecrets and settings from HashiCorp Vault.Секреты и настройки из HashiCorp Vault.
--DiffApifalseAPI contract diff on pull requests.Дифф контракта API в пулл-реквестах.
--GitHubCiCdfalseCI on GitHub Actions: build, tests on real servers, coverage on demand, secret scan.CI на GitHub Actions: сборка, тесты на настоящих серверах, покрытие по запросу, поиск секретов.
--FeatureFlagsfalseFeature flags.Фича-флаги.
--HierarchyRulesfalseAccess rules over a tenant tree.Правила доступа по дереву тенантов.
--StoragefalseObject storage, S3-compatible.Объектное хранилище, совместимое с S3.
--ClickHousefalseClickHouse: connections, schema check, readiness.ClickHouse: подключения, проверка схемы, готовность.
--MongoDBfalseMongoDB beside the main database: the client, the service's database, readiness.MongoDB рядом с основной базой: клиент, база сервиса, готовность.
--NotifynoneнетChannels of notifications: email - through SMTP or Graph API, with a sandbox outside Production; with --Messaging other services ask for it by a bus command.Каналы уведомлений: email - через SMTP или Graph API, с песочницей вне Production; с --Messaging другие сервисы просят письмо командой шины.
--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, into a solution already there (without --Solution).API-шлюз на YARP вместо сервиса, в уже существующее решение (без --Solution).
--DeploycomposeDeployment files: compose, k8s or none.Файлы развёртывания: compose, k8s или none.
--AgentclaudeRules and skills for an AI agent: claude, opencode or none; with --Solution.Правила и скиллы для ИИ-агента: claude, opencode или none; с --Solution.
--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.