Skip to content

Latest commit

Β 

History

467 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Omni – Hyper-Personalized Media Network & Feed Assembly Engine

License: MIT Next.js Strapi HLS AES-128 WebSocket Ollama AI PostgreSQL PM2

Omni Media Network Preview

Omni is a modern, high-performance open-core boilerplate for hyper-personalized social networks, encrypted video streaming platforms, real-time WebSocket chat networks, and AI-driven media distribution hubs. Built with Next.js 16 (App Router), Strapi v5 (PostgreSQL), Standalone WebSocket Microservice (omni-socket), Level 4 AES-128 HLS Video Transcoding, and Local Ollama AI Orchestration, Omni introduces Stateful Preference Vectors to replace traditional, expensive event-logging databases.


🌐 Live Demo & Credentials

You can test the running production deployment online:

πŸ”‘ Demo Login Credentials

1. Frontend Test User Accounts (Web App)

You can log in directly via the Quick-Login presets in the login modal or use these credentials:

  • Demo Tech User (Tech & Science Focus):
    • E-Mail / Identifier: demotech@inwebdesign.net
    • Password: DemoUser2026!
  • Demo Gourmet User (Cooking & Nature Focus):
    • E-Mail / Identifier: demogourmet@inwebdesign.net
    • Password: DemoUser2026!

2. Strapi CMS Admin Access (Demo Editor)


πŸ“„ License & Premium AI Features

The core boilerplate, standard feed assembly, video library catalog, batch tracking, content detail views, shorts feed, real-time messaging, subscriptions, and authentication code in this repository are open-source and released under the MIT License. You are free to use, modify, and distribute this foundation for your own projects.

🌟 Unlock the Premium AI Engine & Managed Hosting

The advanced local LLM orchestration (Ollama Llama 3.1 & Moondream Vision AI), real-time intent classification, conversational memory, and automated vector mutation are part of the InWebDesign Premium AI Engine.

If you want to integrate the complete AI orchestration into your project without building it from scratch, we offer fully managed hosting, Proxmox LXC cluster deployments, and custom AI consulting.

πŸ“© Contact InWebDesign for Premium AI Integration & Managed Hosting


🧠 Key Features & Architectural Highlights

1. 🎯 Stateful Preference Vectors & Dynamic Vector Decay (Vision & Core Architecture)

Omni replaces traditional event-log database bloat with a lightweight, stateful Preference Vector Engine stored directly inside a single affinityGraph JSONB field per user in PostgreSQL:

{
  "contentTypes": { "video": 0.8, "pdf": 0.85, "article": 0.7, "short": 0.5 },
  "topics": {
    "Science": { "score": 95, "last_interacted": "2026-08-14T10:00:00Z" },
    "PostgreSQL": { "score": 100, "last_interacted": "2026-08-14T10:00:00Z" }
  },
  "creators": { "1": { "score": 50, "last_interacted": "2026-08-14T10:00:00Z" } }
}
  • πŸ“‰ Time-Weighted Vector Decay: Older topic scores automatically decay over time using a time-weighted decay function. Active user engagements boost scores, while inactive topics naturally fade.
  • πŸ€– AI Dynamic Keyword Extraction: As users consume media or talk to the AI Assistant ("Show me recipes", "Science PDFs"), the system dynamically parses intent, mutates affinityGraph vectors, and renders visual badges (⚑ Algorithm Adjustment: Cooking +95%).
  • ⚑ Strict 50-Keyword Performance Cap: To guarantee sub-10ms feed assembly and prevent memory bloat, affinityGraph enforces a strict cap of maximum 50 topics. Low-ranking or decayed topics are automatically pruned.

2. ⚑ Standalone WebSocket Microservice (omni-socket) & Real-Time Chat Engine

