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

अपने Google AI Studio ऐप को Supabase से जोड़ने और एक प्रोडक्शन-रेडी बैकएंड बनाने के लिए कदम-दर-कदम गाइड।

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

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

Supabase प्रोजेक्ट सेट अप करें

Supabase खोलें

https://supabase.com/?utm_source=partner&utm_medium=social&utm_campaign=supasquad&dub_id=faVfKdcLWvKCbYNp

एक ऑर्गनाइज़ेशन बनाएँ और फ्री प्लान चुनें प्रोजेक्ट बनाएँ और सबसे नज़दीकी रीजन चुनें डेटाबेस पासवर्ड सेव करें Project URL और Publishable Key कॉपी करें

Project Settings Data API

Project URL

Project Settings API Keys

Publishable Key

Prompt 1 — Supabase कनेक्शन

Supabase कनेक्शन

इस प्रोजेक्ट के लिए एक सरल Supabase कनेक्शन फ़ाइल बनाएँ।

Create a simple Supabase connection file for this project. 1) Create a new file called: src/supabaseClient.js 2) Inside it, write a clean Supabase setup with two variables that I can replace later: const SUPABASE_URL = "{{SUPABASE_URL}}"; const SUPABASE_PUBLIC_KEY = "{{SUPABASE_KEY}}"; 3) Import createClient from "@supabase/supabase-js" and export one Supabase client: export const supabase = createClient(SUPABASE_URL, SUPABASE_PUBLIC_KEY); Make the file very simple and show clearly where I should paste my URL and my public key.

Supabase प्रोजेक्ट URL

अपनी Supabase project URL यहाँ पेस्ट करें

Supabase Publishable Key

अपनी Supabase publishable key यहाँ पेस्ट करें

Prompt 2 — ईमेल Auth लॉजिक

ईमेल Auth लॉजिक

इस प्रोजेक्ट के साइन-इन और साइन-अप पेज को Supabase Auth से जोड़ें।

Connect the Sign In and Sign Up pages in this project to Supabase Auth. Use the Supabase client from: src/supabaseClient.js 1) For Sign Up: - Use supabase.auth.signUp({ email, password }) 2) For Sign In: - Use supabase.auth.signInWithPassword({ email, password }) 3) After successful login or signup: - Redirect the user to the Home page ("/") 4) Add simple error handling: - If Supabase returns an error, show a small error message under the form Do not change the UI design — only add the logic to make these forms work. Show me only the updated Sign In and Sign Up files.

Prompt 3 — ईमेल पुष्टिकरण फ़िक्स

ईमेल पुष्टिकरण फ़िक्स

Supabase की ऑथेंटिकेशन लॉजिक ठीक करें ताकि वह असत्यापित उपयोगकर्ताओं को सही ढंग से संभाले।

Fix Supabase auth logic: * After signUp(), if data.session is null, don’t redirect to the dashboard. * Just show: "Check your email and confirm your account before logging in." * Only redirect when a real session exists after login. * Protect private pages with supabase.auth.getSession() — if no session, redirect to /login.

Prompt 4 — Signup UX सुधार

Signup UX सुधार

मेरे Supabase ईमेल/पासवर्ड साइन-अप फ़्लो का UX बेहतर करें।

Improve the UX of my Supabase email/password signup flow. Current behavior: - When the user completes Sign Up, the app goes back to the Sign In page, but there is no success message and the email field is empty. I want the following behavior: 1) After a successful Supabase signUp({ email, password }): - Do NOT auto-login. - Redirect the user to the Sign In page. - Keep / pre-fill the email they just used for signup in the Sign In form. 2) On the Sign In page: - If the user comes from a successful signup: - Show a clear success message above the form, for example: "Your account has been created. Please check your email and verify your address before logging in." - The email input should already contain the email used during signup. 3) You can pass the email from Sign Up to Sign In using: - router state, OR - a query parameter, OR - any simple, clean method that works well with this project. 4) Keep the existing design and layout exactly the same. Just add: - the logic for passing the email - the success message on the Sign In screen - and basic error handling if signup fails. Show me only the updated Sign Up and Sign In components.

डिप्लॉयमेंट (Google OAuth के लिए आवश्यक)

वेब ऐप डिप्लॉय करें

डिप्लॉयमेंट वीडियो देखें

डिप्लॉयमेंट वीडियो देखें

https://youtu.be/HGs-4QjyjHQ?si=b2qf5p0-stltUKw4

Supabase में Site URL और Redirect URL जोड़ें एक Google Cloud प्रोजेक्ट बनाएँ OAuth सहमति स्क्रीन कॉन्फ़िगर करें वेब OAuth क्लाइंट बनाएँ और ज़रूरी URL जोड़ें Client ID और Client Secret को Supabase में जोड़ें, फिर Google साइन-इन सक्षम करें

Prompt 5 — Google Sign-In

Google Sign-In

“Continue with Google” बटन को Supabase OAuth से काम करने लायक बनाएँ।

Make the “Continue with Google” button work using Supabase OAuth. Use the supabaseClient.js file. Add the Google login function and connect it to the button. Keep all UI exactly the same.

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

Prompt 6 — टेबल्स + CRUD उत्पन्न करें

टेबल्स + CRUD उत्पन्न करें

इस ऐप के लिए ज़रूरी डेटाबेस टेबल, CRUD लॉजिक और प्रति-उपयोगकर्ता सुरक्षा नीतियाँ जनरेट करें।

