# StreamFlow IPTV - Project Structure ``` tv/ β”œβ”€β”€ πŸ“„ README.md # Main documentation β”œβ”€β”€ πŸ“„ SETUP.md # Installation guide β”œβ”€β”€ πŸ“„ ARCHITECTURE.md # Architecture overview β”œβ”€β”€ πŸ“„ package.json # Root package file β”œβ”€β”€ πŸ“„ .env.example # Environment template β”œβ”€β”€ πŸ“„ .gitignore # Git ignore rules β”œβ”€β”€ πŸ“„ .dockerignore # Docker ignore rules β”œβ”€β”€ 🐳 Dockerfile # Multi-stage Docker build β”œβ”€β”€ 🐳 docker-compose.yml # Docker Compose config β”œβ”€β”€ πŸš€ start.sh # Start script β”œβ”€β”€ πŸ›‘ stop.sh # Stop script β”‚ β”œβ”€β”€ πŸ“ backend/ # Node.js Backend β”‚ β”œβ”€β”€ πŸ“„ package.json # Backend dependencies β”‚ β”œβ”€β”€ πŸš€ server.js # Main server file β”‚ β”œβ”€β”€ πŸ’Š healthcheck.js # Docker health check β”‚ β”‚ β”‚ β”œβ”€β”€ πŸ“ database/ # Database layer β”‚ β”‚ └── πŸ—„οΈ db.js # SQLite setup & schema β”‚ β”‚ β”‚ β”œβ”€β”€ πŸ“ middleware/ # Express middleware β”‚ β”‚ └── πŸ”’ auth.js # JWT authentication β”‚ β”‚ β”‚ β”œβ”€β”€ πŸ“ routes/ # API endpoints β”‚ β”‚ β”œβ”€β”€ πŸ” auth.js # Authentication routes β”‚ β”‚ β”œβ”€β”€ πŸ“Ί channels.js # Channel management β”‚ β”‚ β”œβ”€β”€ πŸ“‹ playlists.js # Playlist management β”‚ β”‚ β”œβ”€β”€ πŸ“… epg.js # EPG data β”‚ β”‚ β”œβ”€β”€ ⏺️ recordings.js # Recording system β”‚ β”‚ β”œβ”€β”€ πŸ‘€ profiles.js # User profiles β”‚ β”‚ β”œβ”€β”€ πŸ“» radio.js # Radio channels β”‚ β”‚ β”œβ”€β”€ πŸ“‚ groups.js # Custom groups β”‚ β”‚ β”œβ”€β”€ βš™οΈ settings.js # User settings β”‚ β”‚ β”œβ”€β”€ 🎬 stream.js # Stream proxy β”‚ β”‚ └── πŸ“Š stats.js # Analytics β”‚ β”‚ β”‚ β”œβ”€β”€ πŸ“ jobs/ # Background jobs β”‚ β”‚ β”œβ”€β”€ πŸ“‘ epgSync.js # EPG synchronization β”‚ β”‚ β”œβ”€β”€ πŸ’š channelHealth.js # Health monitoring β”‚ β”‚ └── ⏰ recordingScheduler.js # Recording scheduler β”‚ β”‚ β”‚ └── πŸ“ utils/ # Utilities β”‚ β”œβ”€β”€ πŸ“ logger.js # Winston logger β”‚ └── πŸ” m3uParser.js # M3U parser β”‚ β”œβ”€β”€ πŸ“ frontend/ # React Frontend β”‚ β”œβ”€β”€ πŸ“„ package.json # Frontend dependencies β”‚ β”œβ”€β”€ βš™οΈ vite.config.js # Vite configuration β”‚ β”œβ”€β”€ πŸ“„ index.html # HTML template β”‚ β”‚ β”‚ β”œβ”€β”€ πŸ“ public/ # Static assets β”‚ β”‚ β”œβ”€β”€ placeholder-channel.png β”‚ β”‚ └── placeholder-show.png β”‚ β”‚ β”‚ └── πŸ“ src/ # Source code β”‚ β”œβ”€β”€ 🎯 main.jsx # Entry point β”‚ β”œβ”€β”€ 🎨 App.jsx # Main app component β”‚ β”œβ”€β”€ 🌍 i18n.js # Internationalization β”‚ β”œβ”€β”€ 🎨 theme.js # MUI themes β”‚ β”œβ”€β”€ πŸ’… index.css # Global styles β”‚ β”‚ β”‚ β”œβ”€β”€ πŸ“ components/ # React components β”‚ β”‚ β”œβ”€β”€ 🎬 VideoPlayer.jsx # Video player β”‚ β”‚ β”œβ”€β”€ πŸ“Ί EPGTimeline.jsx # EPG viewer β”‚ β”‚ β”œβ”€β”€ 🏠 Sidebar.jsx # Navigation sidebar β”‚ β”‚ └── πŸ” Header.jsx # Top header β”‚ β”‚ β”‚ β”œβ”€β”€ πŸ“ pages/ # Page components β”‚ β”‚ β”œβ”€β”€ πŸ” Login.jsx # Login page β”‚ β”‚ β”œβ”€β”€ πŸ“ Register.jsx # Registration page β”‚ β”‚ β”œβ”€β”€ πŸ“Š Dashboard.jsx # Main dashboard β”‚ β”‚ β”œβ”€β”€ πŸ“Ί LiveTV.jsx # Live TV page β”‚ β”‚ β”œβ”€β”€ πŸ“» Radio.jsx # Radio page β”‚ β”‚ β”œβ”€β”€ 🎬 Movies.jsx # Movies page β”‚ β”‚ β”œβ”€β”€ πŸ“Ί Series.jsx # Series page β”‚ β”‚ β”œβ”€β”€ ⭐ Favorites.jsx # Favorites page β”‚ β”‚ └── βš™οΈ Settings.jsx # Settings page β”‚ β”‚ β”‚ β”œβ”€β”€ πŸ“ store/ # Zustand stores β”‚ β”‚ β”œβ”€β”€ πŸ” authStore.js # Auth state β”‚ β”‚ └── 🎨 themeStore.js # Theme state β”‚ β”‚ β”‚ β”œβ”€β”€ πŸ“ utils/ # Utilities β”‚ β”‚ └── 🌐 api.js # Axios client β”‚ β”‚ β”‚ └── πŸ“ locales/ # Translations β”‚ β”œβ”€β”€ πŸ‡¬πŸ‡§ en.json # English β”‚ └── πŸ‡·πŸ‡΄ ro.json # Romanian β”‚ β”œβ”€β”€ πŸ“ data/ # Persistent data (Docker volume) β”‚ β”œβ”€β”€ πŸ“ playlists/ # Uploaded playlists β”‚ β”œβ”€β”€ πŸ“ recordings/ # Recorded content β”‚ β”œβ”€β”€ πŸ“ logos/ # Channel logos β”‚ β”œβ”€β”€ πŸ“ epg/ # EPG cache β”‚ β”œβ”€β”€ πŸ“ uploads/ # User uploads β”‚ └── πŸ—„οΈ streamflow.db # SQLite database β”‚ └── πŸ“ logs/ # Application logs (Docker volume) β”œβ”€β”€ πŸ“„ error.log # Error logs └── πŸ“„ combined.log # All logs ``` ## File Count Summary - **Total Files**: 52 - **Backend Files**: 17 - **Frontend Files**: 25 - **Configuration**: 7 - **Documentation**: 3 ## Key Technologies by Layer ### Backend - **Runtime**: Node.js 20 (Alpine Linux) - **Framework**: Express.js - **Database**: SQLite3 - **Authentication**: JWT + Bcrypt - **Security**: Helmet, CORS, Rate Limiting - **Media**: FFmpeg, Streamlink - **Jobs**: node-cron - **Logging**: Winston ### Frontend - **Framework**: React 18 - **Build Tool**: Vite - **UI Library**: Material-UI (MUI) 5 - **Router**: React Router 6 - **State**: Zustand - **HTTP Client**: Axios - **i18n**: i18next - **Video**: React Player ### Infrastructure - **Container**: Docker (Alpine base) - **Orchestration**: Docker Compose - **Volumes**: Named volumes for data/logs - **Network**: Bridge network - **Health**: Automatic health checks ## Lines of Code (Approximate) | Component | Lines | |-----------|-------| | Backend Routes | ~800 | | Database Schema | ~200 | | Frontend Components | ~1200 | | Pages | ~800 | | Configuration | ~400 | | **Total** | **~3400** | ## Security Features by File | File | Security Features | |------|------------------| | `Dockerfile` | Non-root user, capability dropping, minimal base | | `docker-compose.yml` | Security opts, resource limits, health checks | | `backend/middleware/auth.js` | JWT validation, role-based access | | `backend/routes/auth.js` | Bcrypt hashing, rate limiting, input validation | | `backend/server.js` | Helmet headers, CORS, compression | | `frontend/src/utils/api.js` | Token injection, 401 handling | ## Development Workflow ``` 1. πŸ“ Edit source files └── backend/ or frontend/src/ 2. πŸ”§ Test locally └── npm run dev:backend └── npm run dev:frontend 3. πŸ—οΈ Build Docker image └── docker-compose build 4. πŸš€ Deploy container └── docker-compose up -d 5. βœ… Verify deployment └── http://localhost:12345 ``` ## Production Checklist - [ ] Change JWT_SECRET in .env - [ ] Change SESSION_SECRET in .env - [ ] Set NODE_ENV=production - [ ] Configure SSL/HTTPS (reverse proxy) - [ ] Set up firewall rules - [ ] Configure backup schedule - [ ] Set up monitoring/alerts - [ ] Test all features - [ ] Review logs for errors - [ ] Document custom configurations --- **Last Updated**: December 2025 **Version**: 1.0.0