var c=Object.defineProperty;var r=(n)=>n;function l(n,a){this[n]=r.bind(null,a)}var p=(n,a)=>{for(var i in a)c(n,i,{get:a[i],enumerable:!0,configurable:!0,set:l.bind(a,i)})};var u=(n,a)=>()=>(n&&(a=n(n=0)),a);import{CodeBlock as d}from"@contractspec/lib.design-system";import o from"@contractspec/lib.ui-link";import{ChevronRight as s}from"lucide-react";import{jsx as e,jsxs as t}from"react/jsx-runtime";function y(){return t("div",{className:"space-y-8",children:[t("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"Multi-Tenancy"}),e("p",{className:"text-muted-foreground",children:"ContractSpec is designed from the ground up for multi-tenancy. Apps built with ContractSpec can serve multiple organizations (tenants) from a single deployment, while ensuring strict data isolation and configuration separation."})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Core Concepts"}),t("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[t("li",{children:[e("strong",{children:"Tenant"}),": An organization or customer that uses your app. Each tenant has a unique ",e("code",{children:"tenantId"}),"."]}),t("li",{children:[e("strong",{children:"Tenant Isolation"}),": Data and configuration for one tenant is never accessible to another tenant unless explicitly shared."]}),t("li",{children:[e("strong",{children:"Tenant Context"}),": Every request and operation runs within the context of a specific tenant."]})]})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Tenant Resolution"}),e("p",{className:"text-muted-foreground",children:"The runtime automatically resolves the tenant context for every request based on:"}),t("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[t("li",{children:["Subdomain (e.g., ",e("code",{children:"acme.app.com"}),")"]}),t("li",{children:["Custom Domain (e.g., ",e("code",{children:"portal.acme.com"}),")"]}),t("li",{children:["Header (e.g., ",e("code",{children:"x-tenant-id: acme-corp"}),")"]}),e("li",{children:"Authentication Token (embedded tenant claim)"})]})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Configuration Isolation"}),t("p",{className:"text-muted-foreground",children:["Each tenant has its own ",e("code",{children:"TenantAppConfig"})," which defines:"]}),e(d,{language:"typescript",code:`type TenantAppConfig = {
  tenantId: string;
  blueprintId: string;
  // ...
  integrationBindings: AppIntegrationBinding[];
  knowledgeBindings: AppKnowledgeBinding[];
  featureFlags: Record<string, boolean>;
};`}),e("p",{className:"mt-2 text-muted-foreground",children:"This allows you to customize feature flags, integration connections, and knowledge sources per tenant without changing the application code."})]}),t("div",{className:"flex items-center gap-4 pt-4",children:[e(o,{href:"/docs/architecture",className:"btn-ghost",children:"Back to Architecture"}),t(o,{href:"/docs/libraries/multi-tenancy",className:"btn-primary",children:["Multi-Tenancy Library ",e(s,{size:16})]})]})]})}export{y as ArchitectureMultiTenancyPage};
