2025-11-18 20:22:25 +03:30
|
|
|
# راهنمای سریع راهاندازی
|
|
|
|
|
|
|
|
|
|
## نصب سریع (5 دقیقه)
|
|
|
|
|
|
|
|
|
|
### 1. نصب پکیجها
|
|
|
|
|
```bash
|
|
|
|
|
npm install
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 2. تنظیم Supabase
|
|
|
|
|
|
|
|
|
|
یک فایل `.env` در ریشه پروژه بسازید:
|
|
|
|
|
|
|
|
|
|
```env
|
|
|
|
|
VITE_SUPABASE_URL=https://your-project.supabase.co
|
|
|
|
|
VITE_SUPABASE_ANON_KEY=your-anon-key
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 3. ساخت جداول Database
|
|
|
|
|
|
|
|
|
|
در Supabase SQL Editor اجرا کنید:
|
|
|
|
|
|
|
|
|
|
```sql
|
|
|
|
|
-- جدول 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. اجرا
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
npm run dev
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
باز کنید: http://localhost:5173
|
|
|
|
|
|
|
|
|
|
## ساخت برای Production
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
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](./README.md) مراجعه کنید.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-20 09:48:50 +03:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|