Omni features a dedicated, low-latency WebSocket microservice (socket/) running on port 4000 behind Nginx SSL (omni-socket.inwebdesign.net):

  • πŸ”Œ Zero-Polling Architecture: Replaces expensive HTTP polling with instant, bi-directional WebSocket event delivery.
  • πŸ’¬ Dual-View Chat System: Full-screen 2-column view and compact floating support widget. Supports 1:1 direct user DMs, global community channels, and group chat rooms.
  • πŸ€– Dynamic AI Assistant Invitation ([+ Invite AI] / [x Remove AI]): Users can dynamically invite the Omni AI Assistant into any chat room. When invited, the bot responds contextually; when removed, it leaves the room cleanly via real-time WebSocket signals.
  • πŸ”’ Granular Privacy & Subscriber-Only DMs: Users can set direct message permissions (Everyone, Subscribers Only, Nobody). When set to Subscribers Only, the system verifies active channel subscriptions before allowing DMs.

3. πŸ”” In-App Notifications & Real-Time Drawer

Omni features a centralized notification engine (api::notification.notification):

  • πŸ“¬ Header Notification Drawer: Real-time unread badges (NotificationsBadge) in the top navigation bar with quick mark-as-read and mark-all-read controls.
  • πŸš€ Automated Notification Triggers: Fires automated notifications for new_subscriber, chat_invite, and comment replies.
  • πŸ”— Smart Deep-Linking: Clicking a notification automatically opens the target chat room (openChat(roomId)), video player, or user profile without page reloads.

4. πŸ”” Subscriptions & Standardized Favorites System

  • πŸ”” Subscriptions Engine (api::subscription.subscription): Supports channel subscriptions (Creators) and chat room subscriptions with live subscriber counting.
  • ⚑ Interactive <SubscribeButton> Component: Features optimistic UI updates, state synchronization, and floating Toast notifications ("Channel subscribed successfully! πŸŽ‰").
  • ❀️ Standardized Favorites (api::favorite.favorite): Unified REST API (/api/favorites) allowing users to favorite and bookmark videos, articles, and feed items across the platform.

5. πŸ”’ Level 4 AES-128 Encrypted HLS Video Pipeline

Omni implements an enterprise-grade content security architecture:

  • πŸ” On-Disk AES-128 Encryption (Level 4 Security): Every .ts video segment file stored on disk is encrypted with a unique 128-bit AES key (enc.key). Raw .ts files are 100% unplayable if copied directly.
  • πŸ”‘ Visibility-Gated Key Authorization Endpoint (/api/media/key/[slug]): The 16-byte AES decryption key is released according to the video's own visibility field, not according to whether a session exists. Published (public) videos stream for anonymous visitors, while private videos return 401/403 unless the requesting session owns them. The same check guards the unencrypted MP4 renditions; HLS segments need no gate of their own, since they are AES-encrypted on disk and useless without the key.
  • πŸ›‘οΈ Client Memory Isolation: Native hls.js decodes segments into tab-scoped blob:http://... MediaSource buffers, preventing direct URL hotlinking and unauthorized media extraction.

