Skip to content

Add tenant management module with multi-host resolution - #32

Merged
antosubash merged 3 commits into
mainfrom
claude/tenant-management-plan-7T0E7
Mar 30, 2026
Merged

antosubash merged 3 commits into
mainfrom
claude/tenant-management-plan-7T0E7

Conversation

@antosubash

@antosubash antosubash commented Mar 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • New Tenants module with full CRUD for tenants (name, slug, status, admin email, edition, connection string, validity period)
  • Multi-host support: each tenant can have multiple hostnames, resolved via TenantResolutionMiddleware (hostname → header → claim priority chain)
  • Implements ITenantContext from Core framework, enabling the built-in multi-tenant entity filtering (IMultiTenant, ApplyMultiTenantFilters) for all modules that opt in
  • Feature flags per tenant: extends OverrideType enum with Tenant = 2, adds tenant-level feature flag management UI and API endpoints
  • React pages: Browse, Manage, Create, Edit (with host management), Features (per-tenant flag toggles)
  • Seed data: 3 tenants with hosts for local development
  • 22 unit tests covering service CRUD, host management, and validators

Test plan

  • dotnet build — zero errors/warnings
  • dotnet test (Tenants 22/22, FeatureFlags 14/14, Products 39/39) — all pass
  • npm run build — frontend builds
  • npm run check — Biome lint/format clean
  • npm run validate-pages — all view endpoints registered
  • Manual: browse /tenants/manage, create/edit/delete tenants
  • Manual: add/remove hosts on Edit page
  • Manual: toggle feature flags per tenant on Features page
  • Manual: verify hostname-based tenant resolution sets correct context

@antosubash
antosubash force-pushed the claude/tenant-management-plan-7T0E7 branch from 74117d2 to 89eea29 Compare March 30, 2026 19:24
@antosubash antosubash changed the title Add Tenants module with multi-tenancy support Add tenant management module with multi-host resolution Mar 30, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 30, 2026 •

Copy link
Copy Markdown

Deploying simplemodule-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: ce20932
Status: ✅  Deploy successful!
Preview URL: https://cb25754c.simplemodule-website.pages.dev
Branch Preview URL: https://claude-tenant-management-pla.simplemodule-website.pages.dev

View logs

@antosubash
antosubash force-pushed the claude/tenant-management-plan-7T0E7 branch from 89eea29 to 6fbbe2a Compare March 30, 2026 19:27
…lag integration

- New Tenants module: CRUD for tenants with name, slug, status, admin email,
  edition, connection string, and validity period
- Multi-host support: each tenant can have multiple hostnames, resolved via
  TenantResolutionMiddleware (hostname → header → claim priority)
- Implements ITenantContext from Core, enabling the framework's built-in
  multi-tenant entity filtering for all modules that opt in
- Extends FeatureFlags OverrideType with Tenant (=2) so feature flags can be
  toggled per-tenant from the tenant management UI
- React pages: Browse, Manage, Create, Edit (with host management), Features
  (per-tenant feature flag toggles)
- Seed data: 3 tenants with hosts for local development
- 22 unit tests covering service CRUD, host management, and validators
- Remove unused Bogus dependency from production csproj
- Fix N+1 override queries: use Task.WhenAll for parallel flag override fetching
- Cache HostNameTenantResolver with GetOrCreateAsync to prevent thundering herd
- Lazy-cache ITenantContext resolution in FeatureFlagService (avoid per-call GetService)
- Strip sensitive fields from anonymous Browse endpoint (project only public fields)
- Reduce unnecessary Include(Hosts) in UpdateTenantAsync/ChangeStatusAsync
- Collapse GetTenantByHostNameAsync to single query via navigation property
- Remove unnecessary inline comments from TenantResolutionMiddleware
@antosubash
antosubash force-pushed the claude/tenant-management-plan-7T0E7 branch from 6fbbe2a to 760a967 Compare March 30, 2026 19:40
- Use CrudEndpoints.Delete in RemoveHostEndpoint instead of manual implementation
- Extract TenantFeatureHelper for shared override fetching logic (dedup 2 endpoints + 1 view)
- Import Tenant/TenantHost types from generated types.ts instead of redeclaring inline
- Extract statusLabels/statusColors to shared tenantStatus.ts
@antosubash
antosubash force-pushed the claude/tenant-management-plan-7T0E7 branch from 5bf0155 to ce20932 Compare March 30, 2026 20:25
@antosubash
antosubash merged commit 887fddf into main Mar 30, 2026
2 of 3 checks passed
antosubash added a commit that referenced this pull request Mar 30, 2026
The Tenants module (#32) landed after the Dockerfile rewrite (#36),
so its .csproj files were missing from the restore stage causing
docker build to fail with MSB4025.
antosubash added a commit that referenced this pull request Mar 30, 2026
The Tenants module (#32) landed after the Dockerfile rewrite (#36),
so its .csproj files were missing from the restore stage causing
docker build to fail with MSB4025.
@antosubash
antosubash deleted the claude/tenant-management-plan-7T0E7 branch April 1, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant