Skip to content

Conversation

@TkDodo
Copy link
Contributor

@TkDodo TkDodo commented Oct 29, 2025

when creating a custom server handler

Summary by CodeRabbit

  • New Features

    • Introduced ServerEntry type for server entry point definitions across React and Solid start frameworks.
  • Documentation

    • Improved documentation with new code examples and updated patterns for server entry point setup.

@TkDodo TkDodo marked this pull request as ready for review October 29, 2025 14:14
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

Walkthrough

Formalizes server entry configuration across React and Solid Start frameworks by extracting a named constant, exporting a ServerEntry type alias derived from the constant's shape, and updating documentation to demonstrate the new pattern. Fetch signatures are relaxed to remove explicit type annotations in favor of type inference.

Changes

Cohort / File(s) Change Summary
Documentation updates
docs/start/framework/react/guide/observability.md, docs/start/framework/react/guide/server-entry-point.md
Added ServerEntry type imports, demonstrated satisfies ServerEntry pattern, relaxed fetch signatures by removing explicit Request type annotations, and added optional opts?: RequestOptions parameter in examples.
React Start server entry
packages/react-start/src/default-entry/server.ts
Introduced serverEntry constant with as const assertion wrapping the fetch handler, exported ServerEntry type alias as typeof serverEntry, and changed default export from inline object to the new constant.
Solid Start server entry
packages/solid-start/src/default-entry/server.ts
Introduced serverEntry constant to hold the previous default-export object, exported ServerEntry type alias as typeof serverEntry, and changed default export to use the named constant.
Solid Start public exports
packages/solid-start/src/server.tsx
Added type-only re-export of ServerEntry from ./default-entry/server to extend public type exposure.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

  • Specific areas requiring attention:
    • Verify that the ServerEntry type aliases correctly capture the intended shape (particularly the fetch handler signature and any other properties).
    • Confirm that the relaxed fetch signatures (removing explicit Request annotations) don't create type inference ambiguities or break existing integrations.
    • Ensure the type-only re-export in packages/solid-start/src/server.tsx is properly scoped and doesn't conflict with existing exports.
    • Review documentation examples to confirm they accurately reflect the new pattern and don't introduce breaking changes for users.

Possibly related PRs

  • fix: remove test type #5358: Related through server entry API formalization—this PR establishes the ServerEntry type contract and pattern, while the retrieved PR removes a default server entry export example that aligns with this new structure.

Suggested reviewers

  • schiller-manuel
  • chorobin

Poem

🐰 A server entry, now with grace,
A constant carved in TypeScript's space,
The types align, the shapes align,
Across all frameworks, patterns shine,
No annotations needed here—
Inference makes the intent clear!

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 pull request title "feat: export type ServerEntry to allow typing of default exports" accurately and specifically describes the main objective of the changeset. The primary change across all modified files is the introduction and export of a new ServerEntry type alias that enables users to properly type their server entry default exports. This is evident in the core implementation changes where export type ServerEntry = typeof serverEntry is added to both React and Solid start packages, and the documentation is updated to demonstrate this typing pattern. The title is concise, avoids vague terminology, and clearly conveys the key change a developer would care about when scanning the commit history.
✨ 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/feat/types-for-serverEntry

📜 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 1ec3881 and db5e176.

📒 Files selected for processing (5)
  • docs/start/framework/react/guide/observability.md (2 hunks)
  • 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)
  • packages/solid-start/src/server.tsx (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/observability.md
  • 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/observability.md
  • 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/solid-start/src/server.tsx
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
  • packages/solid-start/src/server.tsx
🧬 Code graph analysis (2)
packages/solid-start/src/default-entry/server.ts (3)
examples/react/start-i18n-paraglide/src/server.ts (1)
  • fetch (5-7)
packages/react-start/src/default-entry/server.ts (1)
  • ServerEntry (16-16)
packages/solid-start/src/server.tsx (1)
  • ServerEntry (2-2)
packages/react-start/src/default-entry/server.ts (3)
examples/react/start-i18n-paraglide/src/server.ts (1)
  • fetch (5-7)
packages/solid-start/src/default-entry/server.ts (1)
  • ServerEntry (16-16)
packages/solid-start/src/server.tsx (1)
  • ServerEntry (2-2)
⏰ 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). (1)
  • GitHub Check: Test
🔇 Additional comments (7)
docs/start/framework/react/guide/observability.md (1)

522-546: LGTM! Documentation demonstrates the new typing pattern effectively.

The example correctly shows how to use the ServerEntry type with custom handlers. The satisfies keyword provides type checking while allowing parameter types to be inferred, which makes the code cleaner.

packages/solid-start/src/server.tsx (1)

2-2: LGTM! Type re-export properly exposes ServerEntry from the main package.

The type-only export makes ServerEntry available from @tanstack/solid-start/server without runtime overhead, maintaining consistency with the React Start implementation.

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

10-18: LGTM! Implementation mirrors the React Start pattern consistently.

The Solid Start implementation follows the same pattern as React Start, which is excellent for consistency across frameworks. The as const assertion and type export enable the same type-safe satisfies pattern.

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

15-21: LGTM! Clear demonstration of the new import and usage pattern.

The example effectively shows how to import and use the ServerEntry type with the default handler, making the PR objective clear.


47-58: LGTM! Custom handler example demonstrates the typing pattern well.

The example shows how users can create custom handlers while maintaining type safety with satisfies ServerEntry.


68-87: LGTM! Request context example demonstrates advanced usage effectively.

The example clearly shows how to augment the Register interface and pass typed context through the server handler, which is valuable for users building custom server logic.

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

10-18: The package exports configuration is properly set up. The ./server-entry export is correctly defined in package.json, pointing to ./dist/default-entry/esm/server.d.ts and ./dist/default-entry/esm/server.js, which corresponds to the source file at packages/react-start/src/default-entry/server.ts. The code implementation follows TypeScript best practices with the as const pattern and proper type exports.


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

@nx-cloud
Copy link

nx-cloud bot commented Oct 29, 2025

View your CI Pipeline Execution ↗ for commit 93bc750

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

☁️ Nx Cloud last updated this comment at 2025-10-29 14:36:31 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 29, 2025

More templates

@tanstack/arktype-adapter

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

@tanstack/directive-functions-plugin

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/zod-adapter

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

commit: 93bc750

@TkDodo TkDodo merged commit e44b5dc into main Oct 29, 2025
6 checks passed
@TkDodo TkDodo deleted the feature/feat/types-for-serverEntry branch October 29, 2025 22:23
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.

2 participants