⚠️ Deployment note β€” never symlink the media directory into web/public/. Anything reachable under web/public/ is served by Next.js as a static asset before App Router route handlers run. A web/public/media -> /path/to/media symlink therefore silently bypasses app/media/[...path]/route.ts entirely, taking the visibility check, the traversal guard and the Range implementation out of the request path. Point MEDIA_ROOT in the route handler at the media directory instead and let every /media/* request go through it.

6. 🎬 Custom YouTube-Style Video Player & Interactive Tag Engine

  • πŸŽ›οΈ YouTube-Style Player Controls (CustomVideoPlayer.tsx): Includes scrub bar hover timestamp tooltips, smooth play/pause animations, volume hover expansion, and full-screen toggle.
  • βš™οΈ HLS Quality Selector: Seamless manual or automatic quality resolution switching (Auto, 1080p, 720p, 480p).
  • 🏷️ Interactive Clickable Tag Engine: All video tags on detail pages (#Breakfast, #NextJS) are interactive links navigating directly to /videos?page=1&includetag=....

7. 🌐 Multilingual i18n Dictionary System

  • πŸ‡©πŸ‡ͺ πŸ‡¬πŸ‡§ Central Dictionary Infrastructure (/dictionaries/de.json & /dictionaries/en.json): Complete UI internationalization covering headers, search bars, player controls, user profiles, chat widgets, privacy modals, and AI assistant prompts.
  • πŸ”„ Instant Language Switching: Instant toggle between German (DE) and English (EN) with persistent local storage and cookie sync.

πŸ› οΈ Monorepo Structure

omni-stack-ai/
β”œβ”€β”€ cms/                     # Strapi v5 Headless CMS (PostgreSQL, TypeScript Factories & Schemas)
β”‚   β”œβ”€β”€ config/              # PostgreSQL, CORS & Plugin configurations
β”‚   └── src/api/             # Controllers, Services (subscriptions, favorites, notifications, chat)
β”œβ”€β”€ socket/                  # Standalone Real-Time WebSocket Server (omni-socket, Port 4000)
β”‚   └── server.js            # Socket.io / WebSocket Server handling real-time chat & AI events
β”œβ”€β”€ web/                     # Next.js 16 App Router Frontend
β”‚   β”œβ”€β”€ src/app/             # Pages, Catalog (/videos), Detail View (/video/[slug]), Shorts (/shorts)
β”‚   β”œβ”€β”€ src/app/api/         # REST API Routes (/api/subscriptions, /api/favorites, /api/chat)
β”‚   β”œβ”€β”€ src/components/      # SubscribeButton, CustomVideoPlayer, ChatWidget, NotificationDrawer
β”‚   β”œβ”€β”€ src/context/         # AppContext (i18n), ChatContext (Rooms, Socket & Messages)
β”‚   └── src/dictionaries/    # Multilingual i18n JSON Dictionaries (de.json, en.json)
β”œβ”€β”€ ecosystem.config.js      # PM2 Process Manager setup (omni-cms, omni-web, omni-socket)
β”œβ”€β”€ turbo.json               # Turborepo task pipeline (Turbo v2)
β”œβ”€β”€ package.json             # Monorepo workspaces configuration
└── LICENSE                  # MIT License (InWebDesign)

Note: The media converter and the content-fill service run in separate LXC containers by design to keep heavy transcoding and Ollama LLM load off the web/CMS container.


πŸš€ Getting Started

Prerequisites

  • Node.js: v22.15.1 or higher
  • PostgreSQL: v15 or higher
  • FFmpeg: v6.0 or higher (with QSV / HLS support)
  • PM2: npm install -g pm2

1. Installation

git clone git@github.com:InWebDesign-net/omni-stack-ai.git
cd omni-stack-ai
npm install

2. Database & Environment Setup

Create PostgreSQL database omni_stack_db and configure cms/.env & web/.env.local:

# cms/.env
DATABASE_CLIENT=postgres
DATABASE_HOST=127.0.0.1
DATABASE_PORT=5432
DATABASE_NAME=omni_stack_db
DATABASE_USERNAME=omni_user
DATABASE_PASSWORD=omni_password_secure
OLLAMA_URL=http://10.0.0.6:11434/v1/chat/completions
OLLAMA_MODEL=llama3.1:latest
DEMO_MODE=false      # ON when unset: wipes demo content and every affinityGraph nightly at 04:00

3. Build & Run with PM2

# Build both apps via Turborepo
npm run build

# Start services under PM2 (omni-cms, omni-web, omni-socket)
npm run start

Services will be online:


πŸ“š Technical Documentation & Service Guides

Detailed architectural guides and setup instructions for external microservices and AI modules:

  • 🎞️ Media Converter Service Guide: HLS Transcoding pipeline, FFmpeg specs, folder-in/out patterns vs. production button/queue integrations.
  • πŸ“ Content Fill Service Guide: Automated metadata generation pipeline, SQLite state DB, dev/demo auto-filling vs. production human-in-the-loop admin workflows.
  • 🧠 Local AI Integration Guide: Ollama setup, Moondream2 Computer Vision, Llama 3.1 bilingual JSON generation, and model swapping guidelines.
  • πŸ”’ Omni Viewer Visibility Guide: Default-deny visibility middleware and user access policy architecture.

🌐 Managed Hosting & Consulting

For enterprise deployments, custom AI prompt engineering, or managed Proxmox LXC clustering:

About

A hyper-personalized, AI-driven social feed and full-stack monorepo boilerplate. Built with NextJS, Strapi v5, and PostgreSQL. Features an open-source core with a pluggable AI architecture for dynamic content interleaving.

Topics

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages