Background
A subathon is a live stream where the timer grows with audience support. The format is popular, and it was the idea behind a charity-style live event (IMPACTHON) I wanted to run overlays for. Existing subathon tools are mostly built for Twitch, locked behind accounts or subscriptions, or hosted on someone else's server. For YouTube, options are thin, and non-technical streamers usually end up editing a timer by hand.
Problem
- Manual timers: Time is added by hand after each member or gift, so it is slow and easy to get wrong during a busy stream.
- Platform lock-in: Most tools target Twitch, not YouTube memberships and Super Chat.
- Accounts and subscriptions: Hosted tools need sign-up, OAuth, or a paid plan just to show a countdown.
- API friction: The YouTube Data API needs a Google Cloud project, OAuth credentials, and has a daily quota, which is heavy for a first-time streamer.
- No feedback loop: Viewers cannot see goals, progress, or what their support just did.
Solution
- Automatic timer: New members, gift memberships, and optional Super Chat add time by configurable rules (for example, 1 membership = 3 minutes). A gift of ×5 counts as 5.
- Two ways to read live events: Paste a live URL and go (no API key), or use the official YouTube Data API v3 with OAuth.
- Goals that act: Goals carry time bonuses, tick automatically, and can switch the OBS scene when reached.
- Six OBS overlays: Timer, milestone, goal list, alerts (with sound), ticker, and live chat, each added as a Browser Source by URL.
- Local and controlled: Runs on 127.0.0.1, protected by an admin token, with a maximum timer cap, per-event undo, and backup.
- Easy install: A Windows installer that needs no Administrator rights, plus a portable zip.
My Role
- Product and design: Defined the feature set, wrote the copy, and designed the brand, mascot, admin UI, overlays, landing page, and poster in Figma.
- Backend: Built the engine, REST API, WebSocket updates, SQLite storage, and the OBS and YouTube event sources.
- Frontend: Built the admin page and overlays in plain HTML, CSS, and JavaScript.
- Release: Set up PyInstaller and Inno Setup builds, CI with GitHub Actions, and the landing page on GitHub Pages.
Architecture
DuckLive is a single local process with a pure logic core and replaceable I/O around it.
- Engine (app/engine.py): Timer, goals, events, undo, and settings. It does no network I/O, which keeps it easy to test.
- Server (app/main.py): FastAPI app that serves pages, the REST API, and WebSocket streams, and starts the application.
- Storage (app/db.py): SQLite for events, goals, and settings.
- OBS client (app/obs.py): OBS WebSocket v5 client used to switch scenes.
- Event sources (app/sources/): base (auto-reconnect), scrape and ytchat (live chat without API), and api (YouTube Data API).
- Web (web/): admin.html, six overlay_*.html pages, and static assets (CSS, JS, Poppins font, logo, mascot).
YouTube live ──► sources (scrape / API) ──► engine ──► SQLite
│
WebSocket ▼
Admin page OBS overlays (read-only)
│
▼
OBS scene switch
The server listens only on 127.0.0.1. Actions that change data require an admin token, while overlays are read-only.
Technical Challenges
- Reading live events without an API key: Parsing live chat from a pasted URL avoids API setup, but it is unofficial and can break when YouTube changes. I isolated it behind a common source interface with auto-reconnect, and kept the official API as a stable alternative. The README states the Terms of Service risk plainly.
- Keeping the engine deterministic: Timer and goal logic mixes time, events, and user corrections (manual add or remove, temporary multiplier, total fix, undo). Keeping the engine free of I/O made these rules testable with plain unit tests.
- Reconnects and duplicate events: Live sources drop and resume. The base source handles reconnects, and events are recorded so a resumed stream does not double count.
- Local security: Even a local server is exposed to the browser. It accepts only 127.0.0.1 and localhost Host headers to prevent DNS rebinding, requires a token for writes, renders chat as plain text, and neutralizes spreadsheet formulas in CSV exports. LAN mode is opt-in and documented as unencrypted.
- Shipping to non-technical users: Streamers should not need Python. PyInstaller bundles the app, Inno Setup builds an installer that runs without Administrator rights, and CI produces the artifacts.
Features
- Auto timer: Members, gifts, and optional Super Chat add time by rule.
- Goals: Time bonuses, automatic check-off, and automatic OBS scene switching.
- Six overlays: Timer, milestone, goals, alerts with sound, ticker (latest members and top gifters), and live chat.
- Overlay customization: Live preview with theme, colors, font, size, corners, and alignment.
- Manual control: Start or pause, add or remove time, temporary multiplier, total correction, and undo per event.
- Mascot reactions: The duck changes expression with timer state (normal, happy, sleepy, celebrate).
- Admin and data: Light and dark admin mode, CSV export of history, backup.
- Windows-friendly: Installer without Administrator rights, or portable zip.
Design
The brand is flat, warm, and built on thick outlines, so overlays stay readable on top of any stream.
- Colors: ink #1C1A17, paper #FFFBF2, orange #F4A93C, green #4E9B70, plus soft tints and a red for alerts.
- Type: Poppins. ExtraBold for headings, SemiBold for labels, Regular for body text.
- Mascot: A front-facing duck with four expressions that map to app states.
- Deliverables in Figma: Brand board, admin UI, OBS overlays, landing page, and posters (A4 and 16:10).
Tech Stack
Backend
- Python 3.10+, FastAPI, SQLite
- websockets (OBS WebSocket v5 client), chat-downloader
- YouTube Data API v3 (OAuth, youtube.readonly)
Frontend
- Plain HTML, CSS, and JavaScript, with no framework or build step
- Poppins font
Build and quality
- PyInstaller, Inno Setup
- pytest, ruff, Prettier
- GitHub Actions (CI), GitHub Pages (landing page)
Testing
- Automated: Engine, API, authentication, WebSocket, chat parser, auto-reconnect, OBS client (against a mock server), and data migration.
- Manual: PyInstaller build, admin and overlays in Chromium, live chat from a real YouTube live, and a connection to a real OBS 33.
- Not yet verified: Inno Setup compilation (runs in CI), real membership events, Google login for API mode, and scene switching on a real OBS with the built-in client.
Results
- Zero-setup live mode: Paste a live URL, and members and gifts start moving the timer without an API key or account.
- Complete streamer workflow: Timer, goals, alerts, ticker, and chat overlays, all driven from one local admin page.
- Distributable app: A Windows installer and portable build produced by CI, with an MIT license and a public landing page.
Lessons Learned
- Keep the core pure: An engine without I/O made a complex rule set (multipliers, corrections, undo) simple to test and trust.
- Offer an official path next to the shortcut: The no-API mode is convenient but fragile, so the official API stays as the stable option, and the trade-off is documented.
- Security still matters locally: Host checks, tokens, and safe CSV and chat rendering are cheap to add early and hard to retrofit.
- Be honest about what is untested: Listing unverified paths in the README sets accurate expectations and shows what to test next.
Future Improvements
- Real-world testing of membership events and API-mode login
- macOS and Linux builds
- Per-event sound and animation packs for alerts
- Preset goal templates for common subathon formats
- Encrypted storage for the OBS password
- Overlay theme sharing
More projects
- ClassLab: Campus room booking system (Go, PostgreSQL, React)
- fluxgo: Adaptive circuit breaker for Go microservices
- Gatewise: RFID gate system on ESP32
DuckLive is not affiliated with YouTube, Google, or the OBS Project.