July 22, 2025

Building Effectful queries with TanStack and RPC at 14.ai

Building Effectful queries with TanStack and RPC at 14.ai

A powerful combo: Effect RPC + TanStack Query.

Last year, during his internship with us, Ethan Niser implemented (among a bunch of other amazing things!) an Effect wrapper around TanStack Query.

We haven't looked back since. It's handling queries and mutations in a fully Effectful way, meaning we can reason in Effects end-to-end between the client and the backend.

Above is a canonical example of a query (here, for fetching customer organizations in the 14.ai app).

One important point to make: LLMs are extremely good at understanding this kind of code. Adding a new ontological entity and implementing database schemas + models + data fetching + RPC routes + query/mutation hooks is now one-shotted by Claude Code.

We're incredibly productive in this setup!