Skip to content

limelightseychelles-git/KidsTube-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

KidsTube Filter ๐ŸŽฌ

A comprehensive YouTube content filtering system for children with parental controls. Built with React, Node.js, PostgreSQL, and Redis.

KidsTube Filter ๐ŸŽฌ

GitHub Stars GitHub Forks License: MIT Node.js React PRs Welcome

License Node React

๐ŸŒŸ Features

  • ๐Ÿ” PIN-Based Authentication - Secure parent dashboard with bcrypt-hashed PIN
  • ๐Ÿ“บ Channel Management - Approve specific YouTube channels for kids
  • ๐Ÿšซ Keyword Blocking - Filter videos containing inappropriate keywords
  • ๐Ÿ“Š Watch History - Track videos watched with duration statistics
  • ๐Ÿ“ Video Requests - Kids request videos, parents approve/reject
  • ๐Ÿ‘€ My Requests - Kids see request status with visual feedback
  • ๐Ÿ”‘ API Management - Manage multiple YouTube API keys with rotation
  • โฑ๏ธ Watch Time Tracking - Monitor total, daily, and weekly viewing time
  • ๐Ÿ’พ Redis Caching - 12-hour cache for improved performance

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    AUTHENTICATION LAYER                      โ”‚
โ”‚         PIN-based (4-6 digits) - No user accounts           โ”‚
โ”‚         - Stored as bcrypt hash in PostgreSQL               โ”‚
โ”‚         - Kids view: No auth needed                         โ”‚
โ”‚         - Parent dashboard: Requires PIN                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   API QUOTA MANAGEMENT                       โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                 โ”‚
โ”‚  โ”‚ Redis Cache     โ”‚  โ”‚ Database API Keysโ”‚                 โ”‚
โ”‚  โ”‚ - 12hr TTL      โ”‚  โ”‚ - Multiple keys  โ”‚                 โ”‚
โ”‚  โ”‚ - Search resultsโ”‚  โ”‚ - Auto rotation  โ”‚                 โ”‚
โ”‚  โ”‚ - Video metadataโ”‚  โ”‚ - Fallback to ENVโ”‚                 โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ†“
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚                              โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  Kids Interface  โ”‚          โ”‚  Parent Dashboard  โ”‚
    โ”‚  (No Auth)       โ”‚          โ”‚  (PIN Required)    โ”‚
    โ”‚                  โ”‚          โ”‚                    โ”‚
    โ”‚ - Search videos  โ”‚          โ”‚ - Approve channels โ”‚
    โ”‚ - Watch videos   โ”‚          โ”‚ - Manage keywords  โ”‚
    โ”‚ - Request videos โ”‚          โ”‚ - View history     โ”‚
    โ”‚ - View requests  โ”‚          โ”‚ - Manage requests  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ”‚ - Configure API    โ”‚
                                  โ”‚ - Change PIN       โ”‚
                                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Tech Stack

Backend

  • Node.js - Runtime environment
  • Express - Web framework
  • PostgreSQL - Primary database
  • Redis - Caching layer
  • bcrypt - Password hashing
  • JWT - Authentication tokens
  • YouTube Data API v3 - Video data

Frontend

  • React 18 - UI framework
  • Material-UI - Component library
  • React Router - Navigation
  • Axios - HTTP client
  • React Player - Video playback

๐Ÿ“‹ Prerequisites

  • Node.js >= 20.0.0
  • PostgreSQL >= 14
  • Redis >= 6.0
  • YouTube Data API Key (Get one here)

๐Ÿš€ Installation

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/kidstube-filter.git
cd kidstube-filter

2. Backend Setup

cd backend

# Install dependencies
npm install

# Create environment file
cp .env.example .env

# Edit .env with your configuration
nano .env

3. Database Setup

# Create PostgreSQL database
sudo -u postgres psql << 'EOF'
CREATE DATABASE kidstube_filter;
CREATE USER kidstube_admin WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE kidstube_filter TO kidstube_admin;
\q
EOF

