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

> ## Agent Instructions
> Treat these docs and the Whop MCP server as the source of truth for Whop API behavior. Don't infer endpoint behavior from marketing pages.
> MCP server: connect https://mcp.whop.com/mcp (streamable HTTP, browser sign-in, no API key in the client config) to search these docs and read or change live Whop data. Setup: https://docs.whop.com/developer/guides/ai_and_mcp.md
> Whop CLI: install with `curl -fsSL https://whop.com/install.sh | sh` to scaffold, run, and deploy Whop apps and websites. It acts on production, not the sandbox. Overview: https://docs.whop.com/cli/overview.md Agent mode: https://docs.whop.com/cli/agent-mode.md
> Hosting: Whop serves a site or app from the build `whop apps deploy` uploads, with rollbacks, secrets, and server logs. Guide: https://docs.whop.com/developer/websites/hosting.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Guide: https://docs.whop.com/developer/guides/plugins/claude-code.md Every agent tool: https://docs.whop.com/developer/ai/overview.md
> Environments: build and test in the sandbox (API `https://sandbox-api.whop.com/api/v1`, keys at https://sandbox.whop.com/dashboard/developer, SDK environment `Sandbox`; no real money). Production (API `https://api.whop.com/api/v1`, keys at https://whop.com/dashboard/developer, SDK environment `Production`, the SDK default) moves real money, so use it only at launch. The two share no accounts, keys, products, or webhooks, and their keys look identical: never mix them. Sandbox guide: https://docs.whop.com/developer/guides/sandbox.md Comparison: https://docs.whop.com/developer/quickstart.md
> API: send `Authorization: Bearer <API_KEY>` from your server only, and pin a dated version with the `Api-Version-Date` header. OpenAPI spec: https://api.whop.com/api/v1/openapi.json
> Which API: build on the Current API, whose pages live under https://docs.whop.com/api-reference/ (start at https://docs.whop.com/api-reference/overview.md). Pages under /api-reference/legacy/ are the Legacy API. Use one only when https://docs.whop.com/api-reference/stability.md lists the resource as Legacy-only.

# Udviklingsproxy

> Kør Whops udviklingsproxy for at efterligne godkendelse og iframe-adfærd fra produktion under udvikling.

I produktion kører din app i Whop-iframen bag en reverse proxy, der indsætter `x-whop-user-token`-headeren på hver forespørgsel. Alle Whop-apps verificerer det token via [`whopsdk.verifyUserToken`](https://docs.whop.com/da/developer/guides/authentication), så du skal have samme header på `localhost` for at teste med rigtige brugere. Udviklingsproxyen indsætter den for dig.

> [!WARNING]
>
> `verifyUserToken` er ikke tilgængelig i den nuværende `@whop/sdk`. Headeren, der beskrives her, indsættes stadig som dokumenteret.

## Vælg din opsætning

Der er to installationstilstande. Begge leverer den samme proxy-binær. Forskellen er, om proxyen starter din udviklingsserver eller kører ved siden af den.

| | Indpakket (Node/JS) | Selvstændig |
| - | - | - |
| **Bedst til** | Next.js, Express, alt med et node-baseret udviklingsscript | Python, Ruby, Go, alt, der ikke er JS |
| **Sådan kører den** | `whop-proxy --command 'next dev'` starter din server | Din server kører på en port, og proxyen videresender til den |
| **Port** | Én port (proxy + server) | To porte (proxy på 3000, server på f.eks. 5000) |
| **Installation** | `pnpm add -D @whop-apps/dev-proxy` | `pnpm dlx @whop-apps/dev-proxy --standalone` (ingen installation nødvendig) |

## `Next.js`- og `JavaScript`-app

**1. Tilføj proxyen som udviklingsafhængighed**

```bash pnpm theme={null}
pnpm add -D @whop-apps/dev-proxy
```

```bash bun theme={null}
bun install -D @whop-apps/dev-proxy
```

```bash npm theme={null}
npm install -D @whop-apps/dev-proxy
```

```bash yarn theme={null}
yarn add -D @whop-apps/dev-proxy
```

**2. Opdater dev-scriptet i package.json**

Opdater `dev`-scriptet i `package.json`, så det inkluderer proxyen.

```json theme={null}
"scripts": {
    "dev": "whop-proxy --command 'next dev --turbopack'",
}
```

> [!NOTE]
>
> Du kan opdatere `dev`-kommandoen, så den passer til dit frameworks krav.
> Du kan også pakke andre kommandoer ind med proxyen på samme måde.

**3. Kør proxyen**

```bash pnpm theme={null}
pnpm dev
```

```bash npm theme={null}
npm run dev
```

```bash yarn theme={null}
yarn dev
```

## Selvstændig tilstand (andre frameworks)

**1. Kør din app lokalt**

Kør din app på din lokale maskine på en port, for eksempel 5000.

```bash Python + FastAPI theme={null}
uvicorn main:app --port 5000
```

```bash Ruby on Rails theme={null}
rails server -p 5000
```

```bash Go theme={null}
go run main.go --port 5000
```

**2. Kør proxyen i selvstændig tilstand**

```bash pnpm theme={null}
pnpm dlx @whop-apps/dev-proxy --standalone --upstreamPort=5000 --proxyPort=3000
```

```bash bun theme={null}
bunx @whop-apps/dev-proxy --standalone --upstreamPort=5000 --proxyPort=3000
```

```bash npm theme={null}
npx @whop-apps/dev-proxy --standalone --upstreamPort=5000 --proxyPort=3000
```

```bash yarn theme={null}
yarn dlx @whop-apps/dev-proxy --standalone --upstreamPort=5000 --proxyPort=3000
```

> [!NOTE]
>
> Dette kører proxyen som en selvstændig proces. Den starter en server på
> port 3000, videresender forespørgsler til port 5000 og tilføjer brugertokenet i
> headerne.

## Kommandoindstillinger for proxyen

Konfigurer proxyen med følgende kommandolinjeindstillinger:

```bash theme={null}
Usage: pnpm dlx @whop-apps/dev-proxy [options]

Options:

--proxyPort <port>      The port the proxy should listen on (3000 by default)
--upstreamPort <port>   The port the upstream server is listening on (set automatically by default)
--npmCommand <command>  The npm command to run to start the upstream server (dev by default)
--command <command>     The command to run to start the upstream server (npm run dev by default)
--standalone            Run the proxy as an independent process proxying requests from one port to another port. Ignores the command / npmCommand options.
```

## Næste trin

> [card] [Godkendelse](https://docs.whop.com/da/developer/guides/authentication.md)
>
> Verificer iframe-brugertokenet med den samme kode lokalt og i produktion.

> [card] [Lyt til webhooks](https://docs.whop.com/da/developer/guides/webhooks.md)
>
> Videresend Whop-webhooks til localhost under udvikling (brug ngrok eller Cloudflare Tunnel).

> [card] [Byg app-visninger](https://docs.whop.com/da/developer/guides/app-views.md)
>
> Opsæt de iframe-indgangspunkter, som din app vises i.

> [card] [Anmod om tilladelser](https://docs.whop.com/da/developer/guides/permissions.md)
>
> Konfigurer de scopes, din app har brug for, før du udgiver.


## Related topics

- [Godkend brugere i Whop-apps](https://docs.whop.com/da/developer/guides/authentication.md)
- [Anmod om app-tilladelser](https://docs.whop.com/da/developer/guides/permissions.md)
