How nahinio/playcore works
1. Overall shape
- PlayCORE is a desktop Electron application with a clear split between:
- Main process in electron/
- Renderer/UI layer in src/
- It is an offline-first local course player/library, not a client-server app. Most data stays on the user’s machine.
2. Process boundary
- electron/main.js is the privileged process that creates and manages the application window.
- electron/preload.js is the bridge layer that exposes a controlled API to the renderer.
- src/main.js runs in the renderer and drives the UI, course browsing, playback, and search.
3. Renderer subsystem
- src/index.html, src/styles.css, and src/main.js form the application’s UI layer.
- This layer is responsible for the user-facing experience described in the README: minimalist interface, library browsing, media viewing, and progress-aware playback.
- The renderer likely owns most of the state for the current course list, selected item, search results, and playback position display.
4. Application shell / windowing
- The Electron main process is the outer shell around the app.
- Because the README mentions a frameless UI, the main process likely configures a custom window without standard OS chrome.
- This makes the shell behavior important: window creation, lifecycle, and app-level controls are separated from the content UI.
5. Security and API boundary
- preload.js is a key architectural boundary: it lets the renderer call into system capabilities without direct Node.js access.
- This usually means file-system or media-related operations are exposed through a narrowed IPC/API surface rather than raw Electron access from the UI.
6. Local content model
- The app is built around user-provided local files rather than remote content.
- Supported content types from the README include MP4, WebM, MP3, PDFs, and text files.
- The main data flow is from the user’s local filesystem into the library/UI, then into a viewer/player based on file type.
7. Media and document handling
- The renderer likely routes different file types to different presentation modes:
- video/audio playback for MP4/WebM/MP3
- document/text viewing for PDF/text files
- This implies a content-dispatch layer in the UI that selects the right viewer based on file metadata or extension.
8. Progress tracking
- A core feature is saving playback position for videos.
- The data flow is: user watches content → current position is captured → progress is persisted locally → later sessions restore that point.
- This is an important architectural concern because it adds local persistence beyond simple playback.
9. Search / library navigation
- The README calls out fast search and instant access to the course library.
- Architecturally, this suggests the app maintains an indexed or in-memory representation of the local course catalog in the renderer, likely populated from filesystem scans or imported folders.
10. Offline-first persistence
- There is no sign of a backend service, authentication system, or cloud sync.
- Any persisted state such as progress, library metadata, or last-opened items is likely stored locally by the app.
- This reinforces the boundary: filesystem and local app storage are the primary data sources/sinks.
11. Assets and packaging
- build/icon.png and the build/ directory indicate packaged desktop branding/artifacts.
- The repository appears oriented toward distribution as an Electron app, where static assets and packaging metadata matter to the final executable.
12. Technology stack
- Core runtime: Electron
- UI: plain HTML/CSS/JavaScript in src/
- No separate backend, database server, or network API is evident from the tree.
- The architecture is therefore a single desktop executable with a renderer/main-process split.
13. How to draw the diagram
- Show one outer box for the Electron desktop app.
- Inside it, separate:
- Main process: window lifecycle, app shell, privileged OS/file access
- Preload bridge: safe IPC/API exposure
- Renderer/UI: library browsing, search, media/document viewing, progress tracking
- Draw arrows from the renderer to the preload bridge, then to the main process for privileged operations.
- Draw arrows from the app to the local filesystem as the primary data source and persistence target.
14. What is not present
- No evidence of a remote API, authentication, background job system, or multi-user backend.
- The architecture is intentionally compact and local, with the main complexity concentrated in the renderer and the file/media handling path.
Main entry points: src/main.js Renderer app · preload.js Preload bridge · electron/main.js Main process · package.json Package manifest
Components 17
Desktop shell
Electron main-process boundary and app windowing
- PlayCORE · Offline-first local course player and library
- Main process · Creates the window and handles app-level lifecycle
electron/main.js - Preload bridge · Exposes a narrowed API from Electron to the renderer
electron/preload.js - App window · Custom desktop window chrome and lifecycle
Renderer UI
HTML/CSS/JS interface and playback logic
- Renderer app · Drives browsing, search, playback, and state
src/main.js - UI markup · Application structure and view containers
src/index.html - Styling · Minimal desktop presentation and layout
src/styles.css - Library view · Course browsing and selection surface
- Search · Fast lookup across the local course catalog
- Media player · Video and audio presentation for local media
- Document viewer · PDF and text reading surface
Local content
Filesystem-backed library, progress, and file handling
- Progress state · Saved playback position and last-opened content
- Local files · User-provided MP4, WebM, MP3, PDF, and text files
- Course catalog · In-memory or persisted representation of the library
Packaging
Build-time desktop assets and distribution artifacts
- Assets · Icons and packaged UI resources
src/assets - Build output · Desktop packaging and release resources
build - Package manifest · App entry points and Electron packaging config
package.json
Connections 19
- PlayCORE → Main process: starts · The app boots through the Electron main process
- Main process → App window: creates · Main process owns the desktop window
- Main process → Preload bridge: loads · Window setup wires in the preload bridge
- Preload bridge → Renderer app: exposes API · Safe access to privileged operations
- Renderer app → UI markup: renders · Renderer drives the visible UI structure
- Renderer app → Styling: applies · Styling shapes the minimalist interface
- Renderer app → Library view: coordinates · Library browsing is managed in the renderer
- Renderer app → Search: supports · Search filters the local catalog
- Renderer app → Media player: routes media · Media files are opened in playback mode
- Renderer app → Document viewer: routes docs · PDF and text content are opened in reader mode
- Renderer app → Course catalog: reads · UI state is driven by the local course index
- Renderer app → Progress state: updates · Playback position and session state are persisted locally
- Preload bridge → Local files: accesses · Controlled file-system operations flow through the bridge
- Preload bridge → Progress state: persists · Bridge stores and restores playback progress
- Local files → Course catalog: builds · Filesystem scans populate the course catalog
- Course catalog → Search: indexes · Search operates over the library representation
- Assets → Renderer app: supplies · Static assets support the UI
- Package manifest → Main process: configures · Manifest defines Electron entry points and packaging
- Package manifest → Build output: packages · Build resources feed desktop distribution