- Frontend Core: React 18 (SPA) with TypeScript.
- AI Layer: Google Gemini API (
@google/genai). - Payments: Razorpay (Requires Backend Verification).
- Backend: Supabase (Auth, DB, Edge Functions).
Before deploying this application to production, you MUST complete the following steps to ensure security and compliance.
- Rename
.env.exampleto.env. - Fill in your Supabase URL and Anon Key.
- Fill in your Razorpay Key ID.
- NEVER commit
.envto Git. (It is added to.gitignore). - In your deployment platform (Vercel/Netlify), add these as Environment Variables.
You must enable RLS on your Supabase tables to prevent users from modifying others' data or granting themselves coins.
Run the following SQL in your Supabase SQL Editor:
-- Enable RLS
ALTER TABLE profiles ENABLE ROW LEVEL SECURITY;
ALTER TABLE orders ENABLE ROW LEVEL SECURITY;
-- Profiles: Users can read their own profile
CREATE POLICY "Public profiles are viewable by everyone"
ON profiles FOR SELECT USING ( true );
-- Profiles: Users can update ONLY their own profile (but NOT coins/is_pro directly if you want strict security)
CREATE POLICY "Users can update own profile"
ON profiles FOR UPDATE USING ( auth.uid() = id );
-- Orders: Users can read their own orders
CREATE POLICY "Users can view own orders"
ON orders FOR SELECT USING ( auth.uid() = user_id );
-- IMPORTANT: Remove INSERT permissions for 'public' on orders if you use Edge Functions for payments.The frontend PaymentSuccessPage tries to invoke a Supabase Edge Function named verify-payment. You must deploy this function to handle real money securely.
Function Logic (pseudo-code):
- Receive
payment_idanduser_id. - Fetch payment details from Razorpay API (using Razorpay Secret Key).
- Verify status is
captured. - If valid, update
profilestable (add coins, setis_pro). - Return success.
- Go to Google Cloud Console > Credentials.
- Edit your API Key.
- Under Application restrictions, select HTTP referrers (websites).
- Add your production domain (e.g.,
https://aditis-ai.com/*). - This prevents others from stealing your quota.
- Visitor lands on Landing Page.
- Auth: Sign Up/Login via Supabase Auth.
- Features: Use AI tools (Gemini) securely.
- Upgrade: Pay via Razorpay -> Redirect to Success -> Backend Verification -> Pro Status.
index.html(Entry)App.tsx(Router)services/(API Clients - Configured via Env Vars)pages/(UI Logic).env(Secrets - DO NOT COMMIT)