Keep React routes, session checks and cached server data working from the same types.

9 files · 10 KB

TanStack ↗

Why I keep it

I use TanStack Router and Query in the Vite starter, so routes and components read the same cached session. The protected layout checks that session before rendering, while a 401 sends the visitor to sign in with a route back to their work.

I’ve included the route tree, Query client, session query and a Zod-checked API helper, so you can add features inside the same pattern. The tree lives in src/app/router.tsx because I want the routing decisions readable in one file.

Take the files

9 files · 10 KB

  • README.md3 KB
  • src/app/router.tsx4 KB
  • src/features/auth/queries.ts379 B
  • src/features/organisations/queries.ts534 B
  • src/features/organisations/search.ts124 B
  • src/lib/api.ts654 B
  • src/lib/query-client.ts1015 B
  • src/main.tsx603 B
  • vite.config.ts797 B

Keep building your setup: The stack

Back to the shelves →
  • 015 files · 151 KB

    The SaaS starter

    Start with accounts, organisations, email and analytics wired into a React app and Hono API.

  • 025 files · 6 KB

    Turborepo

    Run builds, tests and type checks across your apps in dependency order, with cached results.

  • 0316 files · 18 KB

    Hono

    Give your API typed routes, generated docs and a consistent error response before adding features.

  • 048 files · 8 KB

    Drizzle

    Keep your database schema typed and your SQL migrations checked in beside the code that needs them.

  • 052 files · 5 KB

    Better Auth with passkeys

    Keep accounts, organisations and passkey sign-in in your own Hono API and Postgres database.

  • 065 files · 5 KB

    Lefthook and Biome

    Check staged code at commit time and types before a push, including work written by your agents.