PKahfi Blueprint

Platform Engineering Standards

Engineering: API Architecture

API Reference & Standards

We prioritize end-to-end type safety. Most of our internal communication happens via tRPC, ensuring our frontend and backend are always in sync without code generation.

Type-Safe

No runtime errors for API calls.

Zero Codegen

Share types natively via TypeScript.

Introspective

Auto-completion for all inputs/outputs.

Standard Procedure Pattern

// Define a procedure with multi-tenant context

export const getTenantStats = protectedProcedure

  .input(z.object({ id: z.string() }))

  .query(async ({ ctx, input }) => {

    // ctx.tenant is automatically populated via middleware

    return await ctx.db.tenantStats.findUnique({ ... });

  });

Internal API SDK

Want to consume these APIs from another service? Use our shared client lib.

npm install @repo/api-client