Go to: https://console.cloud.google.com/apis/credentials
-
Create Project (if needed):
- Click "Select a project" → "New Project"
- Name:
Directors Palette - Click "Create"
-
Configure OAuth Consent Screen (if needed):
- Click "OAuth consent screen" in left menu
- Choose "External" → Create
- App name:
Director's Palette - User support email:
taskmasterpeace@gmail.com - Developer contact:
taskmasterpeace@gmail.com - Save and continue through all steps
-
Create OAuth Credentials:
- Click "+ CREATE CREDENTIALS" → "OAuth 2.0 Client ID"
- Application type:
Web application - Name:
Directors Palette Web - Authorized redirect URIs:
https://tarohelkwuurakbxjyxm.supabase.co/auth/v1/callback - Click "Create"
-
COPY THESE VALUES:
- Client ID:
123456789-abc123...apps.googleusercontent.com - Client Secret:
ABC-123def...
- Client ID:
Go to: https://supabase.com/dashboard/project/tarohelkwuurakbxjyxm/sql
Copy and paste this entire SQL script:
-- Director's Palette Database Schema
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Users table
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email TEXT UNIQUE NOT NULL,
name TEXT,
avatar_url TEXT,
is_admin BOOLEAN DEFAULT false,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);
-- Projects table
CREATE TABLE projects (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
name TEXT NOT NULL,
type TEXT NOT NULL CHECK (type IN ('story', 'music-video', 'commercial')),
content JSONB NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);
-- User templates table
CREATE TABLE user_templates (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
template_type TEXT NOT NULL,
name TEXT NOT NULL,
content JSONB NOT NULL,
is_public BOOLEAN DEFAULT false,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- AI usage tracking table
CREATE TABLE ai_usage (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
model_id TEXT NOT NULL,
function_type TEXT NOT NULL,
tokens_used INTEGER NOT NULL,
cost_usd DECIMAL(10,4) NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Image storage references table
CREATE TABLE user_images (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
project_id UUID REFERENCES projects(id) ON DELETE CASCADE,
storage_path TEXT NOT NULL,
public_url TEXT NOT NULL,
file_size INTEGER,
mime_type TEXT,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Enable Row Level Security
ALTER TABLE users ENABLE ROW LEVEL SECURITY;
ALTER TABLE projects ENABLE ROW LEVEL SECURITY;
ALTER TABLE user_templates ENABLE ROW LEVEL SECURITY;
ALTER TABLE ai_usage ENABLE ROW LEVEL SECURITY;
ALTER TABLE user_images ENABLE ROW LEVEL SECURITY;
-- Security 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);
CREATE POLICY "Users can manage own projects" ON projects FOR ALL USING (auth.uid() = user_id);
CREATE POLICY "Users can view own and public templates" ON user_templates FOR SELECT USING (auth.uid() = user_id OR is_public = true);
CREATE POLICY "Users can manage own templates" ON user_templates FOR INSERT WITH CHECK (auth.uid() = user_id);
CREATE POLICY "Users can update own templates" ON user_templates FOR UPDATE USING (auth.uid() = user_id);
CREATE POLICY "Users can delete own templates" ON user_templates FOR DELETE USING (auth.uid() = user_id);
CREATE POLICY "Users can view own usage" ON ai_usage FOR SELECT USING (auth.uid() = user_id);
CREATE POLICY "System can insert usage tracking" ON ai_usage FOR INSERT WITH CHECK (true);
CREATE POLICY "Users can view own images" ON user_images FOR SELECT USING (auth.uid() = user_id);
CREATE POLICY "Users can manage own images" ON user_images FOR ALL USING (auth.uid() = user_id);
-- Performance indexes
CREATE INDEX idx_projects_user_id ON projects(user_id);
CREATE INDEX idx_projects_type ON projects(type);
CREATE INDEX idx_user_templates_user_id ON user_templates(user_id);
CREATE INDEX idx_ai_usage_user_id ON ai_usage(user_id);
CREATE INDEX idx_user_images_user_id ON user_images(user_id);Click "Run" to execute all commands
Go to: https://supabase.com/dashboard/project/tarohelkwuurakbxjyxm/storage/buckets
Create Bucket 1:
- Click "New bucket"
- Name:
images - Public:
✅ checked(for AI-generated images) - Click "Create bucket"
Create Bucket 2:
- Click "New bucket"
- Name:
user-assets - Public:
❌ unchecked(for private user files) - Click "Create bucket"
Go to: https://supabase.com/dashboard/project/tarohelkwuurakbxjyxm/auth/providers
- Click on "Google" (disabled)
- Toggle "Enable Sign in with Google" to
ON - Client IDs: Paste your Google Client ID
- Client Secret: Paste your Google Client Secret
- Click "Save"
Go to: https://supabase.com/dashboard/project/tarohelkwuurakbxjyxm/settings/api
Copy these values:
- Project URL:
https://tarohelkwuurakbxjyxm.supabase.co - anon public key:
eyJhbGciOiJIUzI1NiIsInR5cCI6...(starts with eyJ) - service_role secret:
eyJhbGciOiJIUzI1NiIsInR5cCI6...(starts with eyJ)
Add these to Vercel environment variables:
# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://tarohelkwuurakbxjyxm.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=[paste anon key from Supabase]
SUPABASE_SERVICE_ROLE_KEY=[paste service role key from Supabase]
# Google OAuth
GOOGLE_CLIENT_ID=[paste from Google Cloud Console]
GOOGLE_CLIENT_SECRET=[paste from Google Cloud Console]✅ Google OAuth Login: One-click sign-in with Google
✅ Database Storage: All projects saved to Supabase
✅ Image Storage: AI-generated images stored in Supabase buckets
✅ User Management: Professional user system with roles
✅ Cost Tracking: AI usage and costs tracked per user
✅ Security: Row-level security protects user data
Current localStorage system will automatically migrate to Supabase once configured!