Juudini GitHub avatar

saas_core_engine

Juudini

A .NET 10 building block for database-per-tenant multi-tenancy with dynamic connection resolution, JWT tenant-claim validation, three-layer caching, plan-based feature flags and quotas, per-tenant resilience, and a migration tool.

Stars

8

7-day growth

No data

Forks

0

Open issues

0

License

No data

Last updated

2026-07-30

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It offers a complete, production-ready multi-tenancy solution for .NET 10, including tenant-aware JWT, three-layer cache, and per-tenant circuit breaker, with a documented design rationale and a verified end-to-end flow.

Who it is for

  • .NET developers building multi-tenant SaaS applications
  • Architects designing tenant isolation strategies
  • DevOps engineers managing per-tenant database deployments
  • Teams requiring plan-based feature toggles and usage quotas

Use cases

  • Building a multi-tenant SaaS backend with isolated databases per tenant
  • Dynamically resolving and caching tenant-specific database connections
  • Running tenant database migrations with per-tenant failure isolation
  • Implementing plan-based feature flags and rate limits

Strengths

  • Complete solution with a detailed design document (SDD.md)
  • Verified end-to-end flow with step-by-step instructions (cold start) and all tests passing (11 unit, 39 integration)
  • Includes per-tenant resilience with configurable timeout and circuit breaker patterns
  • Provides a migration tool that isolates failures per tenant and supports dry-run preview

Considerations

  • Containerized API cannot use the seeded demo tenants because DbHost is hardcoded to 'localhost' (only works when running on host with Docker's published ports)
  • Automatic testing of the circuit breaker and /health/tenants circuit state is not yet implemented
  • EF Core 10 does not wrap a tenant's full migration batch in a transaction, so partial-batch failures require manual schema inspection

README quick start

SaaS Multi-Tenant Isolation Engine

A Database-per-Tenant multi-tenancy building block for .NET 10: dynamic per-tenant connection resolution, JWT authentication with tenant-claim cross-checking, a three-layer tenant metadata cache, plan-based feature flags/quotas, per-tenant resilience (timeout + circuit breaker), and a migration tool with per-tenant failure isolation.

See docs/SDD.md for the full design rationale.

Solution layout

src/BuildingBlocks/BuildingBlocks.MultiTenancy/   Reusable multi-tenancy plumbing (no DB dependency)
src/Services/Catalog.Admin/                       Central catalog: Plan/Tenant/PlanFeature/PlanQuota + EF store
src/Services/SaaS.CoreEngine.Api/                 The tenant-facing API (billing domain demo: Customer/Product/Invoice)
src/Tools/Tools.DbMigrator/                        Sweeps active tenants and applies pending migrations
tests/BuildingBlocks.MultiTenancy.UnitTests/       Pure unit tests, no Docker required
tests/SaaS.CoreEngine.IntegrationTests/            Testcontainers-backed integration tests (require Docker)
docker/postgres-tenants/init/                      First-boot script creating the demo tenant databases
docker-compose.yml                                 Local dev stack: postgres-central, postgres-tenants, redis, api

Prerequisites

  • .NET SDK 10.0+
  • Docker Desktop (for docker compose and for the Testcontainers-backed integration tests)
  • dotnet-ef global tool (dotnet tool install --global dotnet-ef), matching the EF Core version pinned in Directory.Packages.props

Cold start (verified flow)

This is the exact sequence that was run and verified end-to-end for this repository. It runs the API and Tools.DbMigrator on the host via dotnet run, with Postgres and Redis provided by docker-compose — not the containerized api service (see "Known limitation" below).

# 1. Copy the environment template (edit if you need non-default ports/credentials)
Copy-Item .env.example .env

# 2. Start Postgres (catalog + tenants cluster) and Redis
docker compose up -d postgres-central postgres-tenants redis

# 3. Wait for all three to report healthy
docker compose ps

# 4. Apply the catalog migration
$env:DOTNET_CATALOG_CONNECTION = "Host=localhost;Port=5433;Database=saas_catalog;Username=postgres;Password=postgres"
dotnet ef database update --project src/Se

Description

Database-per-Tenant multi-tenancy engine for .NET 10 — dynamic per-tenant connection resolution, JWT auth with tenant-claim cross-checking, plan-based feature flags/quotas, per-tenant resilience (circuit breaker + bulkhead), and a zero-downtime migration tool.

Related repositories

Similar projects matched by category, topics, and programming language.

programmersd21
Featured
programmersd21 GitHub avatar

flow

flow is a minimalist terminal dashboard that displays real-time network throughput with smooth animations, multiple responsive modes, and zero configuration.

Developer ToolsCLI & Terminal
277
S40911120
Featured
S40911120 GitHub avatar

recensa

Recensa is a self-hosted web viewer that indexes Claude Code session transcripts into a local SQLite database, enabling full-text search, replay, and audit of all past agent conversations without uploading data anywhere.

AI & Machine LearningLarge Language Models
67
0xwilliamortiz
Featured
0xwilliamortiz GitHub avatar

openclaude-improved

OpenClaude is an open-source CLI coding agent that runs on any platform and supports a wide range of LLM providers, offering the same tools and workflows as Claude Code.

AI & Machine LearningLarge Language Models
577