---
title: "Develop on real sandboxes"
description: "Develop every flow on the providers' own test modes, with nothing simulated. Polar's sandbox with billing sync and the test card, Resend's test addresses and the dev inbox, the Convex AI Gateway or a Vercel key, and sign-in codes in the logs."
canonical_url: "https://nuxt-backend.dev/docs/develop/sandboxes"
---
# Develop on real sandboxes

> Develop every flow on the providers' own test modes, with nothing simulated. Polar's sandbox with billing sync and the test card, Resend's test addresses and the dev inbox, the Convex AI Gateway or a Vercel key, and sign-in codes in the logs.

Version: nuxt-backend 0.6.x · Tab: Develop · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

Development runs on each provider's own test mode, so every flow behaves the way it will in production, webhooks included. You need a Polar sandbox organization for billing, a Resend key for email, and a route to the models for AI. Until you add them, sign-in works on its own: codes print in your terminal.

This page covers what each test mode does while you build. The accounts, keys and webhooks are set up once, on each provider's [Services](https://nuxt-backend.dev/docs/services) page.

<table>
<thead>
  <tr>
    <th>
      Capability
    </th>
    
    <th>
      In development
    </th>
    
    <th>
      What you add
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        auth
      </code>
    </td>
    
    <td>
      Sign-in codes print in the dev console, or reach Resend's test addresses
    </td>
    
    <td>
      Nothing, or an email key
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data
      </code>
      
      , <code>
        jobs
      </code>
    </td>
    
    <td>
      A local or cloud dev deployment
    </td>
    
    <td>
      Nothing: the first <code>
        npx nuxt-backend dev
      </code>
      
       makes one
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing
      </code>
    </td>
    
    <td>
      Polar's sandbox, checkout with a test card
    </td>
    
    <td>
      A sandbox token, then <code>
        npx nuxt-backend billing sync
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email
      </code>
    </td>
    
    <td>
      Resend in test mode: mail reaches test addresses only, with real delivery events
    </td>
    
    <td>
      <code>
        EMAIL_API_KEY
      </code>
      
       and <code>
        EMAIL_FROM
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ai
      </code>
    </td>
    
    <td>
      The models themselves, through the Convex AI Gateway
    </td>
    
    <td>
      A paid Convex plan, or <code>
        AI_GATEWAY_API_KEY
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        protection
      </code>
    </td>
    
    <td>
      The dev server's bot check answers human
    </td>
    
    <td>
      Nothing, or a challenge's test keys
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        monitoring
      </code>
    </td>
    
    <td>
      A local error log in DevTools
    </td>
    
    <td>
      Nothing, or <code>
        MONITORING_DSN
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        notifications
      </code>
      
      , <code>
        flags
      </code>
    </td>
    
    <td>
      The same code as production
    </td>
    
    <td>
      Nothing
    </td>
  </tr>
</tbody>
</table>

