一个简单的匿名留言板,让你说出心里话。
- Next.js 14 (App Router)
- Tailwind CSS
- shadcn/ui
- Supabase
- TypeScript
- 克隆项目
git clone <your-repo-url>
cd shudong- 安装依赖
npm install- 配置环境变量
cp .env.example .env.local然后编辑 .env.local 文件,填入你的 Supabase 配置。
- 启动开发服务器
npm run dev- Fork 这个仓库
- 在 Vercel 中导入项目
- 设置环境变量:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEY
- 部署
在 Supabase SQL 编辑器中运行以下 SQL:
create table messages (
id uuid default gen_random_uuid() primary key,
recipient_name text not null,
content text not null,
created_at timestamp with time zone default timezone('utc'::text, now()) not null,
ip_address text,
metadata jsonb
);
-- 启用 RLS (行级安全)
alter table messages enable row level security;
-- 创建策略
create policy "启用匿名插入" on messages for insert with check (true);
create policy "启用匿名读取" on messages for select using (true);MIT