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

# Web APIs

> The web-standard globals meow exposes in both modes — fetch, URL, crypto.subtle, streams, and more.

meow is **standards-first**: its baseline global surface is the web platform, not
Node. These APIs are available in **both** `strict-web` and `node-compat` modes —
the mode only changes whether the *Node* host surface is layered on top.

## The committed global surface

| Area         | Globals                                                                                   |
| ------------ | ----------------------------------------------------------------------------------------- |
| **Fetch**    | `fetch`, `Request`, `Response`, `Headers`, `FormData`                                     |
| **URLs**     | `URL`, `URLSearchParams`, `URLPattern`                                                    |
| **Encoding** | `TextEncoder`, `TextDecoder`                                                              |
| **Crypto**   | `crypto.subtle` (digest, encrypt/decrypt, sign/verify, key ops), `crypto.getRandomValues` |
| **Binary**   | `Blob`                                                                                    |
| **Abort**    | `AbortController`, `AbortSignal`, `DOMException`                                          |
| **Timers**   | `setTimeout`, `clearTimeout`                                                              |
| **Console**  | `console.log` / `info` / `warn` / `error` / `debug`                                       |

These are typed for your editor automatically — `meow sync` writes
`.meow/strict-web.d.ts` so the globals resolve with nothing installed.

## Examples

<CodeGroup>
  ```typescript fetch theme={null}
  const res = await fetch("https://api.example.com/data", {
    headers: { authorization: "Bearer …" },
  });
  const data = await res.json();
  ```

  ```typescript URL & URLPattern theme={null}
  const url = new URL("https://meow.style/docs?x=1");
  url.searchParams.get("x");          // "1"

  const pattern = new URLPattern({ pathname: "/users/:id" });
  pattern.exec("https://x/users/42")?.pathname.groups.id;  // "42"
  ```

  ```typescript crypto.subtle theme={null}
  const data = new TextEncoder().encode("hello");
  const digest = await crypto.subtle.digest("SHA-256", data);
  const hex = [...new Uint8Array(digest)]
    .map((b) => b.toString(16).padStart(2, "0"))
    .join("");
  ```

  ```typescript AbortSignal theme={null}
  const res = await fetch(url, {
    signal: AbortSignal.timeout(5_000),  // auto-abort after 5s
  });
  ```
</CodeGroup>

## Not present

meow is a runtime, never a browser. The DOM and browser-host globals are
intentionally absent — `window`, `document`, `localStorage`, and `WebSocket` are
**not** part of the surface. The generated type config pins `lib: ["esnext"]` so
those names don't leak into your editor either.

## Crypto & determinism

In `strict-web` mode, `crypto.getRandomValues()` draws from the
[seeded RNG](/concepts/determinism#seeded-randomness) by default — deterministic
across runs. `crypto.subtle` (hashing, signing, key derivation) is unaffected; it's
deterministic by nature. Grant real entropy with `--allow-random` when you need it.

## Serving HTTP

The server side of the web platform — accepting requests and returning `Response`
objects — is the [`meow:http`](/api/http) built-in module:

```typescript theme={null}
import { serve } from "meow:http";

serve((req: Request) => new Response("hi"), { port: 3000 });
```

<Note>
  Beyond the committed surface above, meow also exposes some web APIs transitively —
  `structuredClone`, `atob`/`btoa`, `performance`, `EventTarget`, and streams beyond
  fetch bodies are present but **not yet a committed surface**, so they aren't declared
  in the strict-web types and may evolve. Build on the committed set for stability.
</Note>

<CardGroup cols={2}>
  <Card title="meow:http" icon="server" href="/api/http">
    The HTTP server module.
  </Card>

  <Card title="Node.js compatibility" icon="node-js" href="/runtime/node-compat">
    When you need `node:fs`, `process`, and CommonJS.
  </Card>
</CardGroup>