I want you to connect this web app to Supabase. 1) Analyze the existing project and detect all the data that should be saved in the database (for example: notes, tasks, posts, projects, or any items the app uses). 2) Based on the UI and the current features, generate the ideal SQL code to create the main table(s) in Supabase — including fields, types, timestamps, and user_id relations. Make sure rows belong only to the authenticated user using RLS + policies with auth.uid(). 3) After generating the SQL, write the Supabase code needed for: - loading the user's data - creating new items - updating items - deleting items 4) Use the existing components in the codebase without changing the design. Just replace the placeholder/local data logic with real Supabase queries. Keep everything simple, clean, and easy to copy-paste.

डेटाबेस बनाएँ और सत्यापित करें

जनरेट किया गया SQL कॉपी करें Supabase SQL Editor खोलें SQL पेस्ट करके चलाएँ पुष्टि करें कि टेबल बन गए हैं Row Level Security नीतियों की समीक्षा करें ऐप में एक टेस्ट रिकॉर्ड बनाएँ पुष्टि करें कि रिकॉर्ड Supabase में दिख रहा है

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

Supabase Storage सेट अप करें

Supabase Storage खोलें app-files नाम का बकेट बनाएँ बकेट को प्राइवेट रखें Supabase SQL Editor खोलें स्टोरेज पॉलिसी स्क्रिप्ट चलाएँ पुष्टि करें कि स्टोरेज पॉलिसी बन गई हैं

Storage पॉलिसी

create policy "Users can view own files" on storage.objects for select to authenticated using ( bucket_id = 'app-files' and name like (auth.uid()::text || '/%') ); create policy "Users can upload to own folder" on storage.objects for insert to authenticated with check ( bucket_id = 'app-files' and name like (auth.uid()::text || '/%') ); create policy "Users can update own files" on storage.objects for update to authenticated using ( bucket_id = 'app-files' and name like (auth.uid()::text || '/%') ); create policy "Users can delete own files" on storage.objects for delete to authenticated using ( bucket_id = 'app-files' and name like (auth.uid()::text || '/%') );

Prompt 7 — फ़ाइल अपलोड कनेक्ट करें

फ़ाइल अपलोड कनेक्ट करें

सभी फ़ाइल अपलोड सुविधाओं को प्रति-उपयोगकर्ता सुरक्षित फ़ोल्डर के साथ निजी app-files बकेट से जोड़ें।

I already created a Supabase Storage bucket named "app-files" (private) and added all required security policies so each user can only access files under their own folder. Now analyze my project and identify every place where users upload or select files (attachments, images, avatars, covers, etc.). Connect all existing upload features to Supabase Storage using this bucket: "app-files". Important folder rule: every uploaded file path must start with the user id: ${auth.uid()}/... Use a clean structure like: ${auth.uid()}/${featureName}/${itemId}/${uuid}.${extension} After uploading a file: - Save the returned file path in the correct database table according to my current data model. - Display files using signed URLs since the bucket is private. - Add delete logic: remove the file from Storage and remove its reference from the database. - Do NOT redesign the UI. Only connect the existing upload buttons/components to Supabase Storage.

फ़ाइल अपलोड का परीक्षण करें

ऐप के नवीनतम बदलाव प्रकाशित करें लाइव वेब ऐप खोलें टेस्ट अकाउंट से साइन इन करें एक टेस्ट फ़ाइल अपलोड करें पुष्टि करें कि फ़ाइल ऐप में दिख रही है Supabase में app-files बकेट खोलें पुष्टि करें कि फ़ाइल उपयोगकर्ता के फ़ोल्डर में सेव है

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

Prompt 8 — डायनेमिक कुल नोट्स

डायनेमिक कुल नोट्स

डैशबोर्ड के “Total Notes” कार्ड में साइन-इन उपयोगकर्ता की वास्तविक नोट संख्या Supabase से दिखाएँ।

You are working on my existing Supabase-powered AI Notes project. Goal: Make the "Total Notes" card on the dashboard show the real number of notes for the currently authenticated user. Requirements: 1. Fetch the current authenticated user using: supabase.auth.getUser() 2. Count the number of notes in the "notes" table where user_id = current user id. 3. Replace the static number in the dashboard with the real count from the database. 4. Do NOT redesign the UI. Only connect the existing "Total Notes" component to real Supabase data. 5. Keep the existing clean SaaS layout untouched. 6. Make sure it updates automatically when a note is created or deleted. Only modify necessary files. Do not change styling.

Prompt 9 — मुफ़्त प्लान सीमा

मुफ़्त प्लान सीमा

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

Now add simple SaaS plan logic to my existing Supabase AI Notes app. Goal: Free users can create a maximum of 3 notes. Requirements: 1. Before creating a new note: - Count how many notes the current user already has. 2. If notes count >= 3: - Block note creation. - Show a clean modal or alert: "Free plan limit reached. Upgrade to Pro to create unlimited notes." 3. Do NOT redesign the UI. Keep the existing design system. 4. Keep logic simple. No Stripe integration yet. Just front-end + Supabase validation. 5. Make sure users cannot bypass this limit by calling the create function manually. Keep everything clean and production-ready.

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

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

Supabase ट्यूटोरियल में इस्तेमाल किया गया वही Google AI Studio स्टार्टर प्रोजेक्ट कॉपी करें।

AI Notes — पूर्ण SaaS टेम्पलेट

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

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

निर्देश

ऊपर दिया गया प्रोजेक्ट लिंक खोलें। ज़रूरत हो तो अपने Google अकाउंट में साइन इन करें। Google AI Studio में “Remix” पर क्लिक करें। शामिल Supabase Project URL और Publishable Key को अपने मानों से बदलें। दिए गए डेटाबेस और Storage SQL स्क्रिप्ट को Supabase SQL Editor में चलाएँ।

महत्वपूर्ण सूचना

ऑथेंटिकेशन, डेटाबेस या फ़ाइल अपलोड का परीक्षण करने से पहले शामिल Supabase Project URL और Publishable Key को बदलें।