tanstack-start-middleware

Installation
SKILL.md

TanStack Start middleware

Use this pattern when a shared src/start.ts must register request middleware whose implementation imports Node-only modules.

Problem

These both fail, for different reasons:

  • Dynamic import() inside .server(...) violates static-dependency and Effect lint rules.
  • Importing a .server.ts middleware value and placing it directly in createStart({ requestMiddleware }) makes TanStack Start's client import-protection plugin reject the server-only import.

Pattern

Keep the implementation in a .server.ts module and export the request handler, not the completed middleware object:

// tracing-middleware.server.ts
import type { RequestServerFn } from "@tanstack/react-start"
Installs
10
Repository
anis-dr/skills
GitHub Stars
4
First Seen
Sep 26, 2026