Skip to content

v2.0.0 - Vidiflow Backend V2

Latest

Choose a tag to compare

@hamidukarimi hamidukarimi released this 04 Jul 13:48

Vidiflow Backend V2.0.0

Real video extraction, real-time progress tracking, and complete API documentation.

New Features ✨

Video Extraction

  • Real yt-dlp Integration: Extract actual video metadata and download URLs from YouTube
  • Multi-Provider Support: YouTube and TikTok providers now use real extraction
  • Format/Quality Detection: Dynamic available formats and qualities per video
  • Direct Download URLs: Return actual platform URLs instead of mocking data

Real-Time Progress

  • WebSocket Support: Real-time download status updates instead of polling
  • Download Rooms: Clients subscribe to specific download updates
  • Event Emitters: PROCESSING, COMPLETED, FAILED status events
  • Better UX: Frontend gets instant feedback on download progress

API Documentation

  • Swagger/OpenAPI: Interactive API docs at /api-docs
  • Complete Endpoint Docs: All endpoints documented with examples
  • Request/Response Schemas: Clear input/output formats
  • Authentication Docs: Bearer token requirements clearly marked

Architecture Improvements

  • Unified Extraction Service: Single yt-dlp wrapper used by all providers
  • Provider Pattern Proven: Easy to add new providers (same as YouTube/TikTok)
  • Scalable Design: WebSocket doesn't block worker threads
  • Production Ready: Real extraction, real-time updates, full documentation

What Works Now ✅

  • Register/Login with JWT + refresh tokens
  • Download videos from YouTube with real metadata
  • TikTok support (extraction may vary due to platform restrictions)
  • Real-time download status via WebSocket
  • Download history and favorites
  • Rate limiting on auth endpoints
  • Comprehensive API documentation
  • Background job processing with BullMQ
  • Error handling and validation

Tech Stack Updates

  • socket.io: Real-time WebSocket communication
  • yt-dlp: Cross-platform video extraction
  • swagger-jsdoc & swagger-ui-express: API documentation
  • bullmq: Background job queue (from V1)
  • redis: Queue storage (from V1)

API Endpoints

Auth:

  • POST /api/v1/auth/register - Register user
  • POST /api/v1/auth/login - Login
  • POST /api/v1/auth/logout - Logout

Downloads:

  • POST /api/v1/downloads - Create download
  • GET /api/v1/downloads/{id} - Get download details
  • GET /api/v1/downloads/{id}/status - Poll status (optional, use WebSocket instead)
  • GET /api/v1/downloads/info?url=... - Get video formats/qualities
  • POST/DELETE /api/v1/downloads/{id}/favorite - Manage favorites
  • GET /api/v1/downloads/favorites - Get favorites list

WebSocket Events

// Client subscribes to download
socket.emit('subscribe-download', downloadId);

// Server broadcasts status updates
socket.on('download-status', {
  downloadId: string,
  status: 'PROCESSING' | 'COMPLETED' | 'FAILED',
  progress: 0-100,
  error?: string
});

Documentation

Interactive API docs available at: http://localhost:3000/api-docs

Known Limitations

  • TikTok extraction is unreliable due to platform anti-bot measures
  • File downloads go directly to user device (as designed)
  • No persistent file storage on server (by design)

Next Steps (V3 Roadmap)

  • Add more providers (Instagram, Facebook, Reddit, X/Twitter)
  • Improve TikTok extraction (alternative methods)
  • Browser extension for one-click downloads
  • Mobile app (iOS/Android)
  • Premium features (faster downloads, priority queue)
  • Analytics dashboard
  • User subscriptions and payments
  • Admin panel

Breaking Changes from V1

  • Removed file serving endpoints (no longer needed)
  • Download metadata now includes error messages
  • Provider contract changed: returns downloadUrl instead of filePath

Setup

# Install dependencies
npm install

# Set up environment
cp .env.example .env

# Run migrations
npx prisma migrate dev

# Start API
npm run dev

# In another terminal, start worker
npm run worker

Contributors

Built with focus on clean architecture, scalability, and production-grade practices.