@zooly/types is a shared TypeScript types package used across the entire monorepo. It provides common type definitions, schemas, and interfaces that are used by multiple packages and apps.
This package is used to shared across client and server packages.
Make sure not to include srv only, or client only code.
@zooly/typespackages/typesAccount, User, StripePaymentThe package includes type definitions for:
StripePayment: Payment transaction recordsPayOut: Payout recordsPaymentShareTracking: Revenue distribution trackingAccountAgent: Agent relationshipsAccountPayoutRoute: Payout route configurationPpuCode: PPU (Purchase Proof URL) code recordsThis package is imported by other packages and apps to ensure type consistency across the monorepo. It helps maintain type safety and reduces duplication of type definitions.
To ensure database schemas remain compatible with their corresponding type definitions, each schema in the db package includes a _typeCheck declaration. This pattern verifies at compile time that the inferred schema type matches the expected type from @zooly/types.
If a schema doesn't match its type definition, the build will fail with a compile-time error, preventing type mismatches from reaching production.
import { pgTable, text, timestamp } from "drizzle-orm/pg-core";
import type { Account } from "@zooly/types";
/**
* Account table schema
*/
export const accountTable = pgTable("account", {
id: text("id").primaryKey(),
ownerUserId: text("owner_user_id").notNull().unique(),
displayName: text("display_name").notNull(),
// ... other fields
});
// Type compatibility check (will error at build time if incompatible)
const _typeCheck: Account = {} as typeof accountTable.$inferSelect;
This pattern ensures that any changes to the database schema are immediately caught if they don't align with the corresponding type definition, maintaining type safety across the entire codebase.