mdxui

Execution Contexts

The .as domain system for URL-based polymorphism

Execution Contexts

Core Insight: The .as domains provide execution contexts that determine HOW an entity renders.

{context}.as/{$id}

The .as literally means "as a" - rendering the entity as that type.


URL Polymorphism

The same entity renders differently based on context:

stripe.com                    # Stripe's own site
site.as/stripe.com           # Stripe as generic Site
docs.as/stripe.com           # Stripe as DocsSite
agent.as/stripe.com          # Stripe's Agent interface
saas.as/stripe.com           # Stripe as SaaSApp
marketplace.as/stripe.com    # Stripe as MarketplaceSite
sdk.as/stripe.com            # Stripe's SDK documentation

The pattern:

{how}.as/{what}

docs.as/my-startup.com    = "my-startup.com AS docs"
agent.as/my-startup.com   = "my-startup.com AS agent"
saas.as/my-startup.com    = "my-startup.com AS saas"

Context Domains

Site Contexts

DomainContext TypeRenders Entity As
site.asSiteGeneric site
page.asPageSingle page
pages.asPagesMulti-page site
blogs.asBlogSiteBlog with posts
docs.asDocsSiteDocumentation
wiki.asWikiSiteWiki/knowledge base
directories.asDirectorySiteDirectory listing
marketplace.asMarketplaceSiteMarketplace
videos.asVideoSiteVideo content
waitlist.asWaitlistPageWaitlist/signup
forms.asFormPageForm/survey

App Contexts

DomainContext TypeRenders Entity As
apps.asAppGeneric app
saas.asSaaSAppSaaS dashboard
database.asAdminAppDatabase editor
functions.asFunctionsAppServerless functions
workflows.asWorkflowAppWorkflow automation
webhooks.asWebhooksAppWebhook management
queue.asQueueAppTask queue

AI/Agent Contexts

DomainContext TypeRenders Entity As
agent.asAgentSiteAgent interface
agi.asAGISiteAGI agent
gpts.asGPTSiteGPT agent
assistant.asAssistantAppAssistant UI
task.asTaskAppTask execution

Development Contexts

DomainContext TypeRenders Entity As
sdk.asSDKSiteSDK documentation
mdx.asMDXRendererRaw MDX rendering
src.asSourceViewSource code viewer
proxy.asProxyServiceProxy/API gateway

Meta Contexts

DomainContext TypeRenders Entity As
ctx.asContextContext provider (meta)
ing.asActivityActivity/gerund view

The Activity Context (ing.as)

The ing.as domain renders the activity view of any action. Remember the Verb grammar:

Verb PropertyExample
activitycreating, approving, deploying

So ing.as shows live activity/progress:

ing.as/creating/mystartup.com     # "Creating mystartup.com" - live progress
ing.as/deploying/my-api           # "Deploying my-api" - deployment status
ing.as/approving/invoice-123      # "Approving invoice-123" - approval flow

This renders the gerund form of any action being performed on an entity.


Studios vs Contexts vs Management

The domain system has three layers:

Studios (.studio) - Create & Manage

Where you create and manage businesses:

StudioDomainPurpose
Startups.Studiostartups.studioVenture studio - portfolio of startups
SaaS.Studiosaas.studioSaaS builder - create SaaS products
Services.Studioservices.studioServices builder - create service businesses
Management.Studiomanagement.studioBusiness ops - manage any business

Contexts (.as) - Render As

How entities render in different contexts:

# Same entity, different contexts
site.as/acme.com      # Acme as a Site
docs.as/acme.com      # Acme as Docs
agent.as/acme.com     # Acme as Agent
saas.as/acme.com      # Acme as SaaS App

Management (.management) - Operate At Scale

Platforms for operating at scale:

PlatformDomainPurpose
API.Managementapi.managementManage APIs across products
Agents.Managementagents.managementManage AI agent fleets

Architecture Diagram

┌─────────────────────────────────────────────────────────────┐
│  STUDIOS (.studio) - Create & Manage                        │
│  ┌─────────────┐ ┌─────────────┐ ┌─────────────┐           │
│  │ Startups    │ │ SaaS        │ │ Services    │           │
│  │ .Studio     │ │ .Studio     │ │ .Studio     │           │
│  └──────┬──────┘ └──────┬──────┘ └──────┬──────┘           │
│         │               │               │                   │
│         └───────────────┼───────────────┘                   │
│                         ▼                                   │
│              ┌─────────────────────┐                        │
│              │  Business ($id)     │                        │
│              │  e.g. acme.com      │                        │
│              └──────────┬──────────┘                        │
└─────────────────────────┼───────────────────────────────────┘
                          │
