---
name: Implement Node.js Screenshare Bot
status: closed
created: 2025-10-21T13:57:40Z
updated: 2025-10-21T14:26:10Z
github: https://github.com/BuzzTrail/video-extension/issues/165
depends_on: [162]
parallel: false
effort_hours: 20-30
---

# Task: Implement Node.js Screenshare Bot

## Description

Rewrite the Python screenshare bot in Node.js/TypeScript using Playwright for browser automation and LiveKit Node SDK for WebRTC streaming. This eliminates the Python asyncio hang issue and creates a pure Node.js stack.

## Acceptance Criteria

**Core Functionality:**
- [ ] Playwright browser automation (headless Chromium)
- [ ] Screenshot capture at 30fps from slidev deck URL
- [ ] LiveKit screenshare track streaming
- [ ] Supabase Realtime integration for slide control commands
- [ ] Keyboard navigation (ArrowLeft, ArrowRight) via Playwright

**API Integration:**
- [ ] Express endpoint: `POST /api/bots/screenshare/spawn-livekit`
- [ ] Express endpoint: `POST /api/bots/:id/kill`
- [ ] Express endpoint: `GET /api/bots/:id/status`
- [ ] Supabase `active_bots` table integration
- [ ] LiveKit token generation

**Quality:**
- [ ] TypeScript types for all bot interfaces
- [ ] Error handling and logging
- [ ] Graceful shutdown on kill command
- [ ] Memory leak prevention (Playwright cleanup)

**Testing:**
- [ ] Local testing: Bot joins LiveKit room
- [ ] Local testing: Screenshot streaming works
- [ ] Local testing: Slide navigation works via Supabase
- [ ] Railway deployment successful
- [ ] End-to-end test with voice-demo-ui

## Implementation Details

See full task description on GitHub: https://github.com/BuzzTrail/video-extension/issues/165

**Key files to create:**
- `apps/bot-spawner/src/bots/ScreenshareBot.ts`
- `apps/bot-spawner/src/bots/types.ts`
- `apps/bot-spawner/src/bots/BotRegistry.ts`
- `apps/bot-spawner/src/routes/bots.ts`
- `apps/bot-spawner/src/services/livekit.ts`

**Dependencies to add:**
- `@livekit/rtc-node`
- `@playwright/test`
- `livekit-server-sdk`

## Effort Estimate

**Size:** XL (Extra Large)
**Hours:** 20-30 hours

## Success Metrics

- Bot spawns and joins LiveKit room successfully
- Screenshots stream at ~30fps
- Slide navigation works via Supabase
- **Works on Railway without asyncio hang!**
