start-core/middleware

Enforce middleware execution order for TanStack Start server and client workflows.

Updated Apr 2, 2026
One-click install
npx skills add https://github.com/abereghici/skills --skill start-core-middleware-abereghici
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: start-core/middleware
Source: https://github.com/abereghici/skills/tree/main/vendor/tanstack-router/packages/start-client-core/skills/start-core/middleware
Command: npx skills add https://github.com/abereghici/skills --skill start-core-middleware-abereghici

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Centralize and enforce the correct ordering and configuration of middleware for TanStack Start, spanning request middleware, server function middleware, and global middleware, so behavior is predictable and secure across client and server boundaries.

Core Features & Use Cases

  • Enforces the definitive middleware execution order: middleware → inputValidator → client → server.
  • Supports both request and server function middleware with context passing via next().
  • Integrates with start.ts global configuration to apply middleware across routes and server functions.

Quick Start

Provide a cohesive middleware stack for an API endpoint with proper context propagation.

Frequently Asked Questions about start-core/middleware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I coordinate server and client middleware in TanStack Start?

TanStack Start middleware is coordinated using createMiddleware to enforce execution order: middleware → inputValidator → client → server. Context passes via next(), integrating with start.ts global configuration for predictable SSR and server function behavior.

What is the correct middleware execution order for TanStack Start server functions?

The correct middleware execution order is middleware → inputValidator → client → server. Enforcing this sequence ensures predictable behavior and security across client and server boundaries for server functions and routes.

How do I pass context through middleware in a TanStack Start application?

You pass context through TanStack Start middleware using the next() function. This allows data and configuration to propagate sequentially through the middleware stack before reaching server routes or server functions.

Can I apply middleware globally across all routes and server functions in TanStack Start?

Yes, you can apply middleware globally by integrating it with the start.ts global configuration. This centralizes middleware configuration to apply consistently across both server routes and server functions.

Does TanStack Start middleware support input validation before server execution?

Yes, TanStack Start middleware supports optional input validation. It is positioned in the execution sequence between the initial middleware and the client and server phases to validate inputs before processing.

Why does my TanStack Start server function run before client middleware completes?

Server functions may run before client middleware completes if the definitive execution order is not enforced. Using createMiddleware ensures the sequence runs middleware → inputValidator → client → server to prevent boundary issues.