Skip to content

docs: simplify tanstack start handlers to use ANY method#1189

Merged
dinwwwh merged 2 commits intomiddleapi:mainfrom
Visualizeit:simplify-tanstack-start-docs
Nov 7, 2025
Merged

docs: simplify tanstack start handlers to use ANY method#1189
dinwwwh merged 2 commits intomiddleapi:mainfrom
Visualizeit:simplify-tanstack-start-docs

Conversation

@Visualizeit
Copy link
Copy Markdown
Contributor

@Visualizeit Visualizeit commented Nov 7, 2025

Replace multiple HTTP method handlers (HEAD, GET, POST, PUT, PATCH, DELETE) with a single ANY handler to simplify the example code.

Summary by CodeRabbit

  • Documentation
    • Updated TanStack Start adapter docs and examples to show simplified route configuration using a single unified handler instead of separate HTTP method handlers.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Nov 7, 2025
@vercel
Copy link
Copy Markdown

vercel bot commented Nov 7, 2025

@Visualizeit is attempting to deploy a commit to the unnoq-team Team on Vercel.

A member of the Team first needs to authorize it.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Visualizeit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the clarity and conciseness of the tanstack-start documentation. By replacing a verbose list of individual HTTP method handlers with a single, all-encompassing ANY handler, the example code becomes significantly simpler and easier to grasp for readers. This change directly addresses the goal of providing more streamlined and user-friendly documentation.

Highlights

  • Documentation Simplification: The pull request simplifies the example code within the tanstack-start documentation by replacing multiple explicit HTTP method handlers with a single ANY handler.
  • Handler Consolidation: The HEAD, GET, POST, PUT, PATCH, and DELETE handlers have been consolidated into a single ANY handler for server-side routing examples.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 7, 2025

Walkthrough

Per-route HTTP method handlers (HEAD, GET, POST, PUT, PATCH, DELETE) were replaced with a single async ANY handler that delegates to the existing handling logic across documentation and two playground routes.

Changes

Cohort / File(s) Summary
Route handler consolidation
apps/content/docs/adapters/tanstack-start.md, playgrounds/tanstack-start/src/routes/api/$.ts, playgrounds/tanstack-start/src/routes/api/rpc.$.ts
Replaced individual per-method route handlers with a single ANY async handler that forwards the request to the original handler logic and returns its response or a 404 fallback. Removed standalone handle functions where applicable.

Sequence Diagram(s)

sequenceDiagram
  participant C as Client
  participant R as Router (ANY)
  participant H as Existing Handler (handler.handle)
  rect rgb(230, 247, 255)
    C->>R: HTTP request (any method)
    R->>H: forward request + prefix/context
    H-->>R: { matched, response } or undefined
    R-->>C: response or 404
  end
Loading
%% Comparison: old vs new (simplified)
sequenceDiagram
  participant C as Client
  participant OldR as Router (per-method)
  participant NewR as Router (ANY)
  participant H as Handler

  Note over C,OldR: Old flow
  C->>OldR: HTTP request (GET/POST/...)
  OldR->>H: method-specific handler invocation
  H-->>OldR: response
  OldR-->>C: response

  Note over C,NewR: New flow
  C->>NewR: HTTP request (any method)
  NewR->>H: unified ANY handler forwards request
  H-->>NewR: response
  NewR-->>C: response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify ANY truly covers all intended HTTP methods and matches previous behavior (including HEAD semantics).
  • Confirm prefix/context passed to handler.handle is unchanged and tested for both /api and /api/rpc routes.
  • Check 404 fallback behavior is preserved where applicable.
  • Ensure removed standalone handle functions don't break references elsewhere.

Possibly related PRs

  • unnoq/orpc#295 — Changes handler.handle to return {matched,response} and adjusts prefix logic; directly relevant given the unified call site.
  • unnoq/orpc#188 — Modifies the prefix passed to handler.handle (e.g., /rpc -> /api/rpc), which may affect routing when delegating from the unified handler.
  • unnoq/orpc#636 — Also updates TanStack Start routing patterns; presents an alternative approach (explicit .methods() bindings) to related routing changes.

Suggested labels

size:S, lgtm

Poem

🐰 I hopped through code with ears held high,

One ANY to catch each passing try.
Methods merged in a cozy nest,
A single hop does all the rest. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs: simplify tanstack start handlers to use ANY method' directly and accurately describes the main change: replacing per-method HTTP handlers with a single ANY handler.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request simplifies the server handlers in the TanStack Start adapter documentation. The change replaces multiple specific HTTP method handlers with a single ANY handler, which makes the example code more concise and easier to understand. The change is correct and aligns with the goal of simplification. I noticed that the corresponding example in playgrounds/tanstack-start/src/routes/api/rpc.$.ts still uses the older, more verbose handler definition. While it's outside the scope of this PR, updating it in a future change would improve consistency across the project's examples.

