Skip to content

Deploying cMyflix

Introduction

cMyflix is a lightweight, self-hosted streaming server that provides a Netflix-like interface for your personal media collection. Unlike more complex media server solutions, cMyflix focuses on simplicity and ease of use, offering a clean web interface to browse and stream your movies and TV shows without the overhead of transcoding or complex metadata management.

Built with simplicity in mind, cMyflix scans your media directories and presents them in an attractive, organized interface. The focus is on direct streaming of your media files in their original format, making it ideal for users who have already organized their collections and prefer a lightweight streaming solution.

Key highlights of cMyflix:

  • Simple Interface: Clean, Netflix-inspired design for browsing your media
  • Direct Streaming: Stream media files directly without transcoding overhead
  • Automatic Scanning: Automatically discovers and indexes media from your directories
  • Metadata Support: Displays movie and show information from embedded metadata
  • Responsive Design: Works on desktop, tablet, and mobile devices
  • Minimal Resources: Lightweight footprint with no database requirements
  • Easy Setup: Simple configuration with minimal dependencies
  • Cover Art Support: Displays poster images for your media
  • 100% Open Source: Self-hosted with complete control over your data

This guide walks through deploying cMyflix on Klutch.sh, configuring your media library, and accessing your personal streaming server.

Why Deploy cMyflix on Klutch.sh

Deploying cMyflix on Klutch.sh provides several advantages for your media streaming setup:

Simplified Deployment: Klutch.sh handles container orchestration, letting you focus on organizing your media rather than managing infrastructure.

Persistent Storage: Attach volumes for your media collection that persist across container restarts and updates.

HTTPS by Default: Automatic SSL certificates ensure secure streaming access from anywhere.

GitHub Integration: Connect your configuration repository directly to Klutch.sh for automated deployments.

Custom Domains: Use your own domain for a professional streaming URL.

Always-On Availability: Your media library remains accessible 24/7 without managing physical servers.

Prerequisites

Before deploying cMyflix on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your configuration
  • A collection of media files (movies, TV shows) in supported formats
  • Basic familiarity with Docker and containerization
  • (Optional) A custom domain for your streaming server

Understanding cMyflix Architecture

cMyflix uses a straightforward architecture optimized for simplicity:

Web Server: A lightweight server serves the web interface and handles media streaming requests.

File System Scanning: The application scans configured directories to discover media files and their metadata.

Direct Streaming: Media files are served directly to the browser without transcoding, reducing server load and preserving quality.

Static Interface: The frontend is a responsive web application that works across all modern browsers.

Preparing Your Repository

Create a GitHub repository with your cMyflix configuration.

Repository Structure

cmyflix-deploy/
├── Dockerfile
├── config/
│ └── settings.json
├── nginx.conf
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile for cMyflix deployment:

FROM node:18-alpine AS builder
WORKDIR /app
# Clone cMyflix repository
RUN apk add --no-cache git
RUN git clone https://github.com/fareedst/cmyflix.git .
# Install dependencies
RUN npm install
# Build the application
RUN npm run build
# Production image
FROM nginx:alpine
# Install Node.js for the backend server
RUN apk add --no-cache nodejs npm
# Copy built frontend
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy backend files
COPY --from=builder /app/server /app/server
COPY --from=builder /app/package*.json /app/
# Install server dependencies
WORKDIR /app
RUN npm install --production
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Create media directories
RUN mkdir -p /media/movies /media/tvshows
# Copy configuration
COPY config/ /app/config/
# Create startup script
RUN echo '#!/bin/sh' > /start.sh && \
echo 'node /app/server/index.js &' >> /start.sh && \
echo 'nginx -g "daemon off;"' >> /start.sh && \
chmod +x /start.sh
# Expose ports
EXPOSE 80 3000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD wget -q --spider http://localhost/ || exit 1
CMD ["/start.sh"]

Creating Nginx Configuration

