TanStack

T

TanStack

TanStack is a community of passionate software engineers striving for high-quality, open-source software for web devs

Join

react-query-questions

solid-query-questions

table-questions

virtual-questions

router-questions

react-charts-questions

ranger-questions

vue-query-questions

svelte-query-questions

bling-questions

form-questions

angular-query-questions

start-questions

db-questions

start-showcase

router-showcase

📣-announcements

sunny-green
sunny-green3/7/2025

stale time on a serverFn?

is there a way to set a stale time on an individual serverFn? I'd like to be able to have more granular control over my root loader and refetch certain server functions but cache the others.
correct-apricot
correct-apricot3/7/2025

Global Error handler in start?

I have an issue where I am throwing errors from some server functions but when I try to catch them in the client I don't have a good way to actually identify if the error is okay to display to the user because I threw it or if its caused by something I don't want to expose. Generally in an API you would have a custom error class and a global error handler that catches all errors and returns a generic error for all errors that are not instances of your custom error class. Is there a way to do something similar in Start? Or can I solve this issue a different way? To be as clear as possible what I want is to be able to send errors from my server functions and have the client display them. But I want to send/display a generic error for anything unexpected and send/display more informative errors otherwise...
vicious-gold
vicious-gold3/7/2025

Building large-surface APIs in TSS

I'm building out a service that needs lots and lots of public facing API endpoint. Probably around ~70. I love me some file routing - but I think I'll regret it. Most of these routes share common resources and I'm envisioning quite a lot of createFileRoute overhead. What's the best call here? Spin up a seperate project for the API? Throw a hono server in a catch-all (does that even work?)...
like-gold
like-gold3/6/2025

Testing Server Functions with vitest (including validation + middleware)

Hi friends - looking to write tests for my server functions (preferring vitest, but openminded). With my current implementation, the "result" of my function call is undefined even when logs inside the function body show that it should be returning data. Additionally, it looks like middleware and validator functions are not running (I'm seeing no logs from my middleware functions, and not getting the expected errors from validation or auth middleware). Looking for any guidance on the write setup here!...
like-gold
like-gold3/5/2025

Is there a way to disable default logs on server functions in development?

I'm implementing my own logging and the doubling up is a lot. Also: would love to disable the "injected from server" logs that appear in the browser
genetic-orange
genetic-orange3/5/2025

How to test ServerFn with vitest ?

Hey guys, I am trying to add some tests with vitest into my tanstack start app. And I tought I would test the bunch of serverFns that I have. I am using vitest for my testing framework and testcontainer to mock my db. So far those 2 libraries are working fine. However when I try to call a serverFn in vitest I get the following error:...
vicious-gold
vicious-gold3/5/2025

Ensure server-only code remains server-only

having a bit of trouble understanding how "server only" code stays "server only" in TSS. i assume this dynamic import is an anti pattern: ```ts export const listOrganizations = async () => { const auth = await import("@/lib/server/auth").then((mod) => mod.auth);...
deep-jade
deep-jade3/4/2025

Does some one have a basic example of TSS + Tailwindcss v4 + theming ?

looking for an example as i am having issue with my current setup, half of the styles are missing
correct-apricot
correct-apricot3/4/2025

Validators and schema

Hey, I'm reading through the getting started docs and have a question about validators - do they accept only zod schemas or do they allow any other validation libraries? https://tanstack.com/start/latest/docs/framework/react/learn-the-basics#mutations There's a nice spec Standard Schema, and was wondering if I could use other validation library here. ...
flat-fuchsia
flat-fuchsia3/3/2025

server fn error in fresh trellaux example

I decided to start learning about tanstack start by running the trelleaux example but I hit an exceptioin when hovering on the "first board" it creates: ``` ServerFn Request: app_db_board_ts--getBoard_createServerFn_handler ...
adverse-sapphire
adverse-sapphire3/3/2025

Accessing env vars in the client

Is there a way to access an env var (parsed via process.env in the client? It's a CLIENT_ID that I need to share between client and server. If I import it directly and/or pass it to the client via loader data I receive some weird errors probably caused by tree shaking removing those variables....
ambitious-aqua
ambitious-aqua3/3/2025

Example project - npm vulnerabilities / esbuild

I pulled this example project to start tinkering with tanstack start: Basic + React Query (start-basic-react-query) But when I run the npm install or try to fix the versions I keep getting these vulnerabilitie warnings. Any solution for this or advice? I've tested updating all of the versions and no change. Is everyone just ignoring it?...
extended-salmon
extended-salmon3/3/2025

SVG Logo

Hi, I am building the official Sentry SDK for TanStack Start and we would need an SVG logo for our docs. Is there one I can use?
adverse-sapphire
adverse-sapphire3/3/2025

Most ergonomic way to validate and read query/search params in API routes

Is there something similar to validateSearch (available in regular routes) for API routes? Or what's the most ergonomic way to parse and read query params?
correct-apricot
correct-apricot3/2/2025

How to make beforeLoad hook run once in root route in Tanstack Start?

Hey there. As the title says, I have a beforeLoad hook in root route which returns the user session and color theme in the context, which I use in another pathless (_authed) file to redirect the unauthenticated users. The thing is that for example, when I am trying to navigate from /settings/profile to /settings/security, this beforeLoad hook runs again on the client. Every single route match triggers this hook. So far, I tried some properties from tanstack router such as (staleTime, gcTime, shouldReload), but did not work around. It seems like they only work with the loader() hook. ``` beforeLoad: async () => { try { const [theme, session] = await Promise.all([getTheme(), getSession()]);...
stormy-gold
stormy-gold3/2/2025

Recommended way to implement CORS, CRSF, ETag, Secure Headers and other security features

What is the recommended way to implement CORS is it to use the H3 util and define it per route. Is it to import cors packaged as middleware and use as a global middleware? Curious how people are hanlding their security and if there should be a standard implementation. Also are you using middlewares for CSRF, Etag headers
adverse-sapphire
adverse-sapphire3/2/2025

Non API/API routes?

Is there a way to have something like API routes even though it's not part of an API. An example of this would be the OpenID connect protocol or OAuth2 protocol for authentication. For example Google calls a callback that needs to be a GET but Apple wants to call a POST and pass me the data in form-data format. Is there a way to just have a GET/POST handler that then redirects to the rest of the website? Thanks...
fascinating-indigo
fascinating-indigo3/2/2025

Im Really struggling to deploy Tanstack Start to Cloudflare

Im getting this error
Error: Failed to publish your Function. Got error: Uncaught Error: No such module "node:http".
imported from "bundledWorker-0.5912871363042873.mjs"
Error: Failed to publish your Function. Got error: Uncaught Error: No such module "node:http".
imported from "bundledWorker-0.5912871363042873.mjs"
```toml wrangler.toml name = "vuudra-search" main = "./.output/server/index.mjs"...
adverse-sapphire
adverse-sapphire3/1/2025

How would you guy use HonoJS in Start?

I want to migrate my NextJS app with a Hono server inside of it to Start, I implemented as the Hono tutorial. How should I implement it in Start?
deep-jade
deep-jade2/28/2025

Emotion and Tanststack Start

Have someone have successfully manage to configure emotion base framework like material-ui with tankstack Start ? Bae on the documentation https://mui.com/material-ui/guides/server-rendering/ we need to ReactDOMServer.renderToString the whole component on the server and extract/build the css and inject it into the meta tag. Here are express (https://github.com/mui/material-ui/tree/v6.x/examples/material-ui-express-ssr) and remix (https://github.com/mui/material-ui/tree/v6.x/examples/material-ui-remix-ts) configuration... I dont see a way within ssr.tsx to renderToString the whole page.... any suggestion?...