Claude Code के साथ Firestore Schema Design: Collections से पहले Queries
Claude Code से Firestore schema, indexes, cost और security rules को query-first तरीके से design करने की practical guide.
Firestore design queries से शुरू होता है
मैं Masa हूं, claudecode-lab.com चलाता हूं।
Firestore में पहली गलती अक्सर यह होती है कि हम पहले collections सोचते हैं: users, posts, comments। लेकिन वास्तविक screens आने पर समस्या दिखती है: published posts, author page, draft list, tag page. Firestore SQL joins वाली database नहीं है।
बेहतर workflow है: पहले app की queries लिखें, फिर schema बनाएं।
Official references:
claude -p "
CMS के लिए Firestore design करो।
Collections से पहले required queries की table बनाओ।
where/orderBy/limit और composite indexes भी लिखो।
"
export interface PostDoc {
id: string;
slug: string;
title: string;
status: "draft" | "published" | "archived";
lang: "ja" | "en" | "es" | "ko";
authorId: string;
authorName: string;
tagSlugs: string[];
tagNames: string[];
publishedAt: FirebaseFirestore.Timestamp | null;
updatedAt: FirebaseFirestore.Timestamp;
}
List screen में extra reads कम करने के लिए authorName और tagNames जैसे छोटे fields duplicate करना practical है। Indexes को Git में रखना चाहिए:
{
"indexes": [
{
"collectionGroup": "posts",
"queryScope": "COLLECTION",
"fields": [
{ "fieldPath": "lang", "order": "ASCENDING" },
{ "fieldPath": "status", "order": "ASCENDING" },
{ "fieldPath": "publishedAt", "order": "DESCENDING" }
]
}
]
}
मेरे experience में, query table पहले बनवाने से schema review काफी बेहतर हुआ। Claude Code को सीधे code लिखवाने के बजाय पहले query, index, cost और security risks दिखाने दें।
मुफ़्त PDF: 5 मिनट में Claude Code चीटशीट
बस अपना ईमेल दर्ज करें और हम तुरंत A4 एक-पृष्ठ चीटशीट PDF भेज देंगे।
हम आपकी व्यक्तिगत जानकारी की सुरक्षा करते हैं और स्पैम नहीं भेजते।
अपने Claude Code वर्कफ़्लो को अगले स्तर पर ले जाएँ
Claude Code में तुरंत कॉपी-पेस्ट करने योग्य 50 आज़माए हुए प्रॉम्प्ट टेम्पलेट।
लेखक के बारे में
Masa
Claude Code का गहराई से उपयोग करने वाले इंजीनियर। claudecode-lab.com चलाते हैं, जो 10 भाषाओं में 2,000 से अधिक पेजों वाला टेक मीडिया है।
संबंधित लेख
Codex Automations क्या है? AI से content ops, analysis और deploy करवाने का तरीका
Codex Automations से analytics, article planning, CTA सुधार, deploy और monetization workflow चलाने की practical guide.
Claude Code × GCP Cloud Functions संपूर्ण गाइड | सर्वरलेस फंक्शन तेज़ी से विकसित करें
Claude Code से GCP Cloud Functions को ऑप्टिमाइज़ करें। HTTP/Pub/Sub/Firestore ट्रिगर, लोकल टेस्टिंग और डिप्लॉयमेंट ऑटोमेशन — Masa के व्यावहारिक अनुभव से रियल कोड उदाहरणों के साथ।
Claude Code × GCP Cloud Run संपूर्ण गाइड | सर्वरलेस कंटेनर ऑटो-डिप्लॉयमेंट
Claude Code के साथ GCP Cloud Run डिप्लॉयमेंट को तेज़ करें। Dockerfile जनरेशन, ऑटो-स्केलिंग, CI/CD पाइपलाइन और Secret Manager इंटीग्रेशन के साथ पूर्ण गाइड।