Skip to content

pvgomes/techormehtube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TechOrMehTube - YouTube Downloader

A fast, secure, and free YouTube video and audio downloader web application. Download your favorite content in multiple formats with time range cutting capabilities, all without storing files on our servers.

TechOrMehTube Banner

✨ Features

  • πŸŽ₯ Video Downloads: MP4, WebM, AVI formats with quality selection
  • 🎡 Audio Extraction: MP3, WAV formats with bitrate options
  • βœ‚οΈ Time Range Cutting: Trim videos and audio to specific time segments
  • πŸ“± Mobile Responsive: Optimized for all device sizes
  • πŸ”’ Privacy Focused: No file storage on servers - direct streaming downloads
  • ⚑ Real-time Progress: Animated progress indicators with stage visualization
  • πŸš€ Fast Processing: Powered by FFmpeg for efficient media processing
  • ⏱️ Duration Limit: 10-minute maximum to prevent abuse

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn package manager
  • FFmpeg (automatically handled in production)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd techormehtube
  2. Install dependencies

    npm install
  3. Start the development server

    npm run dev
  4. Open your browser Navigate to http://localhost:5000

That's it! The app will be running locally with both frontend and backend services.

πŸ› οΈ Development

Project Structure

β”œβ”€β”€ client/                 # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ services/      # API service layer
β”‚   β”‚   β”œβ”€β”€ utils/         # Utility functions
β”‚   β”‚   β”œβ”€β”€ constants/     # App constants and configurations
β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”œβ”€β”€ hooks/         # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ lib/           # Core utilities and configurations
β”‚   β”‚   └── types/         # TypeScript type definitions
β”œβ”€β”€ server/                # Express.js backend
β”‚   β”œβ”€β”€ controllers/       # Request handlers
β”‚   β”œβ”€β”€ services/          # Business logic layer
β”‚   β”œβ”€β”€ utils/             # Server utilities
β”‚   β”œβ”€β”€ middleware/        # Express middleware
β”‚   β”œβ”€β”€ config/            # Configuration files
β”‚   β”œβ”€β”€ routes/            # API route definitions
β”‚   └── storage.ts         # Data storage interface
β”œβ”€β”€ shared/                # Shared types and schemas
β”‚   └── schema.ts          # Database and validation schemas
β”œβ”€β”€ tests/                 # Comprehensive test suite
β”‚   β”œβ”€β”€ server/            # Server-side tests
β”‚   β”œβ”€β”€ client/            # Client-side tests
β”‚   └── shared/            # Shared code tests
└── README.md              # Project documentation

Technology Stack

Frontend:

  • React 18 with TypeScript
  • Tailwind CSS + shadcn/ui components
  • TanStack Query for state management
  • Wouter for routing
  • React Hook Form with Zod validation

Backend:

  • Express.js with TypeScript
  • @distube/ytdl-core for YouTube integration
  • FFmpeg for media processing
  • Drizzle ORM for database operations
  • Streaming downloads (no file storage)

Development:

  • Vite for fast builds and HMR
  • ESBuild for TypeScript compilation
  • Hot module replacement in development

Available Scripts

# Start development server (frontend + backend)
npm run dev

# Build for production
npm run build

# Run database migrations
npm run db:push

# Generate database migrations
npm run db:generate

# Run unit tests
npm test

# Run tests in watch mode (for development)
npm run test:watch

# Run tests with coverage report
npm run test:coverage

# Run tests for CI/CD (no watch, with coverage)
npm run test:ci

Environment Variables

Create a .env file in the root directory:

# Database (Optional - uses in-memory storage by default)
DATABASE_URL=postgresql://username:password@localhost:5432/database

# Node Environment
NODE_ENV=development

πŸ“‘ API Endpoints

POST /api/video-info

Extract YouTube video metadata and available formats.

Request:

{
  "url": "https://www.youtube.com/watch?v=VIDEO_ID"
}

Response:

{
  "videoId": "VIDEO_ID",
  "title": "Video Title",
  "duration": "180",
  "thumbnail": "thumbnail_url",
  "videoFormats": [...],
  "audioFormats": [...]
}

POST /api/download

Stream video or audio download with optional time range cutting.

Request:

{
  "url": "https://www.youtube.com/watch?v=VIDEO_ID",
  "format": "mp4",
  "quality": "720p",
  "startTime": 30,
  "endTime": 120
}

Response: Direct file stream with appropriate headers.

🐳 Deployment

The application is containerized and ready for deployment on multiple platforms.

Docker Deployment

  1. Build the Docker image

    docker build -t techormehtube .
  2. Run the container

    docker run -p 5000:5000 techormehtube

Platform Deployment

Railway (Recommended):

  • Connect your GitHub repository
  • Railway auto-detects the Node.js environment
  • Automatic deployments on git push

Digital Ocean App Platform:

  • Import from GitHub
  • Configure build/run commands
  • Auto-scaling enabled

Digital Ocean Droplets:

  • Use provided Dockerfile
  • Configure reverse proxy with Nginx
  • SSL certificate setup required

See DEPLOYMENT.md for detailed deployment instructions.

πŸ”’ Security & Privacy

  • No File Storage: All downloads stream directly through the server without disk storage
  • Duration Limits: 10-minute maximum video length prevents server abuse
  • URL Validation: Strict YouTube URL validation and sanitization
  • Rate Limiting: Built-in protection against excessive requests
  • CORS Security: Properly configured cross-origin request handling

πŸ§ͺ Testing

Running Tests

The project includes comprehensive unit tests for both server and client code:

# Run all tests
npm test

# Run tests in watch mode (recommended for development)
npm run test:watch

# Generate coverage report
npm run test:coverage

# Run tests for CI/CD
npm run test:ci

Test Structure

  • Server Tests (tests/server/): API endpoints, services, utilities, and middleware
  • Client Tests (tests/client/): React components, utilities, and services
  • Shared Tests (tests/shared/): Validation schemas and shared utilities

Coverage Goals

  • Server Code: 90%+ coverage for critical paths (YouTube service, download logic)
  • Client Code: 80%+ coverage for utilities and services
  • Shared Code: 95%+ coverage for validation schemas

Test Examples

# Test specific file
npm test -- youtube.test.ts

# Test with verbose output
npm test -- --verbose

# Test in watch mode with coverage
npm run test:watch -- --coverage

🀝 Contributing

We welcome contributions! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Write tests for new functionality
  4. Ensure all tests pass: npm test
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to the branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Write comprehensive unit tests for new features
  • Maintain test coverage above 80%
  • Use the existing ESLint/Prettier configuration
  • Write meaningful commit messages
  • Test your changes across different devices
  • Update documentation for new features

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“§ Contact

Developer: @_pvgomes

GitHub: github.com/pvgomes

YouTube: @tech-or-meh


Built with ❀️ for the community β€’ Report Issues

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages