Productionβready starter template for building OMSSβcompliant streaming backends. Includes server setup, provider system, linting, and an example provider.
- π Ready in 5 minutes β install, set TMDB key, run
- π¦ @omss/framework β official OMSS implementation
- π Autoβdiscovery β drop provider files into
providers/ - π‘οΈ Type safety & formatting β Prettier + TypeScript
- π Productionβready β Redis cache, Docker support
- π Example provider β fully commented reference implementation
- π Hot reload β
npm run devfor development
# Clone & install git clone https://github.com/omss-spec/template.git my-streaming-backend cd my-streaming-backend npm install # Copy env template cp .env.example .env # !Add your TMDB API key! # Run dev server (auto-reload) npm run dev
β Server running at http://localhost:3000
Great! You can now add your providers!
template/
βββ src/
β βββ server.ts # Main server entrypoint
β βββ providers/ # Auto-discovered providers
β β βββ example.ts # Reference provider
βββ .env.example # Environment template
βββ .prettierrc # Prettier config
βββ tsconfig.json # TypeScript config
βββ package.json # Dependencies + scripts
npm run dev # Dev server with hot reload (tsx watch) npm run main # Run server (production mode)
1. Create a provider (extends BaseProvider):
// src/providers/my-site.ts import { BaseProvider } from "@omss/framework"; export class MySiteProvider extends BaseProvider { readonly id = "my-site"; readonly name = "My Site"; readonly BASE_URL = "https://my-site.com"; readonly capabilities = { supportedContentTypes: ["movies", "tv"] }; // Implement getMovieSources() & getTVSources() }
2. Autoβdiscovered β restart server or use npm run dev (watches for changes)
3. Register manually (in server.ts):
server.getRegistry().register(new MySiteProvider());
Copy .env.example β .env and set:
# Required TMDB_API_KEY=your_tmdb_api_key_here # Optional PORT=3000 HOST=localhost NODE_ENV=development PUBLIC_URL=http://localhost:3000 # Redis (for production) REDIS_HOST=localhost REDIS_PORT=6379 REDIS_PASSWORD=
Includes Redis cache for optimal performance
# 1. Create .env file cp .env.example .env # Edit .env and add your TMDB_API_KEY # 2. Start services (backend + Redis) docker-compose up -d # 3. View logs docker-compose logs -f omss-backend # Server running at http://localhost:3000
# 1. Build the image docker build -t omss-backend:latest . # 2. Run container docker run -p 3000:3000 \ -e TMDB_API_KEY=your_tmdb_api_key_here \ -e CACHE_TYPE=memory \ omss-backend:latest # Server running at http://localhost:3000
Customize the build with --build-arg:
docker build \
--build-arg NODE_ENV=production \
--build-arg PORT=8080 \
--build-arg CACHE_TYPE=memory \
-t omss-backend:latest .All .env variables can be overridden at runtime:
docker run -p 3000:3000 \ -e TMDB_API_KEY=your_key \ -e TMDB_CACHE_TTL=86400 \ -e CACHE_TYPE=redis \ -e REDIS_HOST=redis.example.com \ -e REDIS_PORT=6379 \ -e REDIS_PASSWORD=your_password \ -e PORT=3000 \ -e HOST=0.0.0.0 \ -e PUBLIC_URL=https://api.yourdomain.com \ omss-backend:latest
The docker-compose.yml includes:
- omss-backend: Your OMSS streaming backend
- redis: Redis cache (persistent storage)
# Change exposed port ports: - "8080:3000" # Access on port 8080 # Add Redis password redis: command: redis-server --requirepass yourpassword # Then update backend environment environment: - REDIS_PASSWORD=yourpassword
-
Use Redis cache for better performance:
environment: - CACHE_TYPE=redis - REDIS_HOST=redis
-
Set PUBLIC_URL if behind reverse proxy:
environment: - PUBLIC_URL=https://api.yourdomain.com
-
Persistent data is stored in Docker volume
redis-data -
Health checks: Access
http://localhost:3000/to verify
Port already in use:
# Change port in docker-compose.yml ports: - "3001:3000"
Providers not loading:
Ensure your src/server.ts uses the correct path:
registry.discoverProviders( process.env.NODE_ENV === "production" ? "./dist/providers" : "./src/providers", );
# 1. Install npm install # 3. Add providers to src/providers/ # 2. Dev server (auto-reload + type checking) npm run dev # 4. Format code npm run format # 5. Build for prod npm run build npm run start
- OMSS Framework:
@omss/frameworkon npm github - OMSS Spec: github.com/omss-spec/omss-spec
- Example Provider:
src/providers/example.tsβ fully commented - Server Examples:
src/server.tsβ multiple configs
See src/providers/example.ts for a complete provider implementation with error handling, logging, proxying, and type safety.
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
MIT Β© OMSS Foundation
β Star this repo | [Click on 'Use this template' & customize] | OMSS Spec