Skip to content

abdelrhman445/CourseHunters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

🚀 RILLZO - Course & Coupon Aggregator

Node.js/Express + MongoDB + Vue.js


📁 هيكل المشروع

rillzo-project/
├── backend/                   ← Node.js / Express / MongoDB
│   ├── src/
│   │   ├── config/
│   │   │   ├── database.js    ← Mongoose connection
│   │   │   └── logger.js      ← Winston logger
│   │   ├── models/
│   │   │   ├── Course.js      ← Mongoose Course Schema
│   │   │   ├── Coupon.js      ← Mongoose Coupon Schema
│   │   │   └── User.js        ← Mongoose User Schema
│   │   ├── routes/
│   │   │   ├── courses.js     ← GET /api/courses/*, POST /api/coupons/:id/report
│   │   │   └── auth.js        ← POST /api/auth/register|login|verify-otp
│   │   ├── middlewares/
│   │   │   └── auth.js        ← JWT protect + adminOnly
│   │   ├── services/
│   │   │   ├── scraper.js     ← Cheerio scrapers (Scorpion, RealDiscount, Coursevania)
│   │   │   ├── expire.js      ← Auto-expire coupon checker
│   │   │   ├── scheduler.js   ← node-cron jobs
│   │   │   ├── telegram.js    ← Telegram Bot webhook + notifications
│   │   │   └── categories.js  ← Smart category detection
│   │   └── server.js          ← Express app + bootstrap
│   ├── .env.example
│   ├── Dockerfile
│   └── package.json
│
└── frontend/                  ← Vue.js 3
    ├── src/
    │   ├── api/
    │   │   └── index.js       ← ✅ Axios instance + all API functions
    │   ├── views/
    │   │   ├── HomeView.vue        ← ✅ Updated: _id mapping + report button + toast
    │   │   ├── CourseDetails.vue   ← ✅ Updated: fetchCourseById + report flow
    │   │   ├── SearchResultsView.vue ← ✅ Updated: searchCourses API
    │   │   ├── LoginView.vue       ← (unchanged - compatible)
    │   │   ├── RegisterView.vue    ← (unchanged - compatible)
    │   │   ├── CategoriesView.vue  ← (unchanged - compatible)
    │   │   └── SettingsView.vue    ← (unchanged - compatible)
    │   ├── router/index.js    ← ✅ Updated: navigation guard + scroll behavior
    │   └── main.js
    ├── .env.development
    ├── .env.production
    └── package.json

⚡ تشغيل المشروع

1. Backend

cd backend

# نسخ ملف الإعدادات
cp .env.example .env
# ثم عدّل .env بقيمك الحقيقية

# تثبيت الحزم
npm install

# تشغيل التطوير
npm run dev

# تشغيل الإنتاج
npm start

2. Frontend

cd frontend

# إنشاء ملف الإعدادات
echo "VUE_APP_API_URL=http://localhost:5000/api" > .env.development

# تثبيت الحزم
npm install

# تشغيل التطوير
npm run serve

# بناء الإنتاج
npm run build

🔌 API Endpoints

Courses

Method Endpoint Description
GET /api/courses/all جلب كل الكورسات مع فلاتر
GET /api/courses/search?q=python بحث في الكورسات
GET /api/courses/:id كورس واحد بالـ ID
GET /api/courses/categories/list قائمة الكاتيجوريز
GET /api/courses/sources/list قائمة المصادر
GET /api/courses/stats إحصائيات
GET /api/courses/category/:name كورسات كاتيجوري محددة
POST /api/courses/coupons/:id/report الإبلاغ عن كوبون لا يعمل

Query Parameters لـ /api/courses/all:

Param Type مثال Description
page number 1 رقم الصفحة
limit number 20 عدد النتائج
sort_by string addedAt أو title الترتيب
category string Python فلترة بالكاتيجوري
source string couponscorpion فلترة بالمصدر
isFree boolean true فلترة المجاني فقط
showExpired boolean false إظهار المنتهية

Auth

Method Endpoint Description
POST /api/auth/register تسجيل مستخدم جديد
POST /api/auth/verify-otp تحقق من OTP
POST /api/auth/login تسجيل الدخول → يُرجع JWT
GET /api/auth/me بيانات المستخدم الحالي (🔒)
PUT /api/auth/update تحديث البيانات (🔒)
DELETE /api/auth/delete حذف الحساب (🔒)

🗄️ Database Schemas

Course

{
  title: String,          // عنوان الكورس
  slug: String,           // unique
  description: String,
  image: String,          // URL الصورة
  udemyLink: String,      // unique - رابط الكورس
  source: String,         // couponscorpion | real_discount | ...
  category: String,       // Python | Web Dev | ...
  isFree: Boolean,        // true = مجاني 100%
  expired: Boolean,       // true = الكوبون منتهي
  expiredAt: Date,
  addedAt: Date
}

Coupon

{
  course: ObjectId,       // ref → Course
  couponCode: String,
  discountPercentage: Number,  // 0-100
  affiliateLink: String,
  startDate: Date,
  expirationDate: Date,
  isActive: Boolean,
  reportCount: Number,    // عداد البلاغات
  lastReportedAt: Date
}

⏰ Cron Jobs

Job Interval Description
Scraper كل 30 دقيقة سحب كورسات جديدة من المصادر
Expire كل 6 ساعات فحص الكوبونات المنتهية وتعطيلها

📢 Telegram Bot

  1. أنشئ بوت من @BotFather
  2. احصل على BOT_TOKEN
  3. أضف البوت لقناتك كـ Admin
  4. اجعله يرسل رسالة لأي يوزر واحصل على CHANNEL_ID
  5. ضع القيم في .env:
    TELEGRAM_BOT_TOKEN=your_token
    TELEGRAM_CHANNEL_ID=@your_channel
    

🔒 Security Features

  • Helmet.js — HTTP Security Headers
  • CORS — مضبوط لأصل الفرونت فقط
  • Rate Limiting — 200 طلب / 15 دقيقة عامة، 10 بلاغات / ساعة
  • JWT — مدة صلاحية 7 أيام، مع auto-logout عند الانتهاء
  • bcryptjs — تشفير كلمات المرور بـ salt rounds 12
  • Input Validation — على مستوى Mongoose + Routes

🌍 Deployment

Backend على Render.com

  1. New → Web Service → اربط الـ repo
  2. Build: npm install
  3. Start: node src/server.js
  4. أضف Environment Variables من .env.example

Frontend على Vercel

  1. Import project
  2. Framework: Vue.js
  3. أضف env variable: VUE_APP_API_URL=https://your-backend.onrender.com/api

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors