Introducing a new way to review your PRs.

Read the announcement

iv-org / invidious

Invidious is an alternative front-end to YouTube

View on GitHub

19 documents · Updated Oct 12, 2026

overview

Knowledge Base updated: 2026-10-11

Invidious knowledge base

Invidious is a Crystal-based alternative web frontend and API server for YouTube. Its application layer registers browser and API routes, retrieves and normalizes upstream data, renders HTML or JSON, and maintains optional user state.

The main parts are the HTTP server and route handlers, YouTube integration and media helpers, account/library features, database-backed persistence and migrations, and deployment tooling. Runtime configuration controls upstream access, privacy behavior, tokens, proxying, and service operation.

Critical persistent state includes PostgreSQL-backed users, sessions, subscriptions, playlists, channels, videos, and migration metadata. Deployment state is supplied through configuration, container definitions, database initialization assets, and service manifests.

flowchart TD
  Browser[Browser / API client] --> Server[Crystal HTTP server]
  Server --> Middleware[Middleware and assets]
  Server --> Routes[Web and API route families]
  Routes --> Features[Feature handlers]
  Features --> YouTube[YouTube integration]
  Features --> Render[Templates and serializers]
  YouTube --> Render
  Features --> DB[(PostgreSQL)]
  Features --> Jobs[Background jobs]
  Jobs --> DB
  Config[Runtime configuration] --> Server
  Config --> YouTube
  Deploy[Container and service deployment] --> Server
  Deploy --> DB
  Render --> Browser

Glossary

  • Invidious — the Crystal application that provides web and API access to YouTube content.
  • Instance — a deployed Invidious server with its own configuration, database, and operational policies.
  • PO Token — a request token used by some YouTube access flows.
  • Preferences — persisted or cookie-derived viewer settings that affect rendering and playback behavior.
  • Shard — a Crystal dependency declared in shard.yml and resolved in shard.lock.

Codebase-wide invariants

  • Route behavior is registered through the application’s route setup and delegated handlers; changes to src/invidious/routes/** must preserve the corresponding route-family contract.
  • Persistent schema changes must be represented through migration and schema assets, not only model code; see config/migrate/** and config/sql/**.
  • Runtime behavior is configuration-driven rather than hard-coded for a deployment; see src/invidious/config.cr and configuration templates under config/**.
  • API v1 consumers receive transformed response objects rather than raw internal domain objects; see src/invidious/routes/api/v1/** and src/invidious/helpers/serialization/**.
  • Crystal dependencies are jointly defined by shard.yml and the locked resolution in shard.lock.

Routing table