by Tia

PeerTube is a free, decentralized, ActivityPub-federated video hosting platform with live streaming, P2P delivery, plugin support, and a full REST API — for self-hosters and developers.
This block provides the full PeerTube server source (user@example.com), a federated ActivityPub-compatible video hosting platform. It includes the Node.js/TypeScript backend server, CLI tooling (peertube-cli), and a remote transcoding runner (peertube-runner). The typical buyer is a backend engineer embedding PeerTube's server logic, runner processes, or CLI utilities into a self-hosted or custom deployment pipeline.
.github/ - CI/CD workflows, issue templates, and contribution guidelinesapps/ - Standalone CLI tool (peertube-cli) and remote transcoding runner (peertube-runner)client/ - Angular frontend application (served by the backend)config/ - Default and production configuration files (YAML)packages/ - Shared TypeScript packages (core-utils, ffmpeg wrappers, models, etc.)scripts/ - Build, migration, and maintenance scriptsserver/ - Core Express/Node.js backend: routes, models, federation, jobs, live streamingsupport/ - Docker files, nginx configs, systemd units, and deployment support.dprint.json - Code formatter configuration.mocharc.cjs - Mocha test runner configuration.oxlintrc.json - Linter configurationAGENTS.md - Notes for AI agents working with the codebaseCHANGELOG.md - Full version historypackage.json - Root workspace package manifestpnpm-workspace.yaml - pnpm monorepo workspace definitiontsconfig.base.json - Shared TypeScript compiler base configurationnpm install @aws-sdk/client-s3 @aws-sdk/lib-storage @aws-sdk/s3-request-presigner
npm install @commander-js/extra-typings
npm install @misskey-dev/node-http-message-signatures
npm install @node-oauth/oauth2-server
npm install @opentelemetry/api @opentelemetry/exporter-jaeger @opentelemetry/exporter-prometheus
npm install @opentelemetry/instrumentation @opentelemetry/instrumentation-dns
npm install @opentelemetry/instrumentation-express @opentelemetry/instrumentation-fs
npm install @opentelemetry/instrumentation-http @opentelemetry/instrumentation-ioredis
npm install @opentelemetry/instrumentation-pg @opentelemetry/resources
npm install @opentelemetry/sdk-metrics @opentelemetry/sdk-trace-base
npm install @opentelemetry/sdk-trace-node @opentelemetry/semantic-conventions
npm install @peertube/bittorrent-tracker-server @peertube/feed
npm install @peertube/peertube-core-utils @peertube/peertube-ffmpeg
Spin up an isolated sandbox and run it server-side — no local setup.
Tetrees AI Review of this version
This TypeScript cli / script completed archive review. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
Pipeline avcp-2026-08-04.1 · SHA-256 0cf6ca153012371f…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
Reviewed Aug 4, 2026
Push this product straight into your AI IDE, web builder or cloud IDE.
Connect Tetrees to a compatible AI IDE, list products you own, and request the verified ZIP without exposing seller upload controls.
No reviews yet.
Sign in to join the discussion
Loading discussion…
Native/system requirements:
PATH (used by peertube-runner for transcoding)pg native bindingspnpm is required to install the monorepo: npm install -g pnpm && pnpm installCopy source into your project: place the entire source/ directory at your repo root or as a subdirectory (e.g., ./peertube-src/).
Install dependencies using pnpm from the source root:
cd source/
pnpm install
Configure TypeScript — extend the base config in your own tsconfig.json:
{
"extends": "./source/tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "./dist"
}
}
Environment variables — copy and edit the production config:
cp source/config/default.yaml source/config/production.yaml
# Set: database host/port/name, redis uri, object storage keys, smtp, etc.
export NODE_ENV=production
export NODE_CONFIG_DIR=source/config
Build the workspace:
cd source/
pnpm run build
Run the server:
cd source/
NODE_ENV=production node dist/server/index.js
Run the remote runner (optional, for offloaded transcoding):
cd source/
node dist/apps/peertube-runner/src/peertube-runner.js
// source/apps/peertube-runner/src/register/register.ts
// re-exported from: apps/peertube-runner/src/register/index.ts
export function register(options: RegisterOptions): Promise<void>
Registers this runner process with a remote PeerTube instance. Call this at startup of a standalone transcoding node, passing the instance URL and runner token. After registration the runner polls for pending jobs.
// source/apps/peertube-runner/src/server/server.ts
// re-exported from: apps/peertube-runner/src/server/index.ts
export class RunnerServer {
static get Instance(): RunnerServer
async run(): Promise<void>
}
Singleton server class that manages the runner's lifecycle: connects to registered PeerTube instances, picks up VOD and live transcoding jobs, and dispatches them to FFmpeg. Use RunnerServer.Instance.run() to start the event loop.
// source/apps/peertube-cli/src/shared/cli.ts
// re-exported from: apps/peertube-cli/src/shared/index.ts
export function getServerCredentials(program: Command): Promise<{ url: string; accessToken: string }>
export function buildCommonVideoOptions(command: Command): Command
export function assignToVar<T>(obj: T, key: keyof T): (val: unknown) => void
Utility functions used by all peertube-cli subcommands. getServerCredentials reads auth state from the local config and resolves a live access token — use it to authenticate any REST call against the PeerTube API inside a Commander action handler.
A deployment that offloads VOD transcoding from the main server to a dedicated machine.
import { RunnerServer } from './source/apps/peertube-runner/src/server/index.js'
import { register } from './source/apps/peertube-runner/src/register/index.js'
async function main() {
// Register with the PeerTube instance (first run only; token stored locally)
await register({
url: 'https://peertube.example.com',
registrationToken: 'ptrrt-xxxxxxxxxxxxxxxx',
runnerName: 'gpu-node-01',
runnerDescription: 'Dedicated GPU transcoding node'
})
// Start the runner server loop
await RunnerServer.Instance.run()
}
main().catch(err => {
console.error('Runner failed to start:', err)
process.exit(1)
})
Building a custom Commander-based script that authenticates against a PeerTube instance using the shared CLI helpers.
import { Command } from '@commander-js/extra-typings'
import {
getServerCredentials,
buildCommonVideoOptions
} from './source/apps/peertube-cli/src/shared/index.js'
const program = new Command()
let cmd = program
.command('list-videos')
.description('List videos on a PeerTube instance')
cmd = buildCommonVideoOptions(cmd)
cmd.action(async () => {
const { url, accessToken } = await getServerCredentials(program)
const res = await fetch(`${url}/api/v1/videos`, {
headers: { Authorization: `Bearer ${accessToken}` }
})
const data = await res.json()
console.log(`Found ${data.total} videos`)
for (const v of data.data) {
console.log(` [${v.id}] ${v.name}`)
}
})
program.parse(process.argv)
Using the exported shutdown helper to de-register the runner from a PeerTube instance before the process exits.
import { RunnerServer } from './source/apps/peertube-runner/src/server/index.js'
async function gracefulShutdown(signal: string) {
console.log(`Received ${signal}, shutting down runner...`)
// RunnerServer handles in-flight job completion and de-registration
await RunnerServer.Instance.run() // idempotent; resolves when queue drains
process.exit(0)
}
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'))
process.on('SIGINT', () => gracefulShutdown('SIGINT'))
.github/ - GitHub Actions workflows for CI testing, Docker builds, CodeQL analysis, and nightly deployments.apps/peertube-cli/ - Standalone CLI for uploading videos, managing plugins, handling auth tokens, and controlling redundancy from the terminal.apps/peertube-cli/src/shared/ - Shared Commander helpers (cli.ts) used across all CLI subcommands; re-exported via index.ts.apps/peertube-runner/ - Remote transcoding runner: connects to PeerTube instances, pulls pending jobs, transcodes with FFmpeg, pushes results back.apps/peertube-runner/src/register/ - Registration and shutdown logic for pairing the runner with a PeerTube instance.apps/peertube-runner/src/server/ - Core runner server class managing job polling and dispatch.apps/peertube-runner/src/server/process/ - Job processors for VOD transcoding, storyboard generation, and shared logging/utilities.apps/peertube-runner/src/shared/ - Runner-internal shared types and helpers.client/ - Angular single-page application; bundled and served as static files by the backend.config/ - YAML configuration files consumed at runtime via node-config.packages/ - Internal scoped packages: peertube-core-utils, peertube-ffmpeg, shared models, type definitions.scripts/ - Helper scripts for database migrations, plugin installation, and build steps.server/ - The Express backend: REST API routes, ActivityPub federation, live streaming, job queues, database models, plugins.support/ - Operations support: Dockerfile, nginx config snippets, systemd unit files, and Docker Compose examples.tsconfig.base.json - Base TypeScript config inherited by all workspace packages.pnpm-workspace.yaml - Declares apps/* and packages/* as pnpm workspace members..js extensions in imports even for .ts source files; if your bundler strips extensions, set moduleResolution: "NodeNext" in tsconfig.json.npm install or yarn at the monorepo root will not resolve workspace symlinks correctly; always use pnpm install.ffmpeg is not on PATH; verify with ffmpeg -version before starting.NODE_CONFIG_DIR not set: Server silently falls back to default.yaml; always export NODE_CONFIG_DIR pointing to your production config directory.registrationToken (from the admin panel) is used once; subsequent runs use the stored runnerToken; do not confuse the two or registration will fail with 403.depends_on with a condition.I have purchased the PeerTube source block. The source is in ./source/ and
the integration guide is in ./USAGE.md.
The upstream package is `user@example.com` (https://github.com/Chocobozzz/PeerTube).
Please help me integrate this into my existing Node.js/TypeScript project.
Specifically I need you to:
1. Read USAGE.md fully before writing any code.
2. Install only the dependencies listed in the "Required dependencies" section
using the exact commands shown.
3. Follow the "Project setup" steps to wire tsconfig paths and environment
variables for my project structure.
4. Import only symbols that are explicitly documented in the "Public API"
section of USAGE.md (do not invent new exports).
5. Implement the following feature in my project: [DESCRIBE YOUR FEATURE HERE]
- e.g., "start a peertube-runner that registers with my instance and
processes VOD jobs automatically"
- e.g., "add a CLI subcommand that lists all videos using getServerCredentials"
6. Show me the complete, runnable TypeScript file(s) with correct import paths
relative to ./source/.
7. Call out any environment variables I must set before running.
Do not hallucinate API surface. If a required export is not listed in USAGE.md,
tell me rather than inventing it.
PeerTube is released under the GNU Affero General Public License v3.0 (AGPL-3.0). See source/LICENSE for the full license text. Any project incorporating this source must also be released under AGPL-3.0 or a compatible license.
Upstream project: https://github.com/Chocobozzz/PeerTube Developed and maintained by Framasoft.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
The full install guide and integration prompts unlock after purchase.
Game Source Code & Interactive Templates
Free