zod-firestore-type-safety
Installation
SKILL.md
Zod Firestore Type Safety
Overview
Firestore is schemaless, creating a mismatch with TypeScript's compile-time types. Zod bridges this gap by providing runtime validation at the application boundary, ensuring data integrity.
Core Pattern: Zod + withConverter
The Atomic Unit
Every Firestore collection requires three components:
- Zod Schema: Runtime validation definition
- TypeScript Type: Inferred from Zod schema
- Converters: Client and server withConverter objects