How team-phitogether/phitogether works
Project Type and Purpose
• PhiTogether is a *cross-platform*, *frontend-centric* rhythm game built on a modern web stack (Vue + Vite), wrapped into native Android/iOS shells via Capacitor.
• It delivers a PWA on the web and uses static hosting for game assets (charts, audio, video), plus integrates with external “PhiZone” (and Taptap) community APIs for multiplayer features.
File Structure Analysis
• Top-level:
• package.json, vite.config.js, tsconfig.json → Node/Vite build for web.
• android/ and ios/ → Capacitor native wrappers and platform-specific code.
• public/ → Static assets served at runtime: manifest, service worker, chart/audio/video files, versioning API endpoints.
• src/ → Vue application source: components, pages (.vue), router, utilities, WebAssembly and IndexedDB wrappers (ptdb).
• script/ → Custom build scripts and utilities (build.js, checki18n.js).
• Patterns & Configurations:
• Vue + Vue-Router for SPA pages (in src/components/pages + src/components/router).
• IndexedDB abstraction (src/components/ptdb) for local persistence of charts and user data.
• WASM module (pzEncrypted.wasm) used for decryption / performance-critical logic.
• Capacitor config (capacitor.config.json) bridges the webview to native filesystem, permissions, plugins.
README Insights
• Open-source, community-driven, licensed under AGPL-3.0.
• Emphasis on multiplayer (“PhiZone integrated”) and non-commercial use.
• No bespoke backend server in repo—relies on static JSON+multimedia + external APIs.
a. Main Components
1. Frontend/Web Application
– Vue3 SPA (components, pages, router)
– Renderer core (sim-phi engine + plugins)
– WebAssembly decryption module
2. Native Shells
– Android wrapper (Java/Kotlin + Capacitor bridge)
– iOS wrapper (Swift + Capacitor bridge)
3. Static Asset Server (CDN/Hosting)
– Serves public/ folder: chart JSON, audio/video, JS bundles, service worker, api/* endpoints for versioning
4. External Community APIs
– PhiZone (user profiles, lobbies)
– Taptap API integration
5. Client-side Storage
– IndexedDB (ptdb ObjectStores for charts, userData, skins, caches)
– Local filesystem via Capacitor (for media caching, replays, recordings)
b. Relationships & Data Flows
• Web App ←→ Static Asset Server (HTTP GET for JS, CSS, charts, audio/video)
• Web App ←→ External APIs (PhiZone, Taptap REST calls)
• Web App → IndexedDB (store/load chart data, user settings)
• Web App → WASM Module (in-browser decryption/processing)
• Web App ↔ Native Shell (Capacitor bridge for file access, device APIs)
c. Architectural Patterns & Principles
– MVVM/SPAs: Vue components separated into UI (pages) and services (utils, api wrappers).
– Modular Renderer: sim-phi engine with plugin architecture (SpecialChartsProcessor, video-recorder).
– Offline-First: Service worker (sw.v2.1.js), IndexedDB caching.
– Cross-Platform: Single codebase deployed to Web, Android, iOS.
d. Key Technologies
– Vue3 + Vue-Router + Vite
– TypeScript + JavaScript modules
– Capacitor (Android / iOS native bridge)
– IndexedDB (ptdb wrappers)
– WebAssembly (pzEncrypted.wasm)
– Service Worker (PWA caching)
– External REST APIs (PhiZone, Taptap)