feat: Add Cloudflare Pages deployment guides and scripts

Co-authored-by: logato7838 <logato7838@vsihay.com>
This commit is contained in:
Cursor Full Stack AI IDE 2025-10-12 14:30:18 +00:00
parent 15b31c58f2
commit 1b19e8504f
4 changed files with 810 additions and 0 deletions

View file

@ -0,0 +1,191 @@
# 🚀 دليل النشر على Cloudflare Pages - Cursor Full Stack AI IDE
## 🚨 المشكلة الحالية
Cloudflare Pages يحاول بناء code-server بدلاً من مشروعنا بسبب:
- المستودع المرتبط يحتوي على code-server
- عدم وجود إعدادات صحيحة للبناء
- مشاكل في التبعيات الأصلية
## ✅ الحل النهائي
### 1. إنشاء مستودع منفصل للـ Frontend
```bash
# إنشاء مستودع جديد للـ Frontend فقط
git init cursor-ide-frontend
cd cursor-ide-frontend
# نسخ ملفات الـ Frontend
cp -r ../cloudflare/frontend/* .
# إضافة وإرسال
git add .
git commit -m "Initial frontend commit"
git remote add origin https://github.com/your-username/cursor-ide-frontend.git
git push -u origin main
```
### 2. إعداد Cloudflare Pages
1. **انتقل إلى Cloudflare Dashboard**
2. **اختر Pages > Create a project**
3. **اربط المستودع الجديد**
4. **اختر الإعدادات التالية:**
- **Framework preset**: Vite
- **Build command**: `npm run build`
- **Build output directory**: `dist`
- **Root directory**: `/` (root)
### 3. إعداد متغيرات البيئة
```bash
# في Cloudflare Pages Dashboard
VITE_BACKEND_URL=https://cursor-backend.workers.dev
VITE_WS_URL=wss://cursor-backend.workers.dev
VITE_APP_NAME=Cursor Full Stack AI IDE
VITE_APP_VERSION=1.0.0
```
## 🔧 إعداد سريع
### 1. إنشاء مستودع Frontend منفصل
```bash
# إنشاء مجلد جديد
mkdir cursor-ide-frontend
cd cursor-ide-frontend
# نسخ ملفات الـ Frontend
cp -r ../cloudflare/frontend/* .
# إعداد Git
git init
git add .
git commit -m "Initial frontend commit"
# رفع إلى GitHub
gh repo create cursor-ide-frontend --public
git remote add origin https://github.com/your-username/cursor-ide-frontend.git
git push -u origin main
```
### 2. نشر على Cloudflare Pages
```bash
# استخدام Wrangler
wrangler pages project create cursor-ide-frontend
wrangler pages deploy dist --project-name cursor-ide-frontend
```
## 🎯 الحل البديل - النشر المباشر
### 1. بناء المشروع محلياً
```bash
cd cloudflare/frontend
npm install
npm run build
```
### 2. نشر الملفات المبنية
```bash
# نشر مجلد dist مباشرة
wrangler pages deploy dist --project-name cursor-ide
```
## 🌍 النتيجة المتوقعة
بعد النشر الصحيح، ستحصل على:
- **Frontend**: `https://cursor-ide.pages.dev`
- **Backend**: `https://cursor-backend.workers.dev`
- **WebSocket**: `wss://cursor-backend.workers.dev`
## 🔧 استكشاف الأخطاء
### مشكلة: المستودع الخاطئ
**الحل**: إنشاء مستودع منفصل للـ Frontend
### مشكلة: إعدادات البناء
**الحل**: استخدام Vite preset في Cloudflare Pages
### مشكلة: متغيرات البيئة
**الحل**: إضافة متغيرات البيئة في Cloudflare Dashboard
## 📋 خطوات النشر النهائية
### 1. إعداد المستودع
```bash
# إنشاء مستودع جديد
gh repo create cursor-ide-frontend --public
# نسخ الملفات
cp -r cloudflare/frontend/* cursor-ide-frontend/
cd cursor-ide-frontend
# إعداد Git
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/your-username/cursor-ide-frontend.git
git push -u origin main
```
### 2. ربط Cloudflare Pages
1. انتقل إلى Cloudflare Dashboard
2. Pages > Create a project
3. Connect to Git
4. اختر المستودع الجديد
5. إعدادات البناء:
- Framework: Vite
- Build command: `npm run build`
- Build output directory: `dist`
### 3. إضافة متغيرات البيئة
```bash
VITE_BACKEND_URL=https://cursor-backend.workers.dev
VITE_WS_URL=wss://cursor-backend.workers.dev
```
### 4. النشر
- Cloudflare Pages سيبني المشروع تلقائياً
- ستحصل على رابط مباشر للتطبيق
## 🎉 النتيجة النهائية
تطبيق Cursor Full Stack AI IDE سيكون متاحاً على:
- **Frontend**: `https://cursor-ide.pages.dev`
- **Backend**: `https://cursor-backend.workers.dev`
- **WebSocket**: `wss://cursor-backend.workers.dev`
## 🚀 البدء السريع
```bash
# 1. إنشاء مستودع Frontend
gh repo create cursor-ide-frontend --public
# 2. نسخ الملفات
cp -r cloudflare/frontend/* cursor-ide-frontend/
cd cursor-ide-frontend
# 3. إعداد Git
git init && git add . && git commit -m "Initial commit"
git remote add origin https://github.com/your-username/cursor-ide-frontend.git
git push -u origin main
# 4. ربط Cloudflare Pages
# انتقل إلى Cloudflare Dashboard > Pages > Create project
# اختر المستودع الجديد
# إعدادات: Vite, npm run build, dist
# 5. إضافة متغيرات البيئة
# VITE_BACKEND_URL=https://cursor-backend.workers.dev
# VITE_WS_URL=wss://cursor-backend.workers.dev
```
---
**🎯 هذا الحل سيضمن نشر التطبيق بنجاح على Cloudflare Pages!**

