Skip to content
/ template Public template

πŸš€ Ready-to-use template for building OMSS-compliant backends with @omss/framework

License

Notifications You must be signed in to change notification settings

omss-spec/template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Your OMSS Compliant Streaming Backend Template πŸš€

Production‑ready starter template for building OMSS‑compliant streaming backends. Includes server setup, provider system, linting, and an example provider.

Features βœ…

  • πŸš€ 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 dev for development

Quick Start ⏱️

# 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!

πŸ“ Structure

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
└── docker-compose.yml      # Redis + dev setup

πŸ› οΈ Scripts

npm run dev      # Dev server with hot reload (tsx watch)

πŸ”Œ Adding Providers

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());

βš™οΈ Environment

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=

πŸš€ Production Deployment

Docker Compose (dev/prod)

# Start Redis + server
docker-compose up -d

# Or just Redis
docker-compose up redis -d
npm run start

Docker (single container)

FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY dist/ ./
EXPOSE 3000
CMD ["node", "server.js"]

πŸ”§ Development Workflow

# 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

πŸ“š Reference

See src/providers/example.ts for a complete provider implementation with error handling, logging, proxying, and type safety.


🀝 Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.


πŸ“„ License

MIT Β© OMSS Foundation


⭐ Star this repo | [Click on 'Use this template' & customize] | OMSS Spec