Copy link
Copy Markdown

@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: 0

🧹 Nitpick comments (1)
apps/content/docs/adapters/tanstack-start.md (1)

38-44: Consider adding a brief note explaining the simplification.

The change from enumerated method handlers to ANY is a valid simplification, but the documentation doesn't explain the rationale or highlight that this is equivalent to the previous pattern. Adding a brief comment or expandable note would help readers understand why this pattern is preferred.

Consider adding a note like:

:::info
The `ANY` handler is a simplified approach that handles all HTTP methods. For cases requiring method-specific logic, individual handlers (`GET`, `POST`, etc.) can still be used.
:::

This can be placed after the code block to clarify the design choice.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3312214 and 6392c79.

📒 Files selected for processing (1)
  • apps/content/docs/adapters/tanstack-start.md (1 hunks)
🔇 Additional comments (1)
apps/content/docs/adapters/tanstack-start.md (1)

38-44: No issues found — the example correctly uses ANY as a handler.

TanStack Start's server.handlers configuration supports ANY as a valid handler key to match all HTTP methods. The simplification from individual method handlers to a single ANY handler is correct and well-supported by the framework.

@dinwwwh dinwwwh changed the title docs(tanstack-start): simplify server handlers to use ANY method docs: simplify tanstack start handlers to use ANY method Nov 7, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Nov 7, 2025
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Nov 7, 2025

More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@1189

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@1189

@orpc/client

npm i https://pkg.pr.new/@orpc/client@1189

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@1189

@orpc/experimental-durable-iterator

npm i https://pkg.pr.new/@orpc/experimental-durable-iterator@1189

@orpc/hey-api

npm i https://pkg.pr.new/@orpc/hey-api@1189

@orpc/interop

npm i https://pkg.pr.new/@orpc/interop@1189

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@1189

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@1189

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@1189

@orpc/openapi-client

npm i https://pkg.pr.new/@orpc/openapi-client@1189

@orpc/otel

npm i https://pkg.pr.new/@orpc/otel@1189

@orpc/experimental-publisher

npm i https://pkg.pr.new/@orpc/experimental-publisher@1189

@orpc/experimental-ratelimit

npm i https://pkg.pr.new/@orpc/experimental-ratelimit@1189

@orpc/react

npm i https://pkg.pr.new/@orpc/react@1189

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@1189

@orpc/experimental-react-swr

npm i https://pkg.pr.new/@orpc/experimental-react-swr@1189

@orpc/server

npm i https://pkg.pr.new/@orpc/server@1189

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@1189

@orpc/solid-query

npm i https://pkg.pr.new/@orpc/solid-query@1189

@orpc/standard-server

npm i https://pkg.pr.new/@orpc/standard-server@1189

@orpc/standard-server-aws-lambda

npm i https://pkg.pr.new/@orpc/standard-server-aws-lambda@1189

@orpc/standard-server-fastify

npm i https://pkg.pr.new/@orpc/standard-server-fastify@1189

@orpc/standard-server-fetch

npm i https://pkg.pr.new/@orpc/standard-server-fetch@1189

@orpc/standard-server-node

npm i https://pkg.pr.new/@orpc/standard-server-node@1189

@orpc/standard-server-peer

npm i https://pkg.pr.new/@orpc/standard-server-peer@1189

@orpc/svelte-query

npm i https://pkg.pr.new/@orpc/svelte-query@1189

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@1189

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@1189

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@1189

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@1189

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@1189

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@1189

commit: c876092

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6392c79 and c876092.

📒 Files selected for processing (3)
  • apps/content/docs/adapters/tanstack-start.md (1 hunks)
  • playgrounds/tanstack-start/src/routes/api/$.ts (1 hunks)
  • playgrounds/tanstack-start/src/routes/api/rpc.$.ts (1 hunks)
⏰ 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: publish-commit
  • GitHub Check: test
  • GitHub Check: lint
🔇 Additional comments (2)
playgrounds/tanstack-start/src/routes/api/rpc.$.ts (1)

23-30: Consistent implementation across RPC routes.

The ANY handler implementation mirrors the OpenAPI route pattern, maintaining consistency across the codebase. The RPCHandler will handle method-specific routing internally, and the 404 fallback provides appropriate error handling.

apps/content/docs/adapters/tanstack-start.md (1)

32-39: Documentation accurately reflects the implementation changes.

The updated example correctly demonstrates the simplified ANY handler pattern, maintaining consistency with the playground implementations. This makes the documentation easier to follow and reduces the example code footprint.

@vercel
Copy link
Copy Markdown

vercel bot commented Nov 7, 2025

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

Project Deployment Preview Comments Updated (UTC)
orpc Ready Ready Preview Comment Nov 7, 2025 0:08am

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 7, 2025
@dinwwwh dinwwwh merged commit 4f6ce56 into middleapi:main Nov 7, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants