Skip to content

Conversation

@TkDodo
Copy link
Contributor

@TkDodo TkDodo commented Nov 13, 2025

type-safe createServerEntry that will help with adding try/catch internally later on without users having to change a thing.

Summary by CodeRabbit

  • Documentation

    • Updated server entry guide and examples to show the new wrapped export pattern and clarify request handler usage.
  • Refactor

    • Server entry export now uses a lightweight wrapper/factory approach for request handlers, replacing the previous direct-object export to improve interoperability and consistency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

Walkthrough

Replaces direct server-entry object exports with a createServerEntry(factory) wrapper across React Start and Solid Start packages and updates documentation to show exporting default via createServerEntry({ fetch(...) { ... } }).

Changes

Cohort / File(s) Summary
Documentation updates
docs/start/framework/react/guide/server-entry-point.md
Reworked examples and narrative to use createServerEntry(...) from @tanstack/react-start/server-entry instead of exporting a plain ServerEntry object; updated request context and custom handler examples.
React Start server entry
packages/react-start/src/default-entry/server.ts
Added export type ServerEntry = { fetch: RequestHandler<Register> }; introduced export function createServerEntry(entry: ServerEntry): ServerEntry and changed default export to export default createServerEntry({ fetch }) (removed concrete serverEntry export).
Solid Start server entry
packages/solid-start/src/default-entry/server.ts
Added export type ServerEntry = { fetch: RequestHandler<Register> }; introduced export function createServerEntry(entry: ServerEntry): ServerEntry and changed default export to export default createServerEntry({ fetch }) (removed concrete serverEntry export).

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant Entry as createServerEntry(wrapper)
  participant Impl as entry.fetch (user)
  rect `#E8F5E9`
    Client->>Entry: HTTP Request
    Entry->>Impl: call fetch(request, ctx)
    Impl-->>Entry: Response
    Entry-->>Client: HTTP Response
  end
  Note right of Entry: createServerEntry delegates to<br/>the provided entry.fetch implementation
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Multiple similar edits across packages and docs reduce cognitive overhead, but reviewers should verify:
    • Type signatures for ServerEntry and RequestHandler<Register> consistency
    • Default export behavior change and any downstream import sites
    • Documentation examples compile and match runtime behavior

Possibly related PRs

Poem

🐰 I wrapped my fetch in cozy thread,
A little factory for calls ahead.
Now entries hop with tidy cheer,
Wrapped and ready — spring is near! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: createServerEntry' accurately summarizes the main change, which introduces a new createServerEntry factory function across multiple packages as a wrapper for server entry points.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/serverEntry-wrapper

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ee6ca1d and 6e37b29.

📒 Files selected for processing (3)
  • docs/start/framework/react/guide/server-entry-point.md (5 hunks)
  • packages/react-start/src/default-entry/server.ts (1 hunks)
  • packages/solid-start/src/default-entry/server.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Use internal docs links relative to the docs/ folder (e.g., ./guide/data-loading)

Files:

  • docs/start/framework/react/guide/server-entry-point.md
docs/{router,start}/**

📄 CodeRabbit inference engine (AGENTS.md)

Place router docs under docs/router/ and start framework docs under docs/start/

Files:

  • docs/start/framework/react/guide/server-entry-point.md
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • packages/solid-start/src/default-entry/server.ts
  • packages/react-start/src/default-entry/server.ts
packages/{*-start,start-*}/**

📄 CodeRabbit inference engine (AGENTS.md)

Name and place Start framework packages under packages/-start/ or packages/start-/

Files:

  • packages/solid-start/src/default-entry/server.ts
  • packages/react-start/src/default-entry/server.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/
📚 Learning: 2025-11-02T16:16:24.898Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.

Applied to files:

  • docs/start/framework/react/guide/server-entry-point.md
  • packages/solid-start/src/default-entry/server.ts
  • packages/react-start/src/default-entry/server.ts
🧬 Code graph analysis (2)
packages/solid-start/src/default-entry/server.ts (1)
packages/react-start/src/default-entry/server.ts (2)
  • ServerEntry (11-11)
  • createServerEntry (13-19)
packages/react-start/src/default-entry/server.ts (1)
packages/solid-start/src/default-entry/server.ts (2)
  • ServerEntry (11-11)
  • createServerEntry (13-19)
⏰ 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). (2)
  • GitHub Check: Preview
  • GitHub Check: Test
🔇 Additional comments (3)
packages/solid-start/src/default-entry/server.ts (1)

10-21: LGTM! Clean wrapper pattern for future extensibility.

The createServerEntry factory provides a type-safe abstraction that maintains the current pass-through behavior while establishing a clear extension point for adding error handling (try/catch) in the future. The async/await pattern and the helpful comment about RequestHandler import specificity are both well-considered.

packages/react-start/src/default-entry/server.ts (1)

10-21: LGTM! Consistent implementation across frameworks.

The implementation mirrors the solid-start version, providing the same type-safe wrapper pattern with future extensibility. The consistency across frameworks ensures a uniform API surface for users.

docs/start/framework/react/guide/server-entry-point.md (1)

27-27: The import path is correctly configured and verified.

The export configuration exists in packages/react-start/package.json: the ./server-entry export is properly mapped to ./dist/default-entry/esm/server.js, which corresponds to the implementation at packages/react-start/src/default-entry/server.ts. The documentation's import statement is valid.


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

@nx-cloud
Copy link

nx-cloud bot commented Nov 13, 2025

View your CI Pipeline Execution ↗ for commit 6e37b29

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 5m 51s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 13s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-13 10:54:37 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 13, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5859

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5859

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5859

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5859

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5859

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5859

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5859

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5859

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5859

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5859

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5859

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5859

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5859

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5859

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5859

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5859

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5859

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5859

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5859

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5859

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5859

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5859

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5859

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@5859

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5859

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5859

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5859

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5859

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5859

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5859

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5859

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5859

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5859

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5859

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5859

commit: 6e37b29

@TkDodo TkDodo marked this pull request as ready for review November 13, 2025 10:29
@schiller-manuel schiller-manuel merged commit 30b4541 into main Nov 13, 2025
6 checks passed
@schiller-manuel schiller-manuel deleted the feature/serverEntry-wrapper branch November 13, 2025 21:09
roduyemi pushed a commit to roduyemi/oss-router that referenced this pull request Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants