按照以下步骤配置 PromptDock 以开始使用
1. 访问 Supabase 官网 并注册账户
2. 创建新项目,记录项目的 URL 和 API Key
3. 在项目的 SQL 编辑器中执行以下建表语句:
-- 创建 categories 表 CREATE TABLE categories ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE, name TEXT NOT NULL, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() ); -- 创建 prompts 表 CREATE TABLE prompts ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE, category_id UUID REFERENCES categories(id) ON DELETE CASCADE, content TEXT NOT NULL, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() ); -- 启用 RLS (Row Level Security) ALTER TABLE categories ENABLE ROW LEVEL SECURITY; ALTER TABLE prompts ENABLE ROW LEVEL SECURITY; -- 创建 RLS 策略 CREATE POLICY "Users can only see their own categories" ON categories FOR ALL USING (auth.uid() = user_id); CREATE POLICY "Users can only see their own prompts" ON prompts FOR ALL USING (auth.uid() = user_id); -- 创建索引 CREATE INDEX idx_categories_user_id ON categories(user_id); CREATE INDEX idx_prompts_user_id ON prompts(user_id); CREATE INDEX idx_prompts_category_id ON prompts(category_id);
编辑项目根目录下的 .env.local
文件:
# Supabase Configuration NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key # NextAuth Secret (生成一个随机字符串) NEXTAUTH_SECRET=your-nextauth-secret-key-here NEXTAUTH_URL=http://localhost:3000
⚠️ 重要提示:
your-project-ref
替换为你的 Supabase 项目引用your-anon-key
替换为你的 Supabase 匿名密钥NEXTAUTH_SECRET
生成一个强随机字符串如需启用 Google 登录,请:
配置完成后,启动开发服务器进行测试:
npm install npm run dev
访问 http://localhost:3000
确认应用正常运行。
.env.local
文件已添加到 .gitignore
在 Zeabur 项目设置中添加以下环境变量:
NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key NEXTAUTH_SECRET=your-nextauth-secret-key-here NEXTAUTH_URL=https://your-app-name.zeabur.app
💡 提示:
NEXTAUTH_URL
设置为你的 Zeabur 应用域名https://your-domain.zeabur.app/auth/callback
🎉 恭喜!
你的 PromptDock 应用已成功部署到 Zeabur,现在可以在任何地方访问和使用了!