Move fast and break nothing, now with 100% confidence
Keep track of when a field was added and removed, to help you accelerate your development with confidence.
Scale your tRPC APIs with full confidence
Make sure your changes aren't breaking your schema for external consumers, internal teams, or other non-web application clients depending on your API.
Schema-driven development, without the pain
When working with web applications we're sometimes spoiled that our updates can be deployed instantly. But this model does not apply to all types of applications and architectures. tRPC Drift helps you manage your schema and track incoming changes so that you can be confident that your schema is honored and that your changes are not breaking anything.
Github Integration
Integrate tRPC with a single, preconfigured, Github Actions workflow, and watch the changes come in automatically. Use the action's output in your branch protection to prevent merging breaking changes.
Learn moreCode OwnersComing Soon
Define fine-grained code owners for your schema and block breaking changes. Once the change is approved, the change can be merged and deployed.
Prevent leaking sensitive data
With tRPC Drift, you can generate output validation middleware that makes sure you're fully adhering to your schema, no more, no less. Only fields explicitely stated in your schema will be returned to the clients. All in 3 simple steps.
Add the codegen plugin to your config
import { zodMiddlewarePlugin } from "<redacted>";
export default {
codegen: {
plugins: [zodMiddlewarePlugin()],
},
};
import { zodMiddlewarePlugin } from "<redacted>";
export default {
codegen: {
plugins: [zodMiddlewarePlugin()],
},
};
Extend your base procedure to utilize the middleware
import { zodOutputMiddleware } from "./trpc/output-middleware.js";
const publicProcedure = t.procedure.use(zodOutputMiddleware);
export const myRouter = router({
getUser: publicProcedure.query(() => {
return {
name: "John",
age: 42,
password: "secret", // whoops, we probably don't want to expose this
};
}),
});
import { zodOutputMiddleware } from "./trpc/output-middleware.js";
const publicProcedure = t.procedure.use(zodOutputMiddleware);
export const myRouter = router({
getUser: publicProcedure.query(() => {
return {
name: "John",
age: 42,
password: "secret", // whoops, we probably don't want to expose this
};
}),
});
Call the procedure from your client
Your schema will be honored and no extra fields will be leaked. Only once your schema is updated and accepted, will the new fields be returned.
const user = await trpc.getUser.query();
// ^? { name: string; age: number; }
const user = await trpc.getUser.query();
// ^? { name: string; age: number; }