Each capability reads `test` in `npx nuxt-backend status` while it runs in its test mode ([Capabilities](https://nuxt-backend.dev/docs/start/concepts/capabilities#a-capabilitys-state-is-detected)). Earlier previews ran on a local billing simulator, simulated email events and a stand-in model. `0.2.0` removes all three, and with them `simulate serve`, `simulate email` and `BILLING_SIMULATOR_URL`.

## Sign in with codes in the terminal

On a deployment whose `BACKEND_ENVIRONMENT` is `development`, every sign-in code also prints in the terminal running `npx nuxt-backend dev`. Without an email key, ask for a code on `/login` with any address and paste the code from the terminal. Once an email key is set, email runs in test mode, so sign in with a test address such as `delivered+you@resend.dev`: the code still prints in the terminal too. No other environment logs codes ([Environments](https://nuxt-backend.dev/docs/start/concepts/environments#backend_environment)).

## Billing on Polar's sandbox

Polar's sandbox is a separate server with its own accounts, organizations and tokens, isolated from production money:

<steps level="3">

### Create a sandbox token

Create a sandbox organization and an organization access token in it ([Polar](https://nuxt-backend.dev/docs/services/polar#sandbox-and-test-mode)). A production token does not work in the sandbox, and a sandbox token does not work in production.

### Push it to the deployment

```bash [.env.local]
BILLING_ACCESS_TOKEN=your_sandbox_access_token
```

```bash
npx nuxt-backend env push
```

### Create the catalog in the sandbox

```bash
npx nuxt-backend billing sync
```

It creates the meters, benefits, plans and credit packs of `backend/billing.catalog.ts` in your sandbox organization and writes their ids to `backend/billing.generated.ts`. It also registers the deployment's `/billing/events` webhook and stores its secret on the deployment. [Define and sync your catalog](https://nuxt-backend.dev/docs/build/billing/catalog) covers each option.

Moving to another sandbox organization later? Put its token in `.env.local`, run `npx nuxt-backend env push`, then [`npx nuxt-backend billing reset`](https://nuxt-backend.dev/docs/reference/cli#billing-reset): the deployment's customers belong to the old organization, and the reset syncs the catalog to the new one, clears them and puts every billing entity back on the free plan.

### Pay with the test card

Open `/pricing` and check out with `4242 4242 4242 4242`, any future expiry date and any CVC. Polar's sandbox charges nothing, and plans, credits and gifts behave as they will in production.

</steps>

Polar's webhooks need a deployment Polar can reach. A cloud dev deployment (`dev:…`) has a public URL, so they reach it as they reach production. A local or account-free one (`local:…`, `anonymous:…`) runs on your machine, where Polar cannot reach it. There, the return from checkout refreshes the balance once, and `billing sync` leaves the webhook alone and says why. For the webhooks on a local deployment, run a tunnel (Cloudflare Tunnel or ngrok, for one) to its HTTP origin, and pass its URL as `--webhook https://your-tunnel-host/billing/events`.

<note>

In the sandbox, Polar sends its own customer emails (receipts, renewal reminders) only to members of your sandbox organization. Sign in with your own address, or a `+alias` of it, to receive them.

</note>

## Email on Resend's test addresses

Outside production, email runs in test mode: the package sends only to Resend's test addresses, which accept mail without delivering it and send real delivery events back. Send to `delivered@resend.dev` for a delivery, `bounced@resend.dev` for a bounce and `complained@resend.dev` for a spam complaint, each with a `+label` to tell your runs apart, such as `delivered+signup@resend.dev`. A send to any other address is refused on the request, with a message that says the app is in test mode.

[Resend](https://nuxt-backend.dev/docs/services/resend#sandbox-and-test-mode) sets it up: the development team and its key, the sender, the full list of test addresses, and `email sync`, which registers the webhook so delivery events reach your deployment ([Link it](https://nuxt-backend.dev/docs/services/resend#link-it)). Give a dev or demo app a Resend team of its own: every webhook of a team receives the events of every email the team sends.

Once the webhook is in place, send to `bounced@resend.dev`: the email's status turns to bounced in a page that reads it with `useEmailStatus` ([Track delivery](https://nuxt-backend.dev/docs/build/email/delivery)).

### Read what was sent in the dev inbox

The dev inbox reads the mail sent to test addresses back through Resend's emails API, so you can open a sign-in code or an invitation without a mailbox:

```bash
npx nuxt-backend inbox
```

In a page, `useSandboxInbox` returns the same messages, live: the playground's sign-in form shows the code under it this way. The inbox lists messages sent in the last hour, and a page reads it only on a deployment outside production that opts in with `EMAIL_DEV_INBOX=1`, which `npx nuxt-backend dev` sets on a dev deployment ([Dev inbox](https://nuxt-backend.dev/docs/develop/dev-inbox)).

## AI through the Convex AI gateway

On a Convex team with a paid plan, models go through the [Convex AI Gateway](https://docs.convex.dev/ai-gateway/overview), on dev deployments too. Convex holds the provider credentials, so there is no model key to create, store or rotate. Each call settles in credits at the cost the gateway reports, from Polar's sandbox in development.

Where the gateway is not available, set `AI_GATEWAY_API_KEY` to a [Vercel AI Gateway](https://vercel.com/docs/ai-gateway) key instead. That covers a team on the free plan, where Convex answers `AiGatewayDisabled`, and an account-free local deployment, where it answers `AiGatewayUnavailable`. A self-hosted backend never tries the Convex gateway, so it always needs the key. With neither route, a model call is refused with its reason ([Choose a model](https://nuxt-backend.dev/docs/build/ai/models)).

## Protection, monitoring and notifications

- **Bot checks.** Outside production, the dev server's bot check answers human, so sign-in never stalls on a challenge. Cloudflare's published test keys exercise a real challenge ([Bot protection](https://nuxt-backend.dev/docs/build/auth/sign-in/bots#in-development)).
- **Errors.** Without `MONITORING_DSN`, the errors a DSN would receive are listed in the DevTools Monitoring tab ([Monitoring](https://nuxt-backend.dev/docs/ship/operate/monitoring#develop-without-a-dsn)).
- **Notifications.** The in-app inbox runs the same code as production. Web push needs its keys, which `npx nuxt-backend env push` generates.

## Tests and these sandboxes

Function and page tests never call a provider. `nuxt-backend/test` runs your backend functions on `convex-test` with every component mounted, and `createBackendMock` from `nuxt-backend/test-utils` renders your pages over a mock backend ([Test your app](https://nuxt-backend.dev/docs/develop/testing)). An end-to-end test is the one that crosses these sandboxes: it reads its sign-in code from the dev inbox and pays with the test card ([Run end-to-end tests](https://nuxt-backend.dev/docs/develop/testing/e2e)).

## Related

- [Run the dev loop](https://nuxt-backend.dev/docs/develop/dev-loop): the daily loop on your dev deployment.
- [Environments](https://nuxt-backend.dev/docs/start/concepts/environments): what `BACKEND_ENVIRONMENT` turns on in each deployment.
- [Define and sync your catalog](https://nuxt-backend.dev/docs/build/billing/catalog): what `billing sync` creates in the sandbox.
- [Delivery tracking](https://nuxt-backend.dev/docs/build/email/delivery): the delivery events the test addresses send.
- [Service map](https://nuxt-backend.dev/docs/services): each provider's account, keys and webhooks.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
