एक पूर्ण वेब ऐप + बैकएंड बनाएँ (Google AI Studio + Firebase)

अपने AI-जनित प्रोजेक्ट को एक कार्यात्मक वेब ऐप में बदलना सीखें जिसमें वास्तविक लॉगिन, उपयोगकर्ता डेटा और फ़ाइल अपलोड हों — सब कुछ Google AI Studio के अंदर बनाया गया।

रोडमैप और संसाधन

उपयोगकर्ता ऑथेंटिकेशन (Sign Up & Login)

प्रारंभिक कॉन्फ़िगरेशन

Firebase प्रोजेक्ट बनाएँ वेब ऐप रजिस्टर करें ईमेल/पासवर्ड ऑथेंटिकेशन सक्षम करें Google साइन-इन सक्षम करें ऑथेंटिकेशन ईमेल टेम्पलेट में भेजने वाले का नाम अपडेट करें Firebase Web SDK कॉन्फ़िगरेशन कॉपी करें

Google साइन-इन की आवश्यकता

जब तक ऐप डिप्लॉय नहीं हो जाता और लाइव डोमेन को Firebase Authorized Domains में नहीं जोड़ा जाता, तब तक Google साइन-इन काम नहीं कर सकता।

डिप्लॉयमेंट गाइड

डिप्लॉयमेंट गाइड देखें

https://youtu.be/HGs-4QjyjHQ?si=9fXzfJtkd3UNsqhQ

Firebase Authentication कनेक्ट करें

Google AI Studio प्रोजेक्ट को Firebase से जोड़ें और साइन-अप, लॉगिन तथा लॉगआउट सक्षम करें।

Firebase Authentication कनेक्ट करें

इस SDK का उपयोग करके मेरे मौजूदा वेब ऐप को Firebase से जोड़ें...

Connect my existing web app to Firebase using this SDK: {{FIREBASE_CONFIG}} Requirements: - Use Firebase Authentication only - Do NOT use Firestore or Storage yet - Do NOT redesign the UI Authentication behavior: - Users can sign in using email and password - If credentials are incorrect, show: "Email or password is incorrect" - Users can sign up using email and password - If the email already exists, show: "User already exists. Please sign in" For now: - Authenticate users only - Do NOT save user profile data Flow: - On successful sign-in or sign-up, redirect to the dashboard - Add a logout button that signs the user out and returns to the auth screen

Firebase कॉन्फ़िग (firebaseConfig)

अपना firebaseConfig ऑब्जेक्ट यहाँ पेस्ट करें

ईमेल सत्यापन लागू करें

एक सत्यापन ईमेल भेजें, स्वतः लॉगिन रोकें, और ईमेल सत्यापित होने तक पहुँच अवरुद्ध रखें।

ईमेल सत्यापन लागू करें

केवल Firebase Authentication का उपयोग करके ईमेल सत्यापन लागू करें...

Implement email verification using Firebase Authentication only. - When a user registers with email/password, do not sign them in automatically. - Send a verification email and show a verification screen with this message: “We have sent you a verification email to [user email]. Please verify it and log in.” - Include a Login button on the verification screen. - If a user logs in and their email is not verified, block access and show the same verification screen. - Do not use Firestore or any database — Firebase Authentication only.

उपयोगकर्ता डेटा स्टोर करें (Firestore)

Firestore कॉन्फ़िगरेशन

Firestore डेटाबेस बनाएँ Standard एडिशन चुनें डेटाबेस रीजन चुनें Production मोड चुनें Firestore सुरक्षा नियम जोड़ें और प्रकाशित करें

Firestore सुरक्षा नियम (प्रति-उपयोगकर्ता डेटा आइसोलेशन)

rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { // Root user document match /users/{userId} { allow read, write: if request.auth != null && request.auth.uid == userId; // Anything nested inside this user: // subcollections, documents, folders, files, unlimited levels match /{allPaths=**} { allow read, write: if request.auth != null && request.auth.uid == userId; } } } }

Firestore डैशबोर्ड सेक्शन जोड़ें

फ़ाइलों, नोट्स और टीम सदस्यों के लिए डैशबोर्ड सेक्शन बनाएँ, फिर उन्हें Firestore से जोड़ें।

Firestore डैशबोर्ड सेक्शन जोड़ें

ऐसे डायनामिक डैशबोर्ड सेक्शन जोड़ें जो Firestore से उपयोगकर्ता डेटा सेव और लोड करें।

Enhance the current dashboard by adding 3 fully functional sections: 1) My Files 2) My Notes 3) Team Members IMPORTANT RULES: - Use Firebase Authentication + Firestore only. - Do NOT use browser prompts (window.prompt / alert). - Use clean in-app modals for all actions. - Each user sees ONLY their own data. - Keep the existing VaultFlow UI style (cards, spacing, buttons). ==================== DATA STRUCTURE ==================== Use Firestore under the authenticated user: users/{uid} - displayName - email - plan - createdAt users/{uid}/folders/{folderId} - name - createdAt users/{uid}/files/{fileId} - name - folderId (optional) - size - createdAt (Note: metadata only, no real uploads yet) users/{uid}/notes/{noteId} - title - content (optional) - createdAt users/{uid}/teamMembers/{memberId} - name - role (optional) - createdAt ==================== UI BEHAVIOR ==================== My Files - Buttons: "New Folder" and "Add File" - Show folders and files - Empty state + loading state My Notes - Button: "New Note" - Show notes as cards - Empty state + loading state Team Members - Button: "Add Member" - Show list of members - Empty state + loading state ==================== MODALS (NO BROWSER PROMPTS) ==================== - New Folder: input name → save to Firestore - Add File: name + optional folder + size → save - New Note: title + content → save - Add Member: name + role → save All modals: - Cancel / Create - Validation - Loading state - Update UI instantly after save ==================== SECURITY ==================== Add Firestore rules so: - Only the logged-in user can read/write their own data - request.auth.uid must match {uid} ==================== RESULT ==================== After refresh: - Data persists - Buttons work - Counts update - No browser dialogs - Dashboard feels like a real SaaS app

फ़ाइल अपलोड (Firebase Storage)

Storage कॉन्फ़िगरेशन

Firebase Storage सक्षम करें बिलिंग अकाउंट लिंक करें और Blaze प्लान में अपग्रेड करें स्टोरेज लोकेशन चुनें Production मोड चुनें Firebase Storage सुरक्षा नियम जोड़ें और प्रकाशित करें

Storage चालू करने के लिए बिलिंग ज़रूरी है। शुल्क तभी लगता है जब उपयोग शामिल मुफ़्त सीमा से अधिक हो जाए।

Firebase Storage सुरक्षा नियम (प्रति-उपयोगकर्ता फ़ाइल आइसोलेशन)

rules_version = '2'; service firebase.storage { match /b/{bucket}/o { match /user_uploads/{uid}/{allPaths=**} { allow read, write: if request.auth != null && request.auth.uid == uid; } } }

मेरी फ़ाइलों को Firebase Storage से कनेक्ट करें

मेरी फ़ाइलों को Firebase Storage से कनेक्ट करें

ऐप के फ़ाइल अपलोड सिस्टम को प्रति-उपयोगकर्ता सुरक्षित फ़ोल्डर के साथ Firebase Storage से जोड़ें।

