Payannameh-Mozakhraf/QUICKSTART.md

2.7 KiB

راهنمای سریع راه‌اندازی

نصب سریع (5 دقیقه)

1. نصب پکیج‌ها

npm install

2. تنظیم Supabase

یک فایل .env در ریشه پروژه بسازید:

VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key

3. ساخت جداول Database

در Supabase SQL Editor اجرا کنید:

-- جدول requests
create table requests (
  id uuid default gen_random_uuid() primary key,
  user_id uuid references auth.users(id) on delete cascade not null,
  title text not null,
  description text not null,
  status text default 'pending' check (status in ('pending', 'in_progress', 'completed')),
  created_at timestamp with time zone default timezone('utc'::text, now()) not null,
  updated_at timestamp with time zone default timezone('utc'::text, now()) not null
);

alter table requests enable row level security;

create policy "Anyone can view requests" on requests for select using (true);
create policy "Users can insert their own requests" on requests for insert with check (auth.uid() = user_id);
create policy "Users can update their own requests" on requests for update using (auth.uid() = user_id);

-- جدول messages
create table messages (
  id uuid default gen_random_uuid() primary key,
  user_id uuid references auth.users(id) on delete cascade not null,
  content text not null,
  created_at timestamp with time zone default timezone('utc'::text, now()) not null
);

alter table messages enable row level security;

create policy "Anyone can view messages" on messages for select using (true);
create policy "Authenticated users can insert messages" on messages for insert with check (auth.uid() = user_id);

4. فعال‌سازی Realtime

در Supabase Dashboard:

  • Database > Replication
  • فعال کردن Realtime برای requests و messages

5. اجرا

npm run dev

باز کنید: http://localhost:5173

ساخت برای Production

npm run build
npm run preview

نکات مهم

  • فونت IRANSans: فایل‌های فونت را در public/fonts/ قرار دهید
  • آیکون‌های PWA: آیکون‌های 192x192 و 512x512 را در public/ قرار دهید
  • Google OAuth: در Supabase Dashboard فعال کنید (اختیاری)

ساختار پروژه

src/
├── pages/        # صفحات اصلی
├── components/   # کامپوننت‌ها
├── hooks/        # Custom hooks
├── atoms/        # Jotai state
├── services/     # Supabase client
└── utils/        # توابع کمکی

برای اطلاعات بیشتر به README.md مراجعه کنید.