Create an nginx.conf file:

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# API proxy to backend
location /api/ {
proxy_pass http://localhost:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Media streaming
location /media/ {
alias /media/;
# Enable range requests for seeking
add_header Accept-Ranges bytes;
# CORS headers for video playback
add_header Access-Control-Allow-Origin *;
# Optimize for streaming
sendfile on;
tcp_nopush on;
tcp_nodelay on;
# Large file support
client_max_body_size 0;
}
# Frontend routing
location / {
try_files $uri $uri/ /index.html;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}

Creating Settings Configuration

Create config/settings.json:

{
"mediaDirectories": {
"movies": "/media/movies",
"tvshows": "/media/tvshows"
},
"server": {
"port": 3000,
"host": "0.0.0.0"
},
"scanning": {
"watchForChanges": true,
"scanInterval": 3600
},
"interface": {
"title": "My Media Library",
"itemsPerPage": 24
}
}

Creating the .dockerignore File

Create a .dockerignore file:

.git
.github
*.md
LICENSE
.gitignore
.DS_Store
node_modules/
*.log

Deploying cMyflix on Klutch.sh

Follow these steps to deploy your cMyflix streaming server:

    Organize Your Media Library

    Before deployment, organize your media with a consistent naming structure:

    movies/
    ├── Movie Name (2023)/
    │ ├── Movie Name (2023).mp4
    │ └── poster.jpg
    ├── Another Movie (2022)/
    │ ├── Another Movie (2022).mkv
    │ └── poster.jpg
    tvshows/
    ├── Show Name/
    │ ├── Season 01/
    │ │ ├── Show Name - S01E01.mp4
    │ │ └── Show Name - S01E02.mp4
    │ ├── Season 02/
    │ │ └── ...
    │ └── poster.jpg

    Push Your Repository to GitHub

    Initialize and push your configuration:

    Terminal window
    git init
    git add .
    git commit -m "Initial cMyflix configuration"
    git remote add origin https://github.com/yourusername/cmyflix-deploy.git
    git push -u origin main

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project for your media server.

    Create a New App

    Create a new app within your project and connect your GitHub repository.

    Configure HTTP Traffic

    In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 80

    Attach Persistent Volumes

    Add persistent volumes for your media:

    Mount PathRecommended SizePurpose
    /media/moviesVariableMovie files and posters
    /media/tvshowsVariableTV show files and posters
    /app/config100 MBApplication configuration

    Size your media volumes according to your collection size.

    Deploy Your Application

    Click Deploy to build and start cMyflix. Klutch.sh will:

    • Build the container from your Dockerfile
    • Mount the persistent volumes
    • Start the streaming server
    • Provision an HTTPS certificate

    Upload Your Media

    Once deployed, upload your media files to the persistent volumes. You can use various methods:

    • Direct file upload through Klutch.sh
    • SFTP/SCP if available
    • Cloud sync tools like rclone

    Access cMyflix

    Navigate to https://your-app-name.klutch.sh to access your personal streaming server. Your media should appear after the initial scan completes.

Configuring Your Media Library

Supported File Formats

cMyflix supports common video formats that browsers can play natively:

FormatContainerBrowser Support
H.264MP4, M4VUniversal
H.265/HEVCMP4Limited
VP8/VP9WebMChrome, Firefox
AV1MP4, WebMModern browsers

For best compatibility, use H.264 encoded MP4 files.

Adding Cover Art

Include poster images alongside your media:

Movie Name (2023)/
├── Movie Name (2023).mp4
├── poster.jpg # Main poster
├── backdrop.jpg # Background image
└── fanart.jpg # Fan art

Supported image formats: JPEG, PNG, WebP

TV Show Organization

Organize TV shows with consistent naming:

Show Name/
├── poster.jpg # Show poster
├── Season 01/
│ ├── Show Name - S01E01 - Episode Title.mp4
│ ├── Show Name - S01E02 - Episode Title.mp4
│ └── ...
└── Season 02/
└── ...

Triggering Library Scans

Force a library rescan when adding new content:

Terminal window
# Access the application container
# Trigger rescan through the API
curl -X POST http://localhost:3000/api/scan

Customizing the Interface

Branding

Customize the interface through settings:

{
"interface": {
"title": "Family Movie Night",
"theme": "dark",
"accentColor": "#e50914"
}
}

Categories and Collections

Organize media into custom categories:

{
"collections": [
{
"name": "Favorites",
"items": ["movie1", "movie2"]
},
{
"name": "Kids Movies",
"filter": {
"genre": "Animation"
}
}
]
}

User Access

Basic Authentication

Add basic authentication for privacy:

# In nginx.conf
location / {
auth_basic "Private Media Library";
auth_basic_user_file /etc/nginx/.htpasswd;
try_files $uri $uri/ /index.html;
}

Create the password file during build:

RUN apk add --no-cache apache2-utils
RUN htpasswd -bc /etc/nginx/.htpasswd user password

Multiple Users

For multi-user setups, consider:

  • Different authentication methods
  • User-specific libraries
  • Access control per collection

Streaming Optimization

Large File Support

Configure nginx for large media files:

# In nginx.conf
http {
client_max_body_size 0;
proxy_max_temp_file_size 0;
# Increase timeouts for large files
proxy_connect_timeout 300;
proxy_read_timeout 300;
proxy_send_timeout 300;
}

Range Requests

Enable seeking in videos:

location /media/ {
add_header Accept-Ranges bytes;
# Support partial content
if ($request_method = GET) {
add_header Content-Range bytes;
}
}

Production Best Practices

Performance Recommendations

  • Use SSD Storage: Faster storage improves streaming start times
  • Optimize File Names: Shorter paths improve scanning speed
  • Enable Caching: Cache static assets and metadata
  • Direct Streaming: Avoid transcoding for best performance

Security Considerations

  • HTTPS Only: Always use HTTPS for streaming
  • Authentication: Protect access with passwords or SSO
  • Rate Limiting: Prevent abuse with nginx rate limits

Backup Strategy

Regular backups should include:

  1. Configuration files
  2. Media metadata and posters
  3. User preferences and collections

Note: Media files themselves should have their own backup strategy.

Troubleshooting Common Issues

Videos Not Playing

Symptoms: Video files don’t play in the browser.

Solutions:

  • Verify the video codec is browser-compatible (H.264 recommended)
  • Check nginx CORS headers are set correctly
  • Ensure range requests are enabled
  • Test with a known-working MP4 file

Media Not Appearing

Symptoms: Files exist but don’t show in the interface.

Solutions:

  • Verify file naming follows expected patterns
  • Check that volumes are correctly mounted
  • Trigger a manual library scan
  • Review application logs for scanning errors

Slow Streaming

Symptoms: Videos buffer frequently or take long to start.

Solutions:

  • Ensure adequate network bandwidth
  • Check storage I/O performance
  • Verify files aren’t corrupted
  • Consider lower bitrate versions for remote streaming

High Memory Usage

Symptoms: Application uses excessive memory.

Solutions:

  • Limit concurrent streams
  • Optimize library size
  • Increase container memory allocation

Additional Resources

Conclusion

Deploying cMyflix on Klutch.sh gives you a simple, elegant streaming interface for your personal media collection. The combination of cMyflix’s lightweight design and Klutch.sh’s container management means you get a Netflix-like experience without the complexity of heavier media server solutions.

With direct streaming, responsive design, and minimal resource requirements, cMyflix is ideal for users who want a clean interface for their already-organized media libraries. Whether you’re sharing movies with family or building a personal archive, cMyflix on Klutch.sh provides reliable, accessible streaming from anywhere.