Nano Banana Pro
Agent skill for nano-banana-pro
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Guadzefie is a farm-to-table e-commerce platform built with React, TypeScript, Vite, and Supabase. The application supports three user roles: consumers (regular shoppers), farmers/vendors (product sellers), and admins (platform managers).
# Development npm run dev # Start development server with HMR # Building npm run build # TypeScript compile + Vite build npm run build:css # Build and minify Tailwind CSS npm run build:all # Build CSS and production bundle npm run preview # Preview production build # Code Quality npm run lint # Run ESLint # Database Operations npm run apply-migration # Apply database migrations npm run apply-migrations # Apply multiple migrations npm run seed-database # Seed database with initial data npm run update-categories # Update product categories npm run set-admin # Set admin privileges for a user
The application uses a hierarchical routing structure with role-based access control:
/): MainLayout - Home, products, cart, auth pages/consumer/*): ConsumerLayout - Dashboard, orders, wishlist, addresses, profile/farm/*): FarmLayout - Dashboard, products, orders, deliveries, customers, reports/admin/*): AdminLayout - Dashboard, products, categories, discounts, orders, customersRole authorization is enforced by PrivateRoute component, which reads user data from localStorage and checks
is_admin and is_farm flags.
The application uses React Context API for global state:
AuthContext: Authentication state, user sessions, sign in/out
ProductContext: Product catalog, cart, wishlist, recently viewed
products_category_id_fkey for category joinsShippingAddressContext: Delivery address management
PaymentMethodContext: Payment method management
VendorContext: Vendor/farm application and management
The app uses a hybrid authentication system:
localStorage.user (JSON object with id, email, is_farm, is_admin)AuthContext creates "fake Supabase sessions" from localStorage user data to satisfy RLS policies. The getCurrentUser() helper in supabase.ts retrieves the current user.
Important Database Patterns:
categories!products_category_id_fkey(id, name, slug)auth.uid() matching the user ID from fake sessionsX-Custom-User-Id, X-Custom-User-Email) are added to all Supabase requestsDatabase schema changes are managed through SQL migration files in
scripts/migrations/. Apply migrations with:
npm run apply-migration # Single migration (interactive) npm run apply-migrations # All pending migrations
Common migrations include:
The app supports dark/light mode:
localStorage.darkMode (boolean)document.documentElement (dark/light class)In App.tsx, contexts are nested in this order (outer to inner):
Configure in
.env or .env.local:
VITE_SUPABASE_URL - Supabase project URLVITE_SUPABASE_ANON_KEY - Supabase anonymous keyVITE_SUPABASE_PROJECT_ID - Supabase project ID (optional, defaults to itbuxujsotcgexofbrwq)is_farm: false, is_admin: falseis_farm: true, is_admin: falseis_admin: trueRole precedence: Admin > Farm > Consumer
A debug helper is available in development mode:
// In browser console window.debugNavigation.checkAuth() // Check current auth state window.debugNavigation.clearAuth() // Clear auth and redirect to login
Always use the explicit foreign key when joining products with categories:
supabase.from('products').select(` *, categories!products_category_id_fkey(id, name, slug) `)
Uses react-hot-toast configured in App.tsx with theme-aware styling.
The platform includes a vendor/farm management system:
Commission calculation utility: src/utils/commissionCalculator.ts