This turns on Expo Router's server routes so your app has a backend in the same tree: src/app/api/health+api.ts answers GET /api/health with { ok, version, variant }, src/app/api/echo+api.ts answers POST /api/echo { message } with zod validation and a 400 on bad input, and src/server/ holds the pieces you'll reuse - json.ts (json(), error(), readJson(request, schema), handle() which maps BadRequest to 4xx and anything else to 500 without leaking a stack), env.ts (serverEnv(), zod over process.env for keys that must never be EXPO_PUBLIC_), and webhooks/README.md with the handler pattern. If you set up with --with-examples there's an example at /examples/api. Pick this when a module needs a server - auth/better-auth requires it and payments/stripe wants it - or when you'd rather not stand up a separate backend yet.
At a glance
- Runs in Expo Go
- Yes
- Files added
- 14
- npm packages
- 0
- Keys to paste
EXPO_PUBLIC_API_URL- Included in
- Pro
Set it up
bun run setup --backend api-routesSetup copies the module in, installs SDK-matched versions and removes the options you did not pick. Then bun run doctor lists every key still missing, with a link to where you get it. The step-by-step guide is in the API routes docs.
Get it
API routes ships in Pro: one payment, lifetime updates. See pricing or browse every module.