danwo 的运行环境

Full-stack app

One app that serves both pages and API, started by danwo. Everything works.

本页还没有中文版,下面是英文原文。

Your app serves its pages and its API from one server: Next.js with API routes and server actions, Remix, Nuxt, SvelteKit, or a plain Node server. danwo starts it, so every call it makes goes through danwo's proxy. This is the setup with the most coverage.

danwo controls this partBrowserdanwo drives itproxyYour apppages, API, actionsproxyEmulatorsStripe, Resend, …
Calls marked proxy go through danwo's proxy, so each is recorded and can be emulated or faulted.

Set it up

Give danwo the command that starts your app and where it answers. List the services your app calls:

danwo.config.ts
import { appEnvironment, defineConfig, resendService, stripeService } from "@danwo/sdk"

export default defineConfig({
  testDir: "tests",
  environment: () =>
    appEnvironment({
      app: { command: "npm run dev", url: "http://localhost:3000" },
      services: [stripeService(), resendService()],
    }),
})

danwo runs npm run dev with its proxy settings and a test certificate. When your server calls api.stripe.com, the Stripe emulator answers. Your code doesn't change.

What you get

You canHow
Drive pages, with locators or the agentAgent and locators
Emulate what the server and the browser callthe services list
Break any call, webhook or database statementdanwo matrix
Start every test from clean stateIsolation
Move time forwardTime travel: the app's clock, the emulators', the page's

Next.js: routes, edge, middleware and server actions

We checked Next.js 16.4.2 under both next dev and next start. These all reached the Stripe emulator through danwo's proxy:

Where the call is madenext devnext start
Route handler, Node runtime✓✓
Route handler, runtime = "edge"✓✓
Server component✓✓
Middleware✓✓

The same app started without danwo reached the real Stripe from all four. Edge routes and middleware work because, on your machine, Next.js runs them inside its own Node server process, which danwo started.

Server actions run in that same server process, like server components, so their calls go through the proxy too.

This holds when danwo starts the server on your machine. A deployment to an edge network (Vercel, Netlify, Cloudflare) runs outside danwo: test it as staging.

Pitfalls

  • A build that fetches during start-up. Fonts or remote config fetched at build time go through the proxy too. Pass unmatched: "passthrough" (the default) or add those hosts to allow when you block the rest. The page's own images and fonts still load under block; see Outside hosts.
  • A start script that sets NODE_OPTIONS. danwo keeps its settings anyway, through a small node wrapper on the app's PATH. See Real stacks.
  • Other runtimes. danwo covers Node and Bun servers. We haven't checked Deno, or wrangler dev for Cloudflare Workers, yet.

Next

本页内容

在每个 Pull Request 上运行

每个 Pull Request 一个 GitHub Check 和一条评论,并附上完整的运行记录。

配置 CI