Skip to content

druvx13/Anipaca-1

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

339 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AniPaca πŸ¦™

High-Performance Anime Streaming Platform & Hianime.to Clone


πŸ“– Table of Contents

  1. Project Overview
  2. Feature Inventory
  3. Technology Stack
  4. System Architecture
  5. Directory Structure
  6. Installation & Setup
  7. Configuration
  8. Database Management
  9. Development Workflow
  10. Production Deployment
  11. Security Considerations
  12. Legal & Licensing
  13. Disclaimer

πŸ”­ Project Overview

AniPaca is a robust, open-source anime streaming web application designed to replicate and enhance the user experience of popular streaming platforms like Hianime.to. It serves as a comprehensive educational resource for understanding the complexities of building modern video streaming architectures, including:

  • Hybrid Data Aggregation: Seamlessly merging external API data (metadata, episodes) with local user data (watch history, comments).
  • Video Proxying: Implementing advanced M3U8/HLS proxying to handle cross-origin streaming and segment rewriting.
  • User State Management: Handling complex user interactions like watchlists, progress tracking, and social commenting.

This project is engineered with a focus on simplicity (Vanilla PHP, no heavy frameworks) and performance (efficient routing and caching strategies).


✨ Feature Inventory

Core Streaming

  • Multi-Quality Streaming: Support for 360p, 480p, 720p, and 1080p resolutions.
  • Adaptive HLS Player: Custom ArtPlayer integration with HLS.js for smooth adaptive bitrate streaming.
  • Proxy System: Internal proxy to bypass CORS restrictions and rewrite playlist segments on-the-fly.
  • Multi-Server Support: Dynamic server selection (Sub/Dub) with fallback capabilities.

Content Discovery

  • Advanced Search: Real-time AJAX search with "Quick Search" and "Full Search" modes.
  • Filtering: Robust filter engine (Genre, Season, Status, Type, Language, Rating).
  • Catalog: A-Z listing, Trending, Popular, and Top Airing collections.
  • Details Page: Rich metadata including synopsis, cast, voice actors, studio info, and related recommendations.

User Experience

  • Authentication: Secure Login and Registration system.
  • Watchlist Management: Categorize anime (Watching, On-Hold, Plan to Watch, Dropped, Completed).
  • Watch History: Automatic progress tracking; resumes episodes where left off.
  • Social Interaction: Comment system with nested replies, reactions (Like/Dislike), and spoiler tagging.
  • Responsive Design: Fully responsive UI built with Bootstrap 4, optimized for Mobile, Tablet, and Desktop.

System

  • Custom Router: Regex-based routing engine avoiding heavy framework overhead.
  • SEO Optimization: Dynamic meta tags, OpenGraph support, and automated Sitemap generation.
  • PWA Support: Service Worker registration and Manifest for "Add to Home Screen" capability.

πŸ’» Technology Stack

Backend

  • Language: PHP 7.4+ / 8.0+ (Vanilla, no framework)
  • Database: MySQL / MariaDB (MySQLi extension)
  • Architecture: MVC-Hybrid (Router -> Page Controller -> Component View)

Frontend

  • Markup: HTML5
  • Styling: CSS3, Bootstrap 4, Custom Themes
  • Scripting: JavaScript (ES6+), jQuery 3.7.1
  • Video Player: ArtPlayer, HLS.js
  • UI Libraries: Swiper.js (Carousels), jQuery UI (Autocomplete)

External Services (APIs)

  • Content API: ZenAPI (or compatible HiAnime wrapper) for anime metadata and streaming links.
  • Proxy: Internal PHP Proxy (src/ajax/proxy.php) or external Shrina-Proxy.

πŸ—οΈ System Architecture

AniPaca operates on a Hybrid Data Model:

  1. Static Data (Anime Content): Fetched in real-time or cached from the ZenAPI ($zpi). This includes titles, images, synopsis, and episode lists.
  2. Dynamic Data (User Content): Stored in the local MySQL Database. This includes user accounts, comments, watch lists, and history.

Request Lifecycle

  1. Entry: All requests hit router.php (via .htaccess rewrite).
  2. Routing: The URI is matched against regex patterns defined in router.php.
  3. Controller/View: The matching file (e.g., src/pages/anime/details.php) is loaded.
  4. Data Fetch:
    • Content: The page calls fetchAnimeData() (in src/component/anime/qtip.php) to get anime details from the API.
    • User State: The page queries the local MySQL database for the user's relationship to that anime (e.g., "Is it in their watchlist?").
  5. Render: The HTML is generated, combining the API data and User data.

See ARCHITECTURE.md for deep dives.


πŸ“‚ Directory Structure

See DIRECTORY_STRUCTURE.md for the complete breakdown.

  • _config.php: Master configuration.
  • router.php: Central routing logic.
  • src/: Application source code.
    • ajax/: Async endpoints and Proxy logic.
    • component/: Reusable UI parts.
    • pages/: Page controllers/views.
    • user/: User management logic.
  • public/: Static assets (images, sitemaps).

πŸ› οΈ Installation & Setup

Prerequisites

  • Web Server: Apache (with mod_rewrite enabled).
  • PHP: Version 7.4 or higher (Extensions: mysqli, curl, json, mbstring).
  • Database: MySQL 5.7+ or MariaDB 10.2+.

Step-by-Step

  1. Clone Repository

    git clone https://github.com/PacaHat/Anipaca.git
    cd Anipaca
  2. Database Setup

    • Create a new MySQL database (e.g., anipaca_db).
    • Import the schema:
      mysql -u username -p anipaca_db < database.sql
    • Alternatively, accessing /db in the browser will attempt to initialize tables via db-init.php.
  3. Configuration

    • Open _config.php.
    • Edit the database connection parameters:
      $conn = new mysqli("localhost", "db_user", "db_pass", "anipaca_db");
    • Update site metadata ($websiteTitle, $contactEmail).
    • Critical: Ensure $zpi points to a valid API endpoint.
  4. Server Configuration

    • Ensure the .htaccess file is present in the root to handle routing.
    • If using Nginx, you must convert the .htaccess rules to Nginx configuration (see DEPLOYMENT.md).
  5. Verify

    • Navigate to your domain. You should see the homepage.

βš™οΈ Configuration

Configuration is centralized in _config.php.

Variable Description
$conn Database connection object.
$zpi The base URL for the external Anime API.
$proxy The URL for the video segment proxy (defaults to internal).
$websiteUrl Auto-detected base URL of the site.

See CONFIGURATION.md for advanced settings.


πŸ—„οΈ Database Management

The system uses the following key tables:

  • users: Stores credentials and profile info.
  • watchlist: Maps Users to Animes with status (Watching, Completed, etc.).
  • watch_history: Tracks episode progress per user/anime.
  • comments: Stores user discussions linked to specific anime/episodes.

Note: There is no built-in Admin Panel. Database management is currently done via direct SQL access or tools like phpMyAdmin.


πŸ”¨ Development Workflow

  1. Modify Logic: Logic is primarily in src/pages/ (controllers) or src/ajax/ (API).
  2. Modify UI: Components are in src/component/. CSS is in src/assets/css/.
  3. Testing:
    • Verify routing changes in router.php.
    • Test video playback to ensure Proxy headers are correct.
    • Validate API responses from $zpi.

πŸš€ Production Deployment

  • HTTPS: Mandatory for Service Workers and secure PWA functionality.
  • Caching: Implement Cloudflare or server-side caching for static assets.
  • Permissions: Ensure public/ is writable if you plan to allow uploads (e.g., avatars).

See DEPLOYMENT.md for a checklist.


πŸ” Security Considerations

  • SQL Injection: The codebase uses mysqli_real_escape_string and prepared statements in critical areas. Maintain this pattern.
  • XSS: Output is escaped using htmlspecialchars.
  • CORS: The Proxy (src/ajax/proxy.php) validates the Origin header to prevent unauthorized hotlinking.
  • Hardcoded Credentials: Warning: _config.php contains credentials. Ensure this file is denied access in your web server config (handled by default in Apache, but check Nginx).

See SECURITY.md for the full security policy.


βš–οΈ Legal & Licensing

Copyright Β© 2025 AniPaca Contributors

This project is licensed under the GNU General Public License v3.0 (GPLv3). You are free to use, modify, and distribute this software, provided that all modifications are also open-sourced under the same license.

🚫 Commercial Use Restriction

Important: While the project is licensed under GPLv3, the original author has explicitly stated in the source distribution:

"Do not use this for commercial purposes. If you place ads on your site, I will personally file a DMCA complaint."

Users are advised to respect this restriction to avoid legal disputes with the original copyright holder, despite the permissive nature of the GPLv3 regarding commercial use.

See LICENSE for the full legal text.


⚠️ Disclaimer

Educational Purpose Only

This repository is a technical demonstration of web streaming technologies.

  • The author does not host any copyrighted content.
  • The author does not control the external APIs used.
  • The user is solely responsible for ensuring their usage complies with local laws and copyright regulations.
  • Commercial use of copyrighted content without license is illegal.

Documentation generated by SCRIBE.

About

A anime streaming website highly inspired by hianime or you could just say hianime clone

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 66.9%
  • PHP 24.6%
  • Hack 6.3%
  • CSS 2.1%
  • HTML 0.1%