⚠️ Important: Firetype extends the Firestore SDK and is not a replacement. You’ll still need
to install and use either
firebase-admin or firebase/firestore as your primary SDK.✨ Features
- 🎯 Full Type Safety: Complete TypeScript type inference for all Firestore operations with zero runtime overhead
- 📁 Folder-Based Schema: Organize your database structure naturally in directories, including nested collections
- 🔄 Runtime Validation: Optional Zod-powered schema validation with detailed error messages
- 🛠️ Powerful CLI: Generate type definitions with flexible configuration options
- ⚡ SDK Agnostic: Works seamlessly with both
firebase-adminandfirebase/firestoreSDKs - 🔗 Nested Collections: Full support for subcollections with automatic path generation
- 📊 Collection Groups: Type-safe collection group queries across all subcollections
- 🎨 Zero Config: Just define your schemas and let Firetype handle the rest
📦 Installation
Install Firetype using your preferred package manager:Peer Dependencies
Firetype requires one of the following Firestore SDKs (choose based on your environment):💡 Tip: Firetype works with both SDKs simultaneously if you need to support both client and
server environments.
🚀 Quick Start
Get started with Firetype in 5 minutes. This guide shows you how to set up type-safe Firestore operations.1. Set up your schema directory
Create a directory structure for your Firestore database schemas:2. Define your first collection schema
Createschemas/database/users/schema.ts:
3. Generate type definitions
Use the Firetype CLI to generate your types:index.ts file in your input folder with your fully typed Firestore API.
4. Use in your application
Server-side (Admin SDK)
Client-side (Web SDK)
5. Add subcollections (Optional)
Create nested collections by adding subdirectories. For user comments:schemas/database/users/comments/schema.ts:
📚 Documentation Sections
Schema Definition
Learn how to define your Firestore schemas with Zod
CLI Reference
Complete guide to the Firetype command-line interface
API Reference
Detailed API documentation with examples
Examples
Real-world usage examples and patterns
🆘 Need Help?
Troubleshooting
Common issues and their solutions