How stremio/stremio-official-addons works
1. What this repo is
- This repository is a packaged catalog of Stremio’s official add-ons.
- It does not implement add-on logic itself; it curates and publishes a serialized AddonCollection that downstream apps consume.
2. Two parallel product lines
- v1 lives at the repo root and is published as the npm package stremio-official-addons.
- v2 lives under official-addons-v2/ and is published as:
- npm package @stremio/stremio-official-addons
- Rust crate stremio-official-addons
3. Source of truth vs generated artifacts
- The repo is centered around generation scripts, not hand-edited output.
- Root scripts/gen.js produces the v1 output.
- official-addons-v2/scripts/build.js produces the v2 output.
- The committed files index.js and index.json are generated artifacts for the v1 package; the v2 package has its own build output inside its subfolder.
4. Data model boundary
- The key contract is the AddonCollection.load()/save() format mentioned in the README.
- That means the repo’s primary function is to transform an internal add-on list into a stable serialized representation that client apps can load directly.
5. v1 package architecture
- Root package metadata is in package.json with lockfile package-lock.json.
- The root package likely exports the generated collection from index.js and may also expose index.json for consumers that want raw data.
- v1 is the legacy distribution path still used by older Stremio apps and infrastructure.
6. v2 package architecture
- The official-addons-v2/ directory is a self-contained multi-language package.
- It has:
- package.json for npm publishing
- Cargo.toml and Cargo.lock for Rust publishing
- src/lib.rs for the crate entry point
- scripts/build.js for generating the package contents
- This makes v2 a shared artifact source for both JS and Rust consumers.
7. Build and release pipeline
- GitHub Actions under .github/workflows/build.yml and publish.yml automate validation and release.
- The repo uses tag-based releases (v1.x.x and v2.x.x) as the trigger for publishing.
- The publish workflow splits by major version:
- v1 job builds and publishes the root npm package
- v2 job builds and publishes both npm and crates.io artifacts
8. Dependency impact boundaries
- The README explicitly calls out downstream systems that depend on this repo’s output:
- stremio-api-workers
- stremio
- stremio-rn
- stremio-web
- stremio-core
- This means a change here is not local; it propagates into app behavior and backend-served addon collections.
9. Versioning and packaging discipline
- Version bumps must be synchronized with the generated output and lockfiles:
- root npm metadata for v1
- v2 npm metadata plus Rust crate version for v2
- The presence of both npm lockfiles and Cargo.lock is important architecturally: it shows the repo is a published artifact repository, not just source code.
10. Repository layout signals
- Root contains the legacy npm package and generation script.
- official-addons-v2/ contains the newer dual-published package.
- deflate-macro/ is a separate Rust subcrate, likely a utility dependency used by the v2 crate or build process.
- index.js, index.json, and the v2 outputs are the main runtime-facing deliverables.
11. External service touchpoints
- Publication targets are npm and crates.io.
- The GitHub release process is operationally important because publishing is driven from tags/releases, not from arbitrary branch builds.
12. How to diagram this repo
- Model it as a content-generation and packaging pipeline:
- curated add-on definitions → generator scripts → versioned distributable artifacts → npm/crates.io publication → consumption by Stremio clients and backend services.
- The central architectural boundary is between maintained add-on definitions/generators and published serialized collections.
Main entry points: gen.js Gen script · official-addons-v2 V2 output · package.json Root package · build.js Build script
Components 17
v1 package
Legacy npm package at the repository root.
- Gen script · Builds the legacy root distribution.
scripts/gen.js - Index JS · Generated runtime entry for the legacy npm package.
index.js - Index JSON · Generated serialized collection for consumers that want raw data.
index.json - Root package · Legacy published package metadata and release boundary.
package.json
v2 package
New dual-published package under official-addons-v2/.
- Build script · Builds the newer shared package outputs.
official-addons-v2/scripts/build.js - Crate entry · Rust-facing library entry point for v2 consumers.
official-addons-v2/src/lib.rs - V2 package · npm metadata for the v2 publishable package.
official-addons-v2/package.json - V2 crate · Cargo package metadata for publishing to crates.io.
official-addons-v2/Cargo.toml - V2 output · Built distributable files produced by the v2 pipeline.
official-addons-v2
Release pipeline
GitHub Actions workflows that validate and publish tagged releases.
- Build workflow · GitHub Actions workflow for verification builds.
.github/workflows/build.yml - Publish workflow · Tag-triggered workflow that publishes v1 and v2 artifacts.
.github/workflows/publish.yml
Downstream consumers
Stremio apps and backend systems that load the serialized addon collection.
- Stremio apps · Clients and backend services that consume the generated addon collections.
Other components
- AddonCollection · Stable load/save format that downstream clients consume.
- Addon list · Maintained addon definitions that are transformed into distributable artifacts.
README.md - Deflate macro · Separate Rust subcrate likely used by the v2 build or runtime packaging.
deflate-macro/src/lib.rs - npm · Publication target for the root package and the v2 npm package.
- crates.io · Publication target for the v2 Rust crate.
Connections 22
- Addon list → Gen script: input · Curated addon definitions are transformed by the v1 generator.
- Gen script → Index JS: generates · Produces the legacy JS entry artifact.
- Gen script → Index JSON: generates · Produces the serialized collection artifact.
- Gen script → AddonCollection: serializes · Emits the AddonCollection load/save format.
- Index JS → Root package: published by · The root package exposes the generated JS entry.
- Index JSON → Root package: published by · The root package can expose raw generated data.
- Addon list → Build script: input · The maintained catalog is also transformed for v2 outputs.
- Build script → V2 output: generates · Builds the v2 distributable package contents.
- V2 output → V2 package: packed by · npm publish uses the generated v2 package files.
- V2 output → V2 crate: packed by · Cargo publish uses the generated crate contents.
- Crate entry → V2 crate: entry point · Defines the Rust crate surface.
- Deflate macro → Build script: supports · Auxiliary Rust code that may assist the v2 packaging pipeline.
- Build workflow → Gen script: validates · CI checks the generation pipeline.
- Build workflow → Build script: validates · CI checks the v2 build pipeline.
- Publish workflow → Root package: publishes · Tag-based release publishes the legacy npm package.
- Publish workflow → V2 package: publishes · Tag-based release publishes the v2 npm package.
- Publish workflow → V2 crate: publishes · Tag-based release publishes the Rust crate.
- Root package → npm: release target · Root v1 package is distributed through npm.
- V2 package → npm: release target · V2 JS package is distributed through npm.
- V2 crate → crates.io: release target · V2 Rust package is distributed through crates.io.
- Index JSON → Stremio apps: consumed by · Older clients and services load the serialized collection directly.
- V2 output → Stremio apps: consumed by · Newer clients and services consume the v2 package outputs.