An e-commerce web app for browsing educational AI/robotics learning kits, adding them to a cart, and placing orders with Razorpay or Cash on Delivery (COD). Includes authentication and an admin dashboard for managing users, orders, and payments.
- Frontend: React 18 + TypeScript
- Build tool: Vite
- Styling/UI: Tailwind CSS + shadcn/ui (Radix UI primitives)
- Routing: React Router
- Server state: TanStack React Query
- Backend: Supabase (Auth + Postgres + Edge Functions)
- Payments: Razorpay
- Public site: Home, Shop, Kit details, Blog, About, Contact
- Cart: add/remove/update quantity (persisted to
localStorage) - Auth: sign up / sign in via Supabase
- Checkout: address + buyer details, Razorpay or COD
- Orders & Payments: stored in Supabase tables
- Admin dashboard: metrics, user list, order status updates, payments list
src/pages/– route pages (Home, Shop, Checkout, Admin, etc.)src/components/– UI sections + reusable componentssrc/components/ui/– shadcn/ui componentssrc/contexts/–AuthContextandCartContextsrc/integrations/supabase/– Supabase client + generated DB typessrc/supabase/migrations/– SQL migrations for tables/RLSsrc/supabase/functions/– Supabase Edge Functions (Razorpay integration)
- Node.js 18+ (recommended)
- A Supabase project (URL + anon/publishable key)
Package manager: the repo includes a
bun.lockb, but you can use npm as well.
Create a file named .env.local in the project root:
VITE_SUPABASE_URL="https://YOUR_PROJECT_ID.supabase.co"
VITE_SUPABASE_PUBLISHABLE_KEY="YOUR_SUPABASE_ANON_KEY"Notes:
- These names are required because the Supabase client is initialized from
import.meta.envinsrc/integrations/supabase/client.ts. .env*files are gitignored by default.
npm install
npm run devbun install
bun run devThen open:
http://localhost:8080
npm run build
npm run previewThis repo includes SQL migrations under:
src/supabase/migrations/
They define (at minimum):
profiles(role:customeroradmin)orders(items stored as JSON)payments
How you apply them depends on how you manage Supabase:
- If you use the Supabase CLI, link your project and apply migrations.
- Or run the SQL manually in the Supabase SQL editor.
Auth is handled by Supabase. A profiles row is auto-created on user signup via a database trigger defined in migrations.
Admin access is controlled via the profiles.role field (admin vs customer) enforced by Row Level Security policies.
To make a user an admin, update their profile row in Supabase:
update public.profiles
set role = 'admin'
where email = 'admin@example.com';The frontend currently uses a Razorpay key value in the code (see src/pages/Checkout.tsx).
For production, you should move it to an environment variable (for example VITE_RAZORPAY_KEY) and load it via import.meta.env.
A Supabase Edge Function creates Razorpay orders:
src/supabase/functions/create-order/index.ts
That function expects the Razorpay secret key to be set as an environment variable in the Supabase Functions environment:
RAZORPAY_SECRET_KEY
Do not put Razorpay secret keys in .env.local for the frontend.
- Dev server:
npm run dev - Lint:
npm run lint - Build:
npm run build - Preview build:
npm run preview
- Blank page / Supabase errors: verify
.env.localvalues and that your Supabase project is reachable. - Admin page not accessible: ensure your user has
profiles.role = 'admin'. - Razorpay error “secret key not configured”: set
RAZORPAY_SECRET_KEYin Supabase Edge Function environment.
Add your license information here.