- Project Overview
- Feature Inventory
- Technology Stack
- System Architecture
- Directory Structure
- Installation & Setup
- Configuration
- Database Management
- Development Workflow
- Production Deployment
- Security Considerations
- Legal & Licensing
- Disclaimer
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).
- 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.
- 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.
- 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.
- 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.
- Language: PHP 7.4+ / 8.0+ (Vanilla, no framework)
- Database: MySQL / MariaDB (MySQLi extension)
- Architecture: MVC-Hybrid (Router -> Page Controller -> Component View)
- 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)
- 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.
AniPaca operates on a Hybrid Data Model:
- Static Data (Anime Content): Fetched in real-time or cached from the ZenAPI (
$zpi). This includes titles, images, synopsis, and episode lists. - Dynamic Data (User Content): Stored in the local MySQL Database. This includes user accounts, comments, watch lists, and history.
- Entry: All requests hit
router.php(via.htaccessrewrite). - Routing: The URI is matched against regex patterns defined in
router.php. - Controller/View: The matching file (e.g.,
src/pages/anime/details.php) is loaded. - Data Fetch:
- Content: The page calls
fetchAnimeData()(insrc/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?").
- Content: The page calls
- Render: The HTML is generated, combining the API data and User data.
See ARCHITECTURE.md for deep dives.
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).
- Web Server: Apache (with
mod_rewriteenabled). - PHP: Version 7.4 or higher (Extensions:
mysqli,curl,json,mbstring). - Database: MySQL 5.7+ or MariaDB 10.2+.
-
Clone Repository
git clone https://github.com/PacaHat/Anipaca.git cd Anipaca -
Database Setup
- Create a new MySQL database (e.g.,
anipaca_db). - Import the schema:
mysql -u username -p anipaca_db < database.sql - Alternatively, accessing
/dbin the browser will attempt to initialize tables viadb-init.php.
- Create a new MySQL database (e.g.,
-
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
$zpipoints to a valid API endpoint.
- Open
-
Server Configuration
- Ensure the
.htaccessfile is present in the root to handle routing. - If using Nginx, you must convert the
.htaccessrules to Nginx configuration (see DEPLOYMENT.md).
- Ensure the
-
Verify
- Navigate to your domain. You should see the homepage.
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.
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.
- Modify Logic: Logic is primarily in
src/pages/(controllers) orsrc/ajax/(API). - Modify UI: Components are in
src/component/. CSS is insrc/assets/css/. - Testing:
- Verify routing changes in
router.php. - Test video playback to ensure Proxy headers are correct.
- Validate API responses from
$zpi.
- Verify routing changes in
- 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.
- SQL Injection: The codebase uses
mysqli_real_escape_stringand prepared statements in critical areas. Maintain this pattern. - XSS: Output is escaped using
htmlspecialchars. - CORS: The Proxy (
src/ajax/proxy.php) validates theOriginheader to prevent unauthorized hotlinking. - Hardcoded Credentials: Warning:
_config.phpcontains 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.
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.
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.
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.