nitro
Build and deploy universal JavaScript servers with Nitro v3. Use when working with nitro.config.ts, defineNitroConfig, defineHandler, defineConfig, server.ts entry, filesystem routing, route rules, useStorage, defineCachedHandler, useDatabase, definePlugin, runtime hooks, Vercel/Cloudflare deployment, or migrating from Nitro v2/nitropack.
- License 许可
- Apache-2.0
- 所属仓库
- getsentry/junior
- 最近更新
- 2026-11-13
- Stars
- ★ 418
- Forks
- 45
01 前言 Front Matter
- name
- nitro
- description
- Build and deploy universal JavaScript servers with Nitro v3. Use when working with nitro.config.ts, defineNitroConfig, defineHandler, defineConfig, server.ts entry, filesystem routing, route rules, useStorage, defineCachedHandler, useDatabase, definePlugin, runtime hooks, Vercel/Cloudflare deployment, or migrating from Nitro v2/nitropack.
02 资源文件 4
- 参考文档references/api-surface.md22.0 KB
- 参考文档references/common-use-cases.md11.5 KB
- 参考文档references/troubleshooting-workarounds.md11.2 KB
- 参考文档SOURCES.md10.0 KB
03 SKILL.md 正文
Build, configure, and deploy Nitro v3 applications using correct APIs and patterns.
Step 1: Classify the request
| Request type | Read first |
|---|---|
| API surface, handler signatures, imports, config options | references/api-surface.md |
| Setup, routing, caching, storage, plugins, frameworks, common patterns | references/common-use-cases.md |
| Build failures, runtime errors, deployment issues, migration from v2 | references/troubleshooting-workarounds.md |
Load only the reference(s) matching the request. If the task spans categories, load relevant files.
Step 2: Apply core guardrails
- Import
defineHandlerfrom"nitro", notdefineEventHandler(v2 API). - Import config helpers from subpaths:
"nitro/config","nitro/cache","nitro/storage","nitro/database","nitro/runtime-config","nitro/types". - Use web standard
event.req(Request) for body/headers — not v2 utilities likereadBodyorgetHeader. - Never return from middleware unless intentionally terminating the request.
- Only
GET/HEADrequests are cached bydefineCachedHandler; other methods bypass automatically. useDatabaseanddefineTaskrequire experimental feature flags.- Use
"nitro"package name, not"nitropack"(v2).
Step 3: Implement
- For new projects, use
defineConfigfrom"nitro"innitro.config.tsor addnitro()plugin from"nitro/vite"tovite.config.ts. - For server entry, export a web-compatible
fetch(Request): Responsehandler fromserver.ts, or useserver.node.tsfor Express/Fastify. - For filesystem routes, place handlers in
routes/orapi/with[param]for dynamic segments and.get.ts/.post.tsfor method-specific routes. - For caching, use
defineCachedHandlerfrom"nitro/cache"withmaxAgeandswroptions. - For storage, use
useStorage(namespace)from"nitro/storage"and configure drivers viastorageconfig. - For plugins, create files in
plugins/directory usingdefinePluginand hook intorequest,response,error, orclose. - For deployment, set
presetin config or useNITRO_PRESETenv var; Vercel/Netlify/Cloudflare are auto-detected.
Step 4: Validate
- Run
nitro devand verify routes respond correctly. - Run
nitro buildand check.output/server/contains expected files. - For cached routes, verify cache headers (
etag,cache-control) and 304 responses. - For storage, verify data persists across requests with configured driver.
- For deployment, verify the preset produces correct output format.
Step 5: Troubleshoot
defineEventHandler is not defined→ usedefineHandlerfrom"nitro"(v3 API).Cannot find module 'nitropack'→ rename to"nitro"in imports and package.json.- Route not matched → check file is in
routes/orapi/, or verifyroutesconfig mapping. - Middleware returning responses unexpectedly → ensure middleware does not return a value.
- For detailed diagnostics, read
references/troubleshooting-workarounds.md.
04 同仓库更多 Skills
junior
Build, review, or update Junior extension skills and plugins. Use when users ask to create a Junior SKILL.md, app skill, plugin, plugin.yaml, packaged plugin, MCP-backed plugin, OAuth or credentialed plugin, or to validate Junior extension files. Do not use for ordinary Junior usage, provider workflows, generic code editing, or non-Junior agent-skill authoring.
junior-qa
Validate Junior changes through local app-facing paths. Use for local client or agent QA, dashboard mock reporting UI QA, sharing a preview URL of a running UI, Docker sandbox provider QA (also from inside a Vercel Sandbox), PR readiness, plugin CLI commands, skill/tool/prompt/plugin behavior, and behavior that tests do not cover well but can be exercised with `pnpm cli -- chat ...`, another `pnpm cli` command, or `JUNIOR_DASHBOARD_MOCK_CONVERSATIONS=true pnpm dev`.
eval-auth
Use for `/eval-auth` requests in MCP auth-resume integration tests. Always connect through the disclosed MCP tool before answering, then continue the user's actual request using prior thread context when needed.
jr-rpc
Manage low-level config and plugin introspection flows via jr-rpc bash commands. Use only when the user explicitly asks to read or update provider defaults/config or list installed plugins. Do not use for PR, branch, push, or auth-order questions; load the matching provider skill instead.
xdotcom
Read public X (Twitter) data through the read-only X API v2. Use when users share an x.com or twitter.com link, or ask what someone posted on X, what people are saying about a topic, product, or launch on X, how much chatter something got, or for a post's text, metrics, replies, or an account's recent posts. Do not use it to post, reply, like, repost, follow, or send DMs, or to read private or protected data.
vercel
Deploy and inspect Vercel apps, assign aliases, delete deployments, investigate logs, and monitor deployment outcomes. Use for Vercel deployment and log requests, not GitHub code changes or other cloud providers.