# Create tables
sudo -u postgres psql -d kidstube_filter << 'EOF'
CREATE TABLE app_config (
    id SERIAL PRIMARY KEY,
    pin_hash VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE api_keys (
    id SERIAL PRIMARY KEY,
    key_value TEXT NOT NULL,
    is_active BOOLEAN DEFAULT true,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE approved_channels (
    id SERIAL PRIMARY KEY,
    channel_id VARCHAR(255) UNIQUE NOT NULL,
    channel_name VARCHAR(255),
    approved_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE blocked_keywords (
    id SERIAL PRIMARY KEY,
    keyword VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE video_history (
    id SERIAL PRIMARY KEY,
    video_id VARCHAR(255) NOT NULL,
    title VARCHAR(500),
    channel_id VARCHAR(255),
    watched_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    duration_seconds INTEGER DEFAULT 0
);

CREATE TABLE video_requests (
    id SERIAL PRIMARY KEY,
    video_url TEXT NOT NULL,
    status VARCHAR(50) DEFAULT 'pending',
    requested_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    reviewed_at TIMESTAMP
);

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO kidstube_admin;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO kidstube_admin;
EOF

4. Redis Setup

# Start Redis
sudo systemctl start redis-server
sudo systemctl enable redis-server

# Verify Redis is running
redis-cli ping
# Should return: PONG

5. Frontend Setup

cd ../frontend

# Install dependencies
npm install

6. Get YouTube API Key

  1. Go to Google Cloud Console
  2. Create a new project
  3. Enable YouTube Data API v3
  4. Create credentials โ†’ API Key
  5. Add the key to backend/.env file

๐ŸŽฎ Running the Application

Development Mode

You need two terminal windows:

Terminal 1 - Backend:

cd backend
npm run dev

Terminal 2 - Frontend:

cd frontend
npm start

The application will be available at:

First Time Setup

  1. Open http://localhost:3000
  2. Create a parent PIN (4-6 digits)
  3. Go to Parent Dashboard โ†’ API Settings
  4. Add your YouTube API key
  5. (Optional) Approve some channels for kids

๐Ÿ“– Usage Guide

For Parents

  1. Initial Setup

    • Set up a 4-6 digit PIN
    • Add YouTube API keys in API Settings
  2. Channel Management

    • Search for channels to approve
    • Only approved channels will show in kids' search
  3. Keyword Blocking

    • Add keywords to block (e.g., "scary", "violence")
    • Videos with these keywords won't appear
  4. Monitor Usage

    • View watch history with timestamps
    • See total hours watched (today/week/total)
  5. Handle Requests

    • Approve or reject video requests from kids
    • Kids will see the status in "My Requests"

For Kids

  1. Search Videos

    • Search for videos (filtered by approved channels)
    • Click to watch
  2. Request Videos

    • Found a video you want? Request it!
    • Check "My Requests" to see status
  3. My Requests

    • โณ Waiting - Pending parent approval
    • โœ“ Approved - Click to watch!
    • โœ— Not Allowed - Rejected by parent

๐Ÿ”ง Configuration

Environment Variables

See .env.example files for all configuration options.

Key configurations:

  • PORT - Backend server port (default: 5000)
  • DB_* - PostgreSQL connection settings
  • REDIS_* - Redis connection settings
  • YOUTUBE_API_KEYS - Comma-separated API keys
  • JWT_SECRET - Secret for JWT tokens
  • PIN_SALT_ROUNDS - bcrypt salt rounds (default: 10)

๐Ÿ“Š Database Schema

app_config         # PIN storage
api_keys          # YouTube API keys
approved_channels # Allowed channels
blocked_keywords  # Filtered keywords
video_history     # Watch history with duration
video_requests    # Kids' video requests

๐ŸŽจ Screenshots

(Add screenshots here)

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

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

๐Ÿ™ Acknowledgments

  • YouTube Data API v3
  • Material-UI for beautiful components
  • React Player for video playback
  • The open-source community

๐Ÿ“ง Support

For issues, questions, or suggestions, please open an issue on GitHub.

๐Ÿ” Security

  • Never commit .env files
  • Keep your YouTube API keys private
  • Use strong PINs for parent access
  • Regularly update dependencies

๐Ÿšง Roadmap

  • Multi-user support
  • Mobile app (React Native)
  • Screen time limits
  • Email notifications for parents
  • Export watch history reports
  • Support for multiple video platforms

Made with โค๏ธ for safer internet for kids

About

A comprehensive YouTube content filtering system for children with parental controls

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors