-
-
Notifications
You must be signed in to change notification settings - Fork 778
chore: add vite-trpc example
#3944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
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. Comment |
There was a problem hiding this 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
examples/vite-trpc/.gitignoreexamples/vite-trpc/README.mdexamples/vite-trpc/index.htmlexamples/vite-trpc/package.jsonexamples/vite-trpc/server/trpc.tsexamples/vite-trpc/tsconfig.jsonexamples/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.jsonexamples/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/clientis needed.The server code only imports from
@trpc/server, andindex.htmluses rawfetch()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
callhelper cleanly handles both GET (queries) and POST (mutations) requests.
commit: |
Add a minimal trpc + vite example + simple SSR. Works like a charm!
/cc @KATT @juliusmarminge ❤️