NovaStream / STRUCTURE.md
urstark
docs: Update README.md and add STRUCTURE.md
1fd13a0
|
Raw History Blame Contribute Delete
2.89 kB

πŸ—‚οΈ Project Structure

NovaStream is built on a hybrid architecture, combining a highly interactive React frontend with a robust Node.js streaming proxy backend.

Below is an overview of the core file structure and components:

NovaStream/
β”œβ”€β”€ server.cjs                 # Core Node.js Express server
β”‚                              # Handles /api/metadata, /api/stream, FFmpeg transmuxing, and file probing
β”œβ”€β”€ package.json               # Project dependencies and npm scripts
β”œβ”€β”€ vite.config.js             # Vite configuration for building the React frontend
β”œβ”€β”€ eslint.config.js           # Linter configuration
β”œβ”€β”€ index.html                 # Entry point for the frontend application
β”œβ”€β”€ Dockerfile                 # Configuration for containerizing the application
β”œβ”€β”€ LICENSE                    # GPL-3.0 Open Source License
β”œβ”€β”€ README.md                  # Project overview, features, and setup guide
β”‚
β”œβ”€β”€ public/                    # Static assets
β”‚
└── src/                       # React Frontend Source Code
    β”œβ”€β”€ App.jsx                # Main Application component (UI, Player Logic, State Management)
    β”œβ”€β”€ App.css                # Glassmorphism & Cinematic styling, animations
    └── main.jsx               # React DOM rendering entry point

βš™οΈ Backend Architecture (server.cjs)

The backend is responsible for bypassing cross-origin restrictions (CORS) and handling unsupported browser video formats (like MKV) through real-time processing.

Key Endpoints:

  • GET /api/metadata: Probes the provided video URL using HTTP HEAD requests or ffprobe. Detects file size, duration, container type, and extracts internal audio track metadata.
  • GET /api/stream: The core streaming engine.
    • If the file is a standard MP4/WebM, it acts as a direct byte-range proxy.
    • If the file is an MKV or requires transcoding, it spawns an ffmpeg child process. It pipes fragmented MP4 directly to the Express response, supporting real-time seeking, audio track switching, and optional HEVC-to-H.264 transcoding.

🎨 Frontend Architecture (src/App.jsx)

The frontend is a monolithic yet organized React component that manages the entire lifecycle of the media player.

Key Capabilities:

  • State Management: Handles player states (Play/Pause, Volume, Fullscreen), stream metadata, bookmarks, history, and buffering telemetry.
  • Subtitle Processing: The srtToVtt utility function converts uploaded SRT subtitle files into WebVTT format entirely on the client side.
  • Speedometer & Telemetry: Uses video buffering API (video.buffered) to calculate download speeds and buffer health in real-time.
  • Sandbox Player: Utilizes URL.createObjectURL to allow users to play large local files securely without uploading them to the server.