Connect the existing “My Files” section to Firebase Storage + Firestore. CONTEXT - Firebase Auth + Firestore already work in this project. - Firebase Storage is enabled. - Storage rules allow only: /user_uploads/{uid}/{allPaths=**} for the logged-in user. GOAL Make these buttons fully functional: 1) Add File (upload) 2) Download 3) Delete And keep the current UI style (table, buttons, spacing). No redesign. IMPORTANT RULES - Use Firebase Authentication + Firestore + Firebase Storage only. - Do NOT use browser prompts (window.prompt/alert). - Use clean in-app modal for “Add File”. - Each user sees ONLY their own files. - Upload path MUST be: user_uploads/{uid}/{fileName} - Save metadata in Firestore under: users/{uid}/files/{fileId} UI BEHAVIOR A) Add File button - Open an in-app modal: “Upload File” - Inside modal: - File picker (click to choose file) using a hidden <input type="file"> - Optional: select folder (if folders exist) - Upload button - Show upload progress (percentage) + loading state - When upload finishes: - Save metadata doc to Firestore: users/{uid}/files/{fileId} with: - name (original file name) - storagePath (e.g. user_uploads/{uid}/{fileId}-{name}) - downloadURL - size - type (mimeType) - folderId (optional) - createdAt (serverTimestamp) - Update the UI immediately (add row in the table) B) Display files - In “My Files” table, show: - name - type - size - actions: Download + Delete - Use the Firestore list under users/{uid}/files ordered by createdAt desc. C) Download button - Use the stored downloadURL from Firestore - Open it safely in a new tab OR trigger download (but no alert). D) Delete button - Delete from Storage using storagePath - Then delete the Firestore document - Update UI instantly EDGE CASES - If user is not logged in, block access. - Handle errors with inline UI message in the modal (no alerts). - Prevent double uploads (disable button during upload). - If upload fails, show error message. DELIVERABLE - Implement the missing handlers, modal, and Storage/Firestore logic. - Keep current design. Do not refactor unrelated code.

UI से कनेक्ट करें (डायनेमिक सिस्टम)

डायनामिक यूज़र इंटरफ़ेस सत्यापित करें

सत्यापित अकाउंट से साइन इन करें पुष्टि करें कि इंटरफ़ेस साइन-इन किए गए उपयोगकर्ता को पहचानता है जाँचें कि डैशबोर्ड उपयोगकर्ता का Firestore डेटा लोड करता है पुष्टि करें कि अपलोड की गई फ़ाइलें सही ढंग से दिख रही हैं

फ्री प्लान की फ़ाइल सीमा जोड़ें

मुफ़्त प्लान फ़ाइल सीमा जोड़ें

फ्री उपयोगकर्ता कितनी फ़ाइलें अपलोड कर सकते हैं यह सीमित करें और सीमा पूरी होने पर अपग्रेड संदेश दिखाएँ।

Add a free-plan limit to this app: • Max files allowed: 5 • Count files under: users/{uid}/files • If file count >= 5: – Disable Add File – Show message: “You’ve reached the free plan limit.” – Add an Upgrade button that opens a simple modal (title: “Upgrade your plan”, text + Close button) No real payments. UI only. Keep current design. Apply logic only to the logged-in user.

फ्री प्लान की सीमा का परीक्षण करें

मुफ़्त सीमा तक पहुँचने तक फ़ाइलें अपलोड करें पुष्टि करें कि अतिरिक्त अपलोड अवरुद्ध हैं जाँचें कि अपग्रेड संदेश सही ढंग से दिखता है

प्रोजेक्ट फ़ाइलें (वीडियो में उपयोग की गई)

वीडियो में इस्तेमाल किया गया वही Google AI Studio प्रोजेक्ट कॉपी करें और अपने अकाउंट में जोड़ें।

VaultFlow प्रोजेक्ट

ट्यूटोरियल में इस्तेमाल किया गया Google AI Studio प्रोजेक्ट

https://aistudio.google.com/app/prompts?state=%7B%22ids%22:%5B%221P-lytf__6kOkQnOcczVdgIbnOWuRwNF0%22%5D,%22action%22:%22open%22,%22userId%22:%22112386544465239683494%22,%22resourceKeys%22:%7B%7D%7D&usp=sharing

उपयोग कैसे करें

ऊपर दिया गया प्रोजेक्ट लिंक खोलें। ज़रूरत हो तो अपने Google अकाउंट में साइन इन करें। Google AI Studio में “Copy” पर क्लिक करें। प्रोजेक्ट आपके अकाउंट में जुड़ जाएगा और पूरी तरह संपादन योग्य हो जाएगा।

महत्वपूर्ण नोट

प्रोजेक्ट कॉपी करने के बाद, शामिल Firebase कॉन्फ़िगरेशन को अपने Firebase Web SDK कॉन्फ़िगरेशन से बदलें।