Skip to content

theomkedare/reels-downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 Reels / Shorts Downloader β€” by OM

Working link : reels-downloader

A full-stack MERN web application to download YouTube Shorts and Instagram Reels as MP4 video or MP3 audio, with thumbnail preview, dynamic quality selection, and download analytics.

Made by OM


πŸ“ Project Structure

reels-downloader/
β”œβ”€β”€ backend/                     # Node.js + Express API
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   └── DownloadLog.js       # MongoDB schema for download logs
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ info.js              # POST /api/info β€” fetch video metadata
β”‚   β”‚   β”œβ”€β”€ download.js          # POST /api/download β€” stream file
β”‚   β”‚   └── analytics.js        # GET /api/analytics β€” stats & logs
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ validateUrl.js       # URL safety validator
β”‚   β”‚   └── ytdlp.js             # yt-dlp wrapper
β”‚   β”œβ”€β”€ .env.example
β”‚   β”œβ”€β”€ package.json
β”‚   └── server.js                # App entry point
β”‚
β”œβ”€β”€ frontend/                    # React + Vite + Tailwind
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ DownloaderCard.jsx   # Main UI card
β”‚   β”‚   β”‚   β”œβ”€β”€ VideoPreview.jsx     # Thumbnail + meta display
β”‚   β”‚   β”‚   β”œβ”€β”€ SkeletonPreview.jsx  # Loading skeleton
β”‚   β”‚   β”‚   └── ProgressBar.jsx      # Download progress
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   β”œβ”€β”€ useVideoInfo.js      # Info fetch hook
β”‚   β”‚   β”‚   └── useDownload.js       # Download trigger hook
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”‚   └── api.js               # Axios instance
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   β”œβ”€β”€ main.jsx
β”‚   β”‚   └── index.css
β”‚   β”œβ”€β”€ .env.example
β”‚   β”œβ”€β”€ index.html               # SEO meta tags
β”‚   β”œβ”€β”€ tailwind.config.js
β”‚   β”œβ”€β”€ vite.config.js
β”‚   └── package.json
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ package.json                 # Root scripts for running both
└── README.md

βš™οΈ Prerequisites

Make sure these are installed:

  • Node.js v18+
  • MongoDB (local or Atlas URI)
  • yt-dlp β€” Install guide
  • ffmpeg β€” Required for merging video/audio
# Install yt-dlp (macOS/Linux)
pip install yt-dlp
# or
brew install yt-dlp

# Install ffmpeg
brew install ffmpeg          # macOS
sudo apt install ffmpeg      # Ubuntu/Debian

πŸš€ Installation & Setup

1. Clone the repository

git clone https://github.com/yourusername/reels-downloader.git
cd reels-downloader

2. Install all dependencies

npm run install:all

Or manually:

cd backend && npm install
cd ../frontend && npm install

3. Set up environment variables

Backend:

cp backend/.env.example backend/.env

Edit backend/.env:

PORT=5000
MONGODB_URI=mongodb://localhost:27017/reels-downloader
NODE_ENV=development
FRONTEND_URL=http://localhost:5173
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX=50

Frontend:

cp frontend/.env.example frontend/.env

Edit frontend/.env:

VITE_API_URL=http://localhost:5000/api

Note: In development, the Vite proxy in vite.config.js automatically forwards /api requests to the backend on port 5000, so VITE_API_URL can be left as /api for local dev.

4. Start development servers

# Run both frontend and backend simultaneously
npm run dev

Or separately:

npm run dev:backend    # Starts backend on http://localhost:5000
npm run dev:frontend   # Starts frontend on http://localhost:5173

πŸ“‘ API Reference

POST /api/info

Fetch video metadata and available formats.

Request body:

{ "url": "https://www.youtube.com/shorts/..." }

Response:

{
  "success": true,
  "data": {
    "title": "Video Title",
    "thumbnail": "https://...",
    "duration": 30,
    "uploader": "Channel Name",
    "platform": "Youtube",
    "formats": [
      { "formatId": "137", "label": "1080p", "height": 1080 },
      { "formatId": "22", "label": "720p", "height": 720 }
    ]
  }
}

POST /api/download

Download the video/audio file (streamed directly).

Request body:

{
  "url": "https://www.youtube.com/shorts/...",
  "format": "mp4",
  "quality": "720p",
  "title": "My Video"
}

Response: Binary file stream with Content-Disposition: attachment


GET /api/analytics

Returns aggregate download stats.

GET /api/analytics/admin?page=1&limit=20

Returns paginated download logs.

GET /api/health

Health check endpoint.


πŸ—οΈ Production Deployment

Backend (e.g., Railway, Render, VPS)

cd backend
npm start

Set environment variables in your host's dashboard.

Frontend (e.g., Vercel, Netlify)

cd frontend
npm run build
# Deploy the dist/ folder

Update VITE_API_URL in the frontend env to point to your production backend URL.


πŸ”’ Security Features

  • URL whitelist: only YouTube and Instagram domains allowed
  • Rate limiting: 20 info requests/min, 10 downloads/min per IP
  • No permanent file storage: files are streamed and deleted immediately
  • CORS configured to only allow the frontend origin

πŸ“Š MongoDB Collections

downloadlogs

Field Type Description
url String Original video URL
platform String youtube / instagram
format String mp4 / mp3
quality String e.g. 720p
title String Video title
success Boolean Whether download succeeded
errorMessage String Error if failed
createdAt Date Auto timestamp

πŸ› οΈ Tech Stack

Layer Technology
Frontend React 18, Vite, Tailwind CSS
Backend Node.js, Express
Database MongoDB, Mongoose
Downloader yt-dlp, ffmpeg
Fonts Syne (display), DM Sans (body)

All rights reserved Β· Made by OM Β·(https://instagram.com/omkedare.dev)

About

repository for New Reels downloader project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors