> ## Documentation Index
> Fetch the complete documentation index at: https://docs.godizzy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How It Works

> Understand GoDizzy's routing model: environments, route collections, routing rules, and request flow.

GoDizzy is a programmable gateway between your agent and the APIs it calls. Each inbound request is mapped to a collection, evaluated against routing rules, and then either mocked or proxied.

## Data model

```text theme={null}
Organization
  └── Environments (production | development)
        └── Route Collections
              └── Routing Rules
```

## Environments

* **Production** — shared across the organization for real or shared traffic
* **Development** — private to the creator for experimentation and iteration

## Route collections

A route collection contains:

* a generated GoDizzy subdomain
* a target endpoint used by proxy rules
* an ordered set of routing rules

Your agent calls the collection URL, not the upstream directly.

```text theme={null}
https://<generated-subdomain>.godizzy.dev
```

## Routing rules

Each rule defines:

* **Method match** — such as `GET`, `POST`, or `*`
* **Path match** — exact path, parameterized path, or wildcard
* **Priority** — higher numbers run first
* **Action** — `mock` or `proxy`

Every collection also has a default rule. Unmatched requests fall through to that rule.

## Request flow

<Steps>
  <Step title="Resolve the collection">
    GoDizzy identifies the collection from the request subdomain.
  </Step>

  <Step title="Sort rules by priority">
    Rules are evaluated from highest priority to lowest.
  </Step>

  <Step title="Find the first match">
    The first rule whose method and path match wins.
  </Step>

  <Step title="Execute the action">
    * **Mock** returns the configured status, headers, body, and optional latency.
    * **Proxy** forwards the request to the collection target endpoint.
  </Step>

  <Step title="Return the response">
    The response goes back to the caller through the same GoDizzy URL.
  </Step>
</Steps>

## Path matching

| Style             | Example          | Notes                        |
| ----------------- | ---------------- | ---------------------------- |
| Exact             | `/api/users`     | Only matches that exact path |
| Parameter segment | `/api/users/:id` | Matches one path segment     |
| Wildcard          | `*`              | Matches any path             |

Query parameters do not change path matching. Path matching is case-sensitive.

## Mock vs proxy

<Tabs>
  <Tab title="Mock">
    Mock rules return a configured fixture. No upstream request is made.
  </Tab>

  <Tab title="Proxy">
    Proxy rules forward the request to the target endpoint. You can optionally apply response shaping before the response is returned.
  </Tab>
</Tabs>

## What changes without client rewrites

* switching a rule between mock and proxy
* editing a mock response
* changing rule priority
* adding latency to a mock rule
* updating proxy response shaping

## Learn more

<CardGroup cols={2}>
  <Card title="Environments" icon="layer-group" href="/concepts/environments">
    Production and development visibility, usage, and constraints.
  </Card>

  <Card title="Route Collections" icon="network-wired" href="/concepts/route-collections">
    Generated subdomains, target endpoints, and copying.
  </Card>

  <Card title="Routing Rules" icon="filter" href="/concepts/routing-rules">
    Method/path matching, priority, and the default rule.
  </Card>

  <Card title="MCP" icon="terminal" href="/guides/mcp">
    Programmatic access to environments, collections, and rules.
  </Card>
</CardGroup>