View file

@ -0,0 +1,157 @@
# ⚡ النشر السريع - Cursor Full Stack AI IDE
## 🚨 المشكلة الحالية
Cloudflare Pages يحاول بناء code-server بدلاً من مشروعنا بسبب المستودع المرتبط.
## ✅ الحل السريع
### 1. إنشاء مستودع منفصل للـ Frontend
```bash
# إنشاء مستودع جديد
gh repo create cursor-ide-frontend --public
# نسخ ملفات الـ Frontend
cp -r cloudflare/frontend/* cursor-ide-frontend/
cd cursor-ide-frontend
# إعداد Git
git init
git add .
git commit -m "Initial frontend commit"
git remote add origin https://github.com/your-username/cursor-ide-frontend.git
git push -u origin main
```
### 2. ربط Cloudflare Pages
1. انتقل إلى [Cloudflare Dashboard](https://dash.cloudflare.com)
2. اختر **Pages** > **Create a project**
3. اختر **Connect to Git**
4. اختر المستودع الجديد `cursor-ide-frontend`
5. إعدادات البناء:
- **Framework preset**: Vite
- **Build command**: `npm run build`
- **Build output directory**: `dist`
### 3. إضافة متغيرات البيئة
```bash
VITE_BACKEND_URL=https://cursor-backend.workers.dev
VITE_WS_URL=wss://cursor-backend.workers.dev
```
## 🚀 النشر التلقائي
### استخدام سكريبت النشر
```bash
cd cloudflare/frontend
./deploy-to-cloudflare.sh
```
### النشر اليدوي
```bash
# بناء المشروع
npm run build
# نشر على Cloudflare Pages
wrangler pages deploy dist --project-name cursor-ide
```
## 🎯 النتيجة المتوقعة
بعد النشر، ستحصل على:
- **Frontend**: `https://cursor-ide.pages.dev`
- **Backend**: `https://cursor-backend.workers.dev`
- **WebSocket**: `wss://cursor-backend.workers.dev`
## 🔧 استكشاف الأخطاء
### مشكلة: المستودع الخاطئ
**الحل**: إنشاء مستودع منفصل للـ Frontend
### مشكلة: إعدادات البناء
**الحل**: استخدام Vite preset في Cloudflare Pages
### مشكلة: متغيرات البيئة
**الحل**: إضافة متغيرات البيئة في Cloudflare Dashboard
## 📋 خطوات النشر النهائية
### 1. إعداد المستودع
```bash
# إنشاء مستودع جديد
gh repo create cursor-ide-frontend --public
# نسخ الملفات
cp -r cloudflare/frontend/* cursor-ide-frontend/
cd cursor-ide-frontend
# إعداد Git
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/your-username/cursor-ide-frontend.git
git push -u origin main
```
### 2. ربط Cloudflare Pages
1. انتقل إلى Cloudflare Dashboard
2. Pages > Create a project
3. Connect to Git
4. اختر المستودع الجديد
5. إعدادات البناء:
- Framework: Vite
- Build command: `npm run build`
- Build output directory: `dist`
### 3. إضافة متغيرات البيئة
```bash
VITE_BACKEND_URL=https://cursor-backend.workers.dev
VITE_WS_URL=wss://cursor-backend.workers.dev
```
### 4. النشر
- Cloudflare Pages سيبني المشروع تلقائياً
- ستحصل على رابط مباشر للتطبيق
## 🎉 النتيجة النهائية
تطبيق Cursor Full Stack AI IDE سيكون متاحاً على:
- **Frontend**: `https://cursor-ide.pages.dev`
- **Backend**: `https://cursor-backend.workers.dev`
- **WebSocket**: `wss://cursor-backend.workers.dev`
## 🚀 البدء السريع
```bash
# 1. إنشاء مستودع Frontend
gh repo create cursor-ide-frontend --public
# 2. نسخ الملفات
cp -r cloudflare/frontend/* cursor-ide-frontend/
cd cursor-ide-frontend
# 3. إعداد Git
git init && git add . && git commit -m "Initial commit"
git remote add origin https://github.com/your-username/cursor-ide-frontend.git
git push -u origin main
# 4. ربط Cloudflare Pages
# انتقل إلى Cloudflare Dashboard > Pages > Create project
# اختر المستودع الجديد
# إعدادات: Vite, npm run build, dist
# 5. إضافة متغيرات البيئة
# VITE_BACKEND_URL=https://cursor-backend.workers.dev
# VITE_WS_URL=wss://cursor-backend.workers.dev
```
---
**🎯 هذا الحل سيضمن نشر التطبيق بنجاح على Cloudflare Pages!**

View file

@ -0,0 +1,285 @@
# 🚀 Cursor Full Stack AI IDE - Frontend
## 📋 نظرة عامة
هذا هو الـ Frontend لتطبيق Cursor Full Stack AI IDE، مبني بـ React + Vite + Monaco Editor.
## 🚀 النشر السريع على Cloudflare Pages
### 1. إنشاء مستودع منفصل
```bash
# إنشاء مستودع جديد للـ Frontend
gh repo create cursor-ide-frontend --public
# نسخ الملفات
cp -r cloudflare/frontend/* cursor-ide-frontend/
cd cursor-ide-frontend
# إعداد Git
git init
git add .
git commit -m "Initial frontend commit"
git remote add origin https://github.com/your-username/cursor-ide-frontend.git
git push -u origin main
```
### 2. ربط Cloudflare Pages
1. انتقل إلى [Cloudflare Dashboard](https://dash.cloudflare.com)
2. اختر **Pages** > **Create a project**
3. اختر **Connect to Git**
4. اختر المستودع الجديد `cursor-ide-frontend`
5. إعدادات البناء:
- **Framework preset**: Vite
- **Build command**: `npm run build`
- **Build output directory**: `dist`
- **Root directory**: `/` (root)
### 3. إضافة متغيرات البيئة
في Cloudflare Pages Dashboard، أضف:
```bash
VITE_BACKEND_URL=https://cursor-backend.workers.dev
VITE_WS_URL=wss://cursor-backend.workers.dev
VITE_APP_NAME=Cursor Full Stack AI IDE
VITE_APP_VERSION=1.0.0
```
## 🛠️ التطوير المحلي
### تثبيت التبعيات
```bash
npm install
```
### تشغيل خادم التطوير
```bash
npm run dev
```
### بناء للإنتاج
```bash
npm run build
```
### معاينة البناء
```bash
npm run preview
```
## 🎯 الميزات
### Monaco Editor
- ✅ محرر كود متقدم من Microsoft
- ✅ دعم 50+ لغة برمجة
- ✅ IntelliSense واقتراحات ذكية
- ✅ Multi-cursor editing
- ✅ Find & Replace
- ✅ Code folding
- ✅ Bracket matching
- ✅ Custom themes
### واجهة المستخدم
- ✅ Sidebar مع مستكشف الملفات
- ✅ Status bar مع معلومات النظام
- ✅ Chat panel مع AI integration
- ✅ Tools panel مع أدوات التطوير
- ✅ Notifications system
- ✅ Responsive design
### AI Integration
- ✅ 5 مزودي AI (OpenAI, Anthropic, Google, Mistral, OpenRouter)
- ✅ Real-time chat
- ✅ Code generation
- ✅ Code explanation
- ✅ Bug fixing
### Development Tools
- ✅ File operations
- ✅ Terminal integration
- ✅ Git integration
- ✅ Package management
- ✅ Code search
- ✅ Docker support
## 🔧 الإعداد
### متغيرات البيئة
```bash
# Backend URLs
VITE_BACKEND_URL=https://cursor-backend.workers.dev
VITE_WS_URL=wss://cursor-backend.workers.dev
# App Configuration
VITE_APP_NAME=Cursor Full Stack AI IDE
VITE_APP_VERSION=1.0.0
VITE_APP_DESCRIPTION=A complete AI-powered development environment
# Feature Flags
VITE_ENABLE_AI_CHAT=true
VITE_ENABLE_TOOLS=true
VITE_ENABLE_TERMINAL=true
VITE_ENABLE_GIT=true
# AI Providers
VITE_DEFAULT_AI_PROVIDER=openai
VITE_AI_PROVIDERS=openai,anthropic,google,mistral,openrouter
# Editor Configuration
VITE_EDITOR_THEME=vs-dark
VITE_EDITOR_FONT_SIZE=14
VITE_EDITOR_TAB_SIZE=2
VITE_EDITOR_WORD_WRAP=on
```
## 📁 هيكل المشروع
```
frontend/
├── public/ # ملفات عامة
│ ├── _headers # رؤوس HTTP
│ ├── _redirects # قواعد إعادة التوجيه
│ ├── manifest.json # PWA manifest
│ ├── robots.txt # SEO
│ └── sitemap.xml # Sitemap
├── src/ # الكود المصدري
│ ├── components/ # مكونات React
│ │ ├── MonacoEditor.tsx
│ │ ├── Sidebar.tsx
│ │ ├── ChatAssistant.tsx
│ │ ├── ProviderForm.tsx
│ │ ├── ToolPanel.tsx
│ │ ├── StatusBar.tsx
│ │ └── Notification.tsx
│ ├── App.tsx # المكون الرئيسي
│ ├── main.tsx # نقطة الدخول
│ └── index.css # الأنماط
├── package.json # التبعيات
├── vite.config.js # إعدادات Vite
├── tailwind.config.js # إعدادات Tailwind
├── tsconfig.json # إعدادات TypeScript
└── README.md # هذا الملف
```
## 🎨 التصميم
### الألوان
- **Background**: `#1e1e1e`
- **Sidebar**: `#252526`
- **Border**: `#3c3c3c`
- **Text**: `#cccccc`
- **Accent**: `#007acc`
### الخطوط
- **Monospace**: Fira Code, Consolas, Monaco
- **Sans-serif**: Segoe UI, Tahoma, Geneva, Verdana
### الاستجابة
- **Desktop**: 1920px+
- **Tablet**: 768px - 1919px
- **Mobile**: 320px - 767px
## 🔒 الأمان
### Content Security Policy
```html
default-src 'self';
script-src 'self' 'unsafe-inline' 'unsafe-eval';
style-src 'self' 'unsafe-inline';
img-src 'self' data: https:;
connect-src 'self' https://*.workers.dev wss://*.workers.dev;
```
### Headers
- X-Frame-Options: DENY
- X-Content-Type-Options: nosniff
- X-XSS-Protection: 1; mode=block
- Referrer-Policy: strict-origin-when-cross-origin
## 📊 الأداء
### التحسينات
- ✅ Code splitting
- ✅ Tree shaking
- ✅ Asset optimization
- ✅ Gzip compression
- ✅ CDN caching
- ✅ Service worker
### المقاييس
- **First Contentful Paint**: < 1.5s
- **Largest Contentful Paint**: < 2.5s
- **Cumulative Layout Shift**: < 0.1
- **Time to Interactive**: < 3.5s
## 🚀 النشر
### Cloudflare Pages
```bash
# بناء المشروع
npm run build
# نشر على Cloudflare Pages
wrangler pages deploy dist --project-name cursor-ide
```
### GitHub Pages
```bash
# بناء المشروع
npm run build
# نشر على GitHub Pages
npm install -g gh-pages
gh-pages -d dist
```
### Vercel
```bash
# تثبيت Vercel CLI
npm install -g vercel
# نشر
vercel --prod
```
## 🔧 استكشاف الأخطاء
### مشكلة: البناء فشل
```bash
# حذف node_modules وإعادة التثبيت
rm -rf node_modules package-lock.json
npm install
```
### مشكلة: Monaco Editor لا يعمل
```bash
# التأكد من تثبيت التبعيات
npm install @monaco-editor/react
```
### مشكلة: Tailwind CSS لا يعمل
```bash
# إعادة بناء Tailwind
npx tailwindcss -i ./src/index.css -o ./dist/output.css --watch
```
## 📞 الدعم
- **GitHub Issues**: [Report a bug](https://github.com/your-username/cursor-ide-frontend/issues)
- **Documentation**: [Full docs](https://cursor-ide.pages.dev/docs)
- **Community**: [Discord](https://discord.gg/cursor-ide)
## 📄 الترخيص
MIT License - انظر [LICENSE](LICENSE) للتفاصيل.
---
**🎉 استمتع بالتطوير مع Cursor Full Stack AI IDE!**

View file

@ -0,0 +1,177 @@
#!/bin/bash
# Cursor Full Stack AI IDE - Deploy to Cloudflare Pages
# This script automates the deployment process to Cloudflare Pages
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${BLUE}"
echo "=========================================="
echo " 🚀 Cursor Full Stack AI IDE"
echo " 📦 Deploy to Cloudflare Pages"
echo "=========================================="
echo -e "${NC}"
# Configuration
PROJECT_NAME="cursor-ide"
BUILD_DIR="dist"
NODE_VERSION="18"
# Check if Wrangler is installed
check_wrangler() {
if ! command -v wrangler &> /dev/null; then
echo -e "${RED}Wrangler CLI is not installed${NC}"
echo "Installing Wrangler CLI..."
npm install -g wrangler
fi
echo -e "${GREEN}✅ Wrangler CLI is available${NC}"
}
# Check if user is logged in
check_auth() {
if ! wrangler whoami &> /dev/null; then
echo -e "${RED}Not logged in to Cloudflare${NC}"
echo "Please log in to Cloudflare..."
wrangler login
fi
echo -e "${GREEN}✅ Logged in to Cloudflare${NC}"
}
# Install dependencies
install_dependencies() {
echo -e "${YELLOW}Installing dependencies...${NC}"
npm install
echo -e "${GREEN}✅ Dependencies installed${NC}"
}
# Build the project
build_project() {
echo -e "${YELLOW}Building project...${NC}"
npm run build
echo -e "${GREEN}✅ Project built successfully${NC}"
}
# Create or update Pages project
setup_pages_project() {
echo -e "${YELLOW}Setting up Pages project...${NC}"
# Check if project exists
if wrangler pages project list | grep -q "$PROJECT_NAME"; then
echo "Project $PROJECT_NAME already exists"
else
echo "Creating new Pages project: $PROJECT_NAME"
wrangler pages project create "$PROJECT_NAME"
fi
echo -e "${GREEN}✅ Pages project ready${NC}"
}
# Deploy to Cloudflare Pages
deploy_to_pages() {
echo -e "${YELLOW}Deploying to Cloudflare Pages...${NC}"
# Deploy the built files
wrangler pages deploy "$BUILD_DIR" --project-name "$PROJECT_NAME"
echo -e "${GREEN}✅ Deployed to Cloudflare Pages${NC}"
}
# Get deployment URL
get_deployment_url() {
echo -e "${YELLOW}Getting deployment URL...${NC}"
# Get the deployment URL
DEPLOYMENT_URL=$(wrangler pages project list | grep "$PROJECT_NAME" | awk '{print $2}')
if [ -n "$DEPLOYMENT_URL" ]; then
echo -e "${GREEN}✅ Deployment URL: https://$DEPLOYMENT_URL${NC}"
else
echo -e "${YELLOW}⚠️ Could not get deployment URL${NC}"
fi
}
# Test deployment
test_deployment() {
echo -e "${YELLOW}Testing deployment...${NC}"
if [ -n "$DEPLOYMENT_URL" ]; then
if curl -f "https://$DEPLOYMENT_URL" > /dev/null 2>&1; then
echo -e "${GREEN}✅ Deployment is accessible${NC}"
else
echo -e "${YELLOW}⚠️ Deployment might not be ready yet${NC}"
fi
fi
}
# Show deployment summary
show_summary() {
echo -e "\n${GREEN}=========================================="
echo " 🎉 DEPLOYMENT COMPLETE! 🎉"
echo "=========================================="
echo -e "${NC}"
echo -e "${GREEN}✅ Frontend deployed successfully${NC}"
if [ -n "$DEPLOYMENT_URL" ]; then
echo -e " URL: https://$DEPLOYMENT_URL"
fi
echo -e "\n${BLUE}🔗 Access your application:${NC}"
echo -e "Frontend: https://$DEPLOYMENT_URL"
echo -e "Backend: https://cursor-backend.workers.dev"
echo -e "WebSocket: wss://cursor-backend.workers.dev"
echo -e "\n${YELLOW}📋 Next Steps:${NC}"
echo -e "1. 🌐 Open your application in the browser"
echo -e "2. 🔑 Configure your AI provider API keys"
echo -e "3. 🧪 Test the application functionality"
echo -e "4. 📊 Monitor performance in Cloudflare Dashboard"
echo -e "\n${GREEN}=========================================="
echo " 🚀 Your AI IDE is now live! 🚀"
echo "=========================================="
echo -e "${NC}"
}
# Main execution
main() {
check_wrangler
check_auth
install_dependencies
build_project
setup_pages_project
deploy_to_pages
get_deployment_url
test_deployment
show_summary
}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--project-name)
PROJECT_NAME="$2"
shift 2
;;
--help)
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " --project-name NAME Cloudflare Pages project name (default: cursor-ide)"
echo " --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Run main function
main