# Subdomain Routing (/reference/concepts/subdomains)



Overview [#overview]

Every `*.headless.ly` subdomain routes to the same Cloudflare Worker, which resolves the subdomain to determine the composition context.

How It Works [#how-it-works]

When a request arrives at `crm.headless.ly`:

1. The Worker extracts the subdomain: `crm`
2. Looks up the context in the registry
3. The context defines available entities:
   ```
   crm -> Organization, Contact, Lead, Deal, Activity, Pipeline
   ```
4. API routes are automatically generated:
   ```
   /api/organizations -> Organization
   /api/contacts      -> Contact
   /api/deals         -> Deal
   ```

URL Structure [#url-structure]

```
https://{context}.headless.ly/api/{entities}
https://{context}.headless.ly/api/{entities}/:id
https://{context}.headless.ly/rpc/{Resource}.{operation}(args)
https://{context}.headless.ly/mcp
```

Examples [#examples]

```bash
