A mobile-first AI image enhancement web application with 200+ AI-powered transformations including color correction, background replacement, scene changes, art style conversions, and facial enhancements.
- Frontend: React 18 + TypeScript + Vite
- Styling: Tailwind CSS + shadcn/ui
- Backend: Supabase (PostgreSQL + Auth + Storage)
- AI Processing: Google Gemini via Lovable AI Gateway
- State Management: TanStack Query
- Routing: React Router DOM
- Node.js 18+ and npm/yarn/pnpm
- Supabase account
- Lovable AI Gateway API key (for AI processing)
- Resend API key (for emails)
npm install- Create a new Supabase project at supabase.com
- Run the database migrations in
supabase/migrations/(see Database Setup below) - Configure Storage buckets (see Storage Setup below)
- Set up Edge Functions (see Edge Functions Setup below)
Create a .env file in the root directory:
cp .env.example .envFill in your Supabase credentials:
VITE_SUPABASE_URL=your_supabase_project_url
VITE_SUPABASE_PUBLISHABLE_KEY=your_supabase_anon_key
VITE_SUPABASE_PROJECT_ID=your_supabase_project_id
npm run devThe app will be available at http://localhost:5173
You need to set up the following in your Supabase project:
- Tables (run these in Supabase SQL Editor):
-- See supabase/migrations/001_initial_schema.sql for full schema-
Row Level Security (RLS):
- All tables have RLS enabled
- Users can only access their own data
- Admins have full access
- Public read access for active enhancements and articles
-
Database Functions:
-- Check if user is admin
CREATE FUNCTION is_admin(_user_id UUID) RETURNS BOOLEAN AS $$
SELECT EXISTS (SELECT 1 FROM admin_users WHERE user_id = _user_id)
$$ LANGUAGE sql STABLE SECURITY DEFINER;
-- Handle new user registration
CREATE FUNCTION handle_new_user() RETURNS TRIGGER AS $$
BEGIN
INSERT INTO profiles (user_id, first_name, last_name, display_name, referral_source, use_case)
VALUES (
NEW.id,
NEW.raw_user_meta_data->>'first_name',
NEW.raw_user_meta_data->>'last_name',
NEW.raw_user_meta_data->>'display_name',
NEW.raw_user_meta_data->>'referral_source',
NEW.raw_user_meta_data->>'use_case'
);
INSERT INTO user_credits (user_id, credits) VALUES (NEW.id, 10);
INSERT INTO user_plans (user_id, plan) VALUES (NEW.id, 'free');
INSERT INTO user_notification_preferences (user_id) VALUES (NEW.id);
RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
-- Create trigger for new users
CREATE TRIGGER on_auth_user_created
AFTER INSERT ON auth.users
FOR EACH ROW EXECUTE FUNCTION handle_new_user();Create two storage buckets in Supabase:
-
images (Private)
- For user uploaded and processed images
- Path format:
{user_id}/{timestamp}-{type}.png
-
enhancement-thumbnails (Public)
- For enhancement preview images
- Public read access enabled
Deploy the edge functions to Supabase:
# Install Supabase CLI
npm install -g supabase
# Login to Supabase
supabase login
# Link your project
supabase link --project-ref your-project-ref
# Deploy edge functions
supabase functions deploy process-image
supabase functions deploy send-email
supabase functions deploy knowledge-ai
supabase functions deploy generate-thumbnails
supabase functions deploy improve-promptSet the required secrets for edge functions:
supabase secrets set LOVABLE_API_KEY=your_lovable_api_key
supabase secrets set RESEND_API_KEY=your_resend_api_key
supabase secrets set APP_URL=your_app_urlclearpix/
├── src/
│ ├── components/ # React components
│ │ ├── ui/ # shadcn/ui base components
│ │ ├── studio/ # Studio-specific components
│ │ ├── admin/ # Admin panel components
│ │ └── ... # Shared components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utilities and configs
│ ├── pages/ # Page components
│ │ ├── admin/ # Admin pages
│ │ └── ... # User pages
│ ├── types/ # TypeScript types
│ ├── utils/ # Utility functions
│ ├── App.tsx # Root component with routing
│ ├── main.tsx # App entry point
│ └── index.css # Global styles
├── supabase/
│ ├── functions/ # Edge functions
│ └── migrations/ # Database migrations
├── public/ # Static assets
├── index.html # HTML entry point
├── vite.config.ts # Vite configuration
├── tailwind.config.js # Tailwind configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Dependencies
- 200+ AI enhancement types across 10 categories
- Multi-image processing (up to 5 images)
- Face preservation technology
- Before/after comparison sliders
- Personal gallery with infinite scroll
- Favorites system
- Credit-based usage tracking
- 4 subscription tiers (Free, Starter, Pro, Studio)
- User management dashboard
- Enhancement prompt CRUD
- Revenue and cost analytics
- Content moderation (gallery)
- Email template management
- Knowledge base CMS
- App settings configuration
- Freestyle - Custom AI prompts
- Enhancement & Restoration - Quality improvements
- Face & Portrait - Facial enhancements
- Viral Style Transforms - Trending art styles
- Pet Features - Pet-specific enhancements
- Professional/Commercial - Business photos
- Art Styles - Artistic transformations
- Photography - Photo editing
- Scenarios - Scene changes
- Special FX - Effects and filters
| Plan | Credits | Price | Features |
|---|---|---|---|
| Free | 5 | $0 | Watermarked images |
| Starter | 25 | $9.95 | No watermarks, HD download |
| Pro | 75 | $19.95 | Priority processing, 4K download |
| Studio | 200 | $59.95 | Batch processing, API access |
npm run buildnpm run previewnpm run lintThe application can be deployed to:
- Vercel (recommended for frontend)
- Netlify
- Cloudflare Pages
- Any static hosting service
Make sure to:
- Set environment variables in your hosting platform
- Deploy Edge Functions to Supabase
- Configure CORS and allowed domains in Supabase
This is a proprietary application. Please contact the development team for contribution guidelines.
Copyright © 2025 ClearPix. All rights reserved.
For support, email support@clearpix.app or visit our help center at /help