┌─────────────────────────┼───────────────────────────────────┐
│  CONTEXTS (.as) - Render As                                 │
│                         ▼                                   │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  site.as/acme.com        → Site                     │   │
│  │  docs.as/acme.com        → DocsSite                 │   │
│  │  blogs.as/acme.com       → BlogSite                 │   │
│  │  agent.as/acme.com       → AgentSite                │   │
│  │  saas.as/acme.com        → SaaSApp                  │   │
│  │  apps.as/acme.com        → App                      │   │
│  │  sdk.as/acme.com         → SDKSite                  │   │
│  │  workflows.as/acme.com   → WorkflowApp              │   │
│  └─────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘
                          │
┌─────────────────────────┼───────────────────────────────────┐
│  MANAGEMENT (.management) - Operate At Scale                │
│                         ▼                                   │
│  ┌─────────────┐ ┌─────────────┐ ┌─────────────┐           │
│  │ API         │ │ Agents      │ │ Management  │           │
│  │ .Management │ │ .Management │ │ .Studio     │           │
│  └─────────────┘ └─────────────┘ └─────────────┘           │
└─────────────────────────────────────────────────────────────┘

The Complete URL Architecture

A single business exists across all domain patterns:

acme.com (the business $id)
│
├── STUDIOS (where you build/configure)
│   {entity}.{studio}.studio
│   ├── acme.startups.studio    → Startup lifecycle
│   ├── acme.saas.studio        → Product builder
│   ├── acme.services.studio    → Service builder
│   └── acme.management.studio  → Operations
│
├── CONTEXTS (where users experience)
│   {context}.as/{$id}
│   ├── site.as/acme.com        → Marketing site
│   ├── docs.as/acme.com        → Documentation
│   ├── agent.as/acme.com       → Agent interface
│   ├── saas.as/acme.com        → SaaS app
│   └── sdk.as/acme.com         → SDK docs
│
├── ACTIVITIES (where work happens)
│   {object}.{verb}.ing.as/{context}/{role}
│   ├── ticket.triag.ing.as/acme/support
│   ├── invoice.approv.ing.as/acme/finance
│   └── code.review.ing.as/acme/developer
│
└── MANAGEMENT (where you operate at scale)
    {domain}.management.studio/{entity}
    ├── apis.management.studio/acme
    └── agents.management.studio/acme

Pattern Summary

LayerPatternExample
Studios{entity}.{studio}.studioacme.saas.studio
Contexts{context}.as/{$id}docs.as/acme.com
Activities{object}.{verb}.ing.as/{context}/{role}invoice.approv.ing.as/acme/manager
Management{domain}.management.studio/{entity}apis.management.studio/acme

Implementation

When a request comes to {context}.as/{$id}:

  1. Resolve the entity - Fetch the MDXLD document for $id
  2. Determine the context - Map the .as domain to a Site/App type
  3. Render with context - Use the appropriate components for that type
// Pseudocode
async function handleRequest(url: URL) {
  const context = getContextFromDomain(url.host) // docs.as → DocsSite
  const entityId = url.pathname.slice(1)          // /stripe.com → stripe.com

  const entity = await fetchEntity(entityId)      // Fetch MDXLD

  return render(entity, { context })              // Render as DocsSite
}

function getContextFromDomain(host: string): ContextType {
  const contextMap = {
    'site.as': 'Site',
    'docs.as': 'DocsSite',
    'blogs.as': 'BlogSite',
    'agent.as': 'AgentSite',
    'saas.as': 'SaaSApp',
    'apps.as': 'App',
    // ...
  }
  return contextMap[host] || 'Site'
}

Context Inheritance

Contexts follow the same inheritance pattern as components:

// DocsSite inherits from Site
interface DocsSiteProps extends SiteProps {
  // Adds docs-specific props
  tree: DocTree
  search: SearchConfig
}

// When rendering docs.as/acme.com:
// 1. Load acme.com entity
// 2. Apply DocsSite context (adds tree, search defaults)
// 3. Render with DocsSite components

Composing Contexts

Some entities naturally span multiple contexts:

# acme.com MDXLD
$type: Business
$id: https://acme.com
name: Acme Corp

# This entity has:
site: https://acme.com           # Marketing site
docs: https://docs.acme.com      # Documentation
app: https://app.acme.com        # SaaS app
api: https://api.acme.com        # API
agent: https://agent.acme.com    # Agent interface

The .as domains let you access any of these views for ANY entity:

# Direct URLs (entity-controlled)
acme.com                # Entity's own site
docs.acme.com           # Entity's own docs subdomain

# Context URLs (platform-controlled)
site.as/acme.com        # Platform renders entity as Site
docs.as/acme.com        # Platform renders entity as Docs

This enables:

  • Discovery - Find any entity's docs at docs.as/{entity}
  • Consistency - Same UI patterns across all entities
  • Fallbacks - If entity doesn't have docs, platform generates them

On this page