Skip to content

Conversation

@pi0
Copy link
Member

@pi0 pi0 commented Jan 13, 2026

Add a minimal trpc + vite example + simple SSR. Works like a charm!

/cc @KATT @juliusmarminge ❤️

@vercel
Copy link

vercel bot commented Jan 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nitro.build Ready Ready Preview, Comment Jan 13, 2026 7:02pm

@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds a new example project demonstrating a Vite + tRPC frontend and a Nitro-mounted tRPC backend: frontend HTML with a counter UI that calls /trpc endpoints, a server module exposing get/inc procedures, and supporting config, package, and ignore files.

Changes

Cohort / File(s) Summary
Configuration & Build
examples/vite-trpc/.gitignore, examples/vite-trpc/package.json, examples/vite-trpc/tsconfig.json, examples/vite-trpc/vite.config.ts
Adds gitignore entries (node_modules, dist), package.json with ES module config and dev scripts + tRPC/Vite/Nitro deps, tsconfig extending Nitro, and Vite config registering Nitro plugin routing "/trpc/**" to ./server/trpc.ts.
Frontend / Example UI
examples/vite-trpc/index.html, examples/vite-trpc/README.md
Adds an HTML example implementing a dark-themed counter UI with client-side tRPC fetch helpers and initial server-render fetch; adds README describing the Vite + tRPC example.
Server / tRPC router
examples/vite-trpc/server/trpc.ts
Introduces an in-memory counter router (appRouter) with get and inc procedures, exports AppRouter type, and provides a default export implementing a fetch(request: Request): Promise<Response> handler delegating to TRPC fetchRequestHandler.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: add vite-trpc example' follows conventional commits format with a clear, descriptive message that accurately reflects the changeset of adding a new Vite + tRPC example.
Description check ✅ Passed The description directly relates to the changeset, describing the addition of a minimal tRPC + Vite example and expressing confidence in the implementation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/trpc-example

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb2a047 and d906f96.

📒 Files selected for processing (2)
  • examples/vite-trpc/README.md
  • examples/vite-trpc/index.html

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @examples/vite-trpc/index.html:
- Line 53: The HTML example incorrectly uses Vue SFC syntax: remove the setup
attribute from the <script setup> tag so it becomes a plain <script> tag; update
any references in the file that expect SFC semantics to use normal script
behavior (e.g., top-level script execution) and ensure no SFC-only identifiers
remain tied to <script setup>.

In @examples/vite-trpc/package.json:
- Around line 11-12: The package.json currently uses non-pinned/inaccurate
dependency entries "nitro": "latest" and "vite": "beta" which breaks
reproducible builds; update these to specific stable versions or remove unused
entries—replace "vite": "beta" with a pinned release like "vite": "7.1.4" and
either change "nitro": "latest" to the correct package name "nitropack":
"2.12.5" (or remove the nitro entry if it's not used) so the example depends on
stable, resolvable versions.

In @examples/vite-trpc/README.md:
- Around line 1-5: The README currently references RSC and files like
entry.ssr.tsx/entry.rsc.tsx from another template; update README.md to describe
this repository as a Vite + tRPC + Nitro example instead, remove all mentions of
RSC and the sentence about exporting default.fetch from
entry.ssr.tsx/entry.rsc.tsx, and replace with concise setup and run instructions
(e.g., install and dev commands such as "npm install" and "npm run dev") plus a
short summary of what this example demonstrates (tRPC integration with Nitro and
Vite).
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f312cfb and fb2a047.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • examples/vite-trpc/.gitignore
  • examples/vite-trpc/README.md
  • examples/vite-trpc/index.html
  • examples/vite-trpc/package.json
  • examples/vite-trpc/server/trpc.ts
  • examples/vite-trpc/tsconfig.json
  • examples/vite-trpc/vite.config.ts
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-12-24T11:45:17.435Z
Learnt from: CR
Repo: nitrojs/nitro PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T11:45:17.435Z
Learning: Applies to src/build/**/*.{ts,js} : Virtual modules must be registered in `src/build/virtual.ts`

Applied to files:

  • examples/vite-trpc/.gitignore
📚 Learning: 2025-12-24T11:45:17.435Z
Learnt from: CR
Repo: nitrojs/nitro PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T11:45:17.435Z
Learning: Applies to src/{build,dev,runner,cli}/**/*.{ts,js} : Use `consola` for logging in build/dev code; use `nitro.logger` when available

Applied to files:

  • examples/vite-trpc/tsconfig.json
  • examples/vite-trpc/package.json
🪛 markdownlint-cli2 (0.18.1)
examples/vite-trpc/README.md

3-3: Bare URL used

(MD034, no-bare-urls)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: tests-rollup (ubuntu-latest)
  • GitHub Check: tests-rolldown (windows-latest)
  • GitHub Check: tests-rollup (windows-latest)
🔇 Additional comments (7)
examples/vite-trpc/.gitignore (1)

1-2: LGTM!

Standard ignore entries for a Vite/Node.js project.

examples/vite-trpc/tsconfig.json (1)

1-4: LGTM!

Minimal TypeScript configuration extending Nitro's base config is appropriate for this example.

examples/vite-trpc/package.json (1)

9-9: Verify if @trpc/client is needed.

The server code only imports from @trpc/server, and index.html uses raw fetch() calls rather than a tRPC client. If the intent is to demonstrate tRPC client usage, consider adding an example; otherwise, this dependency may be unnecessary.

examples/vite-trpc/server/trpc.ts (2)

1-17: LGTM!

Clean tRPC router setup with standard query and mutation procedures. The in-memory counter is appropriate for demonstrating the tRPC integration pattern.


21-28: LGTM!

The fetch handler export pattern correctly integrates with Nitro's route handling.

examples/vite-trpc/vite.config.ts (1)

1-12: LGTM!

Clean and minimal Vite configuration. The Nitro plugin setup with the wildcard route mapping for tRPC endpoints is correct.

examples/vite-trpc/index.html (1)

57-78: LGTM!

The tRPC client implementation is appropriately minimal for a demo. The call helper cleanly handles both GET (queries) and POST (mutations) requests.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 13, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nitrojs/nitro@3944

commit: fb2a047

@pi0 pi0 merged commit a765d98 into main Jan 13, 2026
7 of 9 checks passed
@pi0 pi0 deleted the chore/trpc-example branch January 13, 2026 19:02
@coderabbitai coderabbitai bot mentioned this pull request Jan 29, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants