A modern, professional e-commerce website built with React, TypeScript, Redux Toolkit, Supabase, and shadcn/ui. Features include a responsive storefront, admin dashboard, and comprehensive data tracking capabilities.
- Responsive Design: Fully mobile-responsive with modern UI/UX
- Product Catalog: Browse products by category with search and filtering
- Shopping Cart: Persistent cart with quantity management
- Checkout Flow: Streamlined checkout process
- Data Layer: Built-in tracking for customer analytics
- Product Management: Add, edit, and manage products
- User Management: View and manage customer accounts
- Pixel/Tag Manager: Configure Google Analytics, Facebook Pixel, and custom tracking
- Order Management: Track and manage customer orders
- Analytics: View sales and customer insights
- TypeScript: Full type safety throughout the application
- Redux Toolkit: Centralized state management
- Supabase: Backend-as-a-Service with real-time capabilities
- shadcn/ui: Professional component library
- Tailwind CSS: Utility-first CSS framework
- React Router: Client-side routing
- Form Validation: Zod schema validation
- Frontend: React 19, TypeScript, Vite
- State Management: Redux Toolkit
- Backend: Supabase (PostgreSQL, Auth, Storage)
- UI Components: shadcn/ui, Radix UI
- Styling: Tailwind CSS
- Forms: React Hook Form + Zod
- Icons: Lucide React
- Notifications: Sonner
- Node.js 18+
- pnpm (recommended) or npm
- Supabase account and project
git clone <repository-url>
cd jolly
pnpm install
Create a .env
file in the root directory:
# Supabase Configuration
VITE_SUPABASE_URL=your_supabase_project_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
# Optional: Analytics and Tracking
VITE_GOOGLE_ANALYTICS_ID=your_ga_id
VITE_FACEBOOK_PIXEL_ID=your_fb_pixel_id
- Create a new Supabase project at supabase.com
- Get your project URL and anon key from the project settings
- Run the database setup SQL in your Supabase SQL editor:
Option A: Complete Setup (Recommended)
Run the contents of database-setup.sql
for a full setup with all RLS policies.
Option B: Simple Setup (If you encounter policy conflicts)
If you get policy conflicts, use database-setup-simple.sql
instead. This creates a minimal working setup.
Note: The simple setup creates basic policies first, then you add admin policies after creating your admin user.
-- Create users table
CREATE TABLE users (
id UUID REFERENCES auth.users(id) PRIMARY KEY,
email TEXT UNIQUE NOT NULL,
full_name TEXT NOT NULL,
role TEXT DEFAULT 'customer' CHECK (role IN ('admin', 'user', 'customer')),
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Note: This is a simplified users table for basic user management.
-- The User Management system in the admin dashboard works with these fields only.
-- For additional fields like phone, avatar_url, status, etc., you would need to extend this table.
-- Create products table
CREATE TABLE products (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
name TEXT NOT NULL,
description TEXT,
price DECIMAL(10,2) NOT NULL,
images TEXT[] DEFAULT '{}',
category TEXT NOT NULL,
stock INTEGER DEFAULT 0,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Create orders table
CREATE TABLE orders (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
status TEXT DEFAULT 'pending' CHECK (status IN ('pending', 'processing', 'shipped', 'delivered', 'cancelled')),
total DECIMAL(10,2) NOT NULL,
items JSONB NOT NULL,
shipping_address JSONB,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Create pixel_tracking table
CREATE TABLE pixel_tracking (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
name TEXT NOT NULL,
type TEXT NOT NULL CHECK (type IN ('google_analytics', 'facebook_pixel', 'custom')),
code TEXT NOT NULL,
is_active BOOLEAN DEFAULT true,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Enable Row Level Security
ALTER TABLE users ENABLE ROW LEVEL SECURITY;
ALTER TABLE products ENABLE ROW LEVEL SECURITY;
ALTER TABLE orders ENABLE ROW LEVEL SECURITY;
ALTER TABLE pixel_tracking ENABLE ROW LEVEL SECURITY;
-- RLS Policies
CREATE POLICY "Users can view own profile" ON users FOR SELECT USING (auth.uid() = id);
CREATE POLICY "Users can update own profile" ON users FOR UPDATE USING (auth.uid() = id);
-- Admin policies for user management
CREATE POLICY "Admins can view all users" ON users FOR SELECT USING (
EXISTS (SELECT 1 FROM users WHERE id = auth.uid() AND role = 'admin')
);
CREATE POLICY "Admins can insert users" ON users FOR INSERT WITH CHECK (
EXISTS (SELECT 1 FROM users WHERE id = auth.uid() AND role = 'admin')
);
CREATE POLICY "Admins can update users" ON users FOR UPDATE USING (
EXISTS (SELECT 1 FROM users WHERE id = auth.uid() AND role = 'admin')
);
CREATE POLICY "Admins can delete users" ON users FOR DELETE USING (
EXISTS (SELECT 1 FROM users WHERE id = auth.uid() AND role = 'admin')
);
CREATE POLICY "Products are viewable by everyone" ON products FOR SELECT USING (true);
CREATE POLICY "Only admins can modify products" ON products FOR ALL USING (
EXISTS (SELECT 1 FROM users WHERE id = auth.uid() AND role = 'admin')
);
CREATE POLICY "Users can view own orders" ON orders FOR SELECT USING (auth.uid() = user_id);
CREATE POLICY "Only admins can modify orders" ON orders FOR ALL USING (
EXISTS (SELECT 1 FROM users WHERE id = auth.uid() AND role = 'admin')
);
CREATE POLICY "Only admins can manage pixel tracking" ON pixel_tracking FOR ALL USING (
EXISTS (SELECT 1 FROM users WHERE id = auth.uid() AND role = 'admin')
);
-- Create admin user (replace with your email)
INSERT INTO users (id, email, full_name, role)
VALUES (
(SELECT id FROM auth.users WHERE email = 'your-admin-email@example.com'),
'your-admin-email@example.com',
'Admin User',
'admin'
);
-- Important: Make sure to replace 'your-admin-email@example.com' with your actual email
-- and ensure you've signed up through the regular signup process first
If you encounter "row-level security policy" errors when trying to manage users:
- Ensure you're logged in as an admin user
- Check that the RLS policies are properly created - run the SQL above in your Supabase SQL editor
- Verify your user has the 'admin' role in the users table
- Make sure you've signed up first - the admin user must exist in both
auth.users
andusers
tables
If you get errors like "policy already exists":
- Use the simple setup script (
database-setup-simple.sql
) instead - Or manually drop conflicting policies in your Supabase SQL editor:
DROP POLICY IF EXISTS "policy_name" ON table_name;
- Check existing policies with:
SELECT schemaname, tablename, policyname FROM pg_policies;
- "new row violates row-level security policy": RLS policies not set up correctly
- "permission denied": User doesn't have admin role
- "relation does not exist": Tables not created yet
pnpm dev
Open http://localhost:5173 in your browser.
src/
โโโ components/ # Reusable UI components
โ โโโ ui/ # shadcn/ui components
โ โโโ layout/ # Layout components
โ โโโ cart/ # Cart-related components
โ โโโ search/ # Search components
โ โโโ auth/ # Authentication components
โโโ pages/ # Page components
โ โโโ admin/ # Admin dashboard pages
โ โโโ ... # Public pages
โโโ store/ # Redux store and slices
โโโ contexts/ # React contexts
โโโ lib/ # Utility functions and configurations
โโโ types/ # TypeScript type definitions
The design system uses CSS variables defined in src/index.css
. You can customize:
- Primary colors
- Background colors
- Text colors
- Border colors
- Component-specific colors
All UI components are built with shadcn/ui and can be customized by modifying the component files in src/components/ui/
.
The platform is fully responsive with breakpoints:
- Mobile: < 768px
- Tablet: 768px - 1024px
- Desktop: > 1024px
- Row Level Security (RLS) in Supabase
- Protected Routes for admin functionality
- Input Validation with Zod schemas
- Secure Authentication with Supabase Auth
The platform includes built-in tracking for:
- Page views
- Product views
- Add to cart events
- Purchase events
- User interactions
pnpm build
- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push to main branch
- Connect your GitHub repository to Netlify
- Set environment variables in Netlify dashboard
- Build command:
pnpm build
- Publish directory:
dist
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support and questions:
- Create an issue in the repository
- Check the documentation
- Review the code examples
- Multi-language support
- Advanced analytics dashboard
- Inventory management
- Customer reviews and ratings
- Advanced search and filtering
- Payment gateway integration
- Email marketing integration
- Mobile app (React Native)
Built with โค๏ธ using modern web technologies