Web UI + API for browsing AI‑generated summaries (with audio). This service runs on Render (Docker) and reads from a PostgreSQL database.
/– dashboard UI/api/filters– facet counts (sources, categories, channels, languages, etc.)/api/reports– paginated cards with filtering, search and sorting/health– health probe
Full API reference: docs/API.md.
# Required
DATABASE_URL_POSTGRES_NEW=postgres://user:pass@host:5432/dbname
# Required for NAS ingest (private endpoints)
INGEST_TOKEN=shared_ingest_token
# Optional (protect upload endpoints if used)
SYNC_SECRET=shared_secret
# Optional (NAS metrics bridge; enables /api/metrics proxy)
NGROK_BASE_URL=https://<your-ngrok-subdomain>.ngrok-free.app
# Or NGROK_URL can be used equivalently
NGROK_BASIC_USER=optional_basic_user
NGROK_BASIC_PASS=optional_basic_pass
# Optional (UI behaviour)
DASHBOARD_AUTOPLAY_ON_LOAD=1 # set to 0/false to keep audio idle until a user clicks
# Optional locally (Render sets the port)
PORT=10000
pip install -r requirements.txt
python server.py
# open http://localhost:10000
Use Docker runtime with Start Command python server.py and set DATABASE_URL_POSTGRES_NEW.
Step‑by‑step guide: docs/DEPLOY_RENDER.md.
NAS integration guide: docs/NAS_INTEGRATION.md.
- Source, Category and Channel all participate in narrowing results.
- The UI may require at least one selection (e.g., category/source/channel). Clearing those shows an empty state by design.
- Backend filtering is implemented in
modules/postgres_content_index.pyand mirrors the UI chip logic.
YTV2-Dashboard/
├─ server.py # HTTP server (dashboard + API)
├─ modules/
│ ├─ postgres_content_index.py # Postgres queries and mapping
├─ static/
│ ├─ dashboard_v3.js # UI logic
│ └─ dashboard.css # Styles
│
├─ ui_flags.js # Feature flags loaded by the template (authoritative)
├─ docs/
│ ├─ API.md # API reference
│ ├─ DEPLOY_RENDER.md # Render deployment
│ ├─ ARCHITECTURE.md # Backend + UI integration
│ ├─ TROUBLESHOOTING.md # Common fixes
│ └─ SMOKE_TESTS.md # Quick filter tests
└─ archive/ # Old plans and notes
- The backend normalizes a
content_sourceslug per item (e.g.,youtube,reddit) and returns a user‑friendlysource_label. - If you see 500s, check
docs/TROUBLESHOOTING.mdfor placeholder/percent issues and the logging guidance. - To keep the audio player idle until a user clicks, set
DASHBOARD_AUTOPLAY_ON_LOAD=0.
- File:
ui_flags.js(root). This is loaded by the HTML template and is the authoritative source for runtime flags. - Common flags:
cardV4: enable Stream (List) and Mosaic (Grid) card renderers.cardExpandInline: inline expand for card summaries.twRevamp: experimental Tailwind‑first cards (V5) for List/Grid.
- After changing flags, if you don’t see the effect, bump the script cache in
dashboard_v3_template.html(e.g.,ui_flags.js?v=2).
- Structure/HTML:
static/dashboard_v3.js(renderers)- V4:
renderStreamCardV4()andrenderGridCardV4()
- V4:
- Styling:
static/dashboard.css- V4 classes:
.stream-card*and.mosaic-card*
- V4 classes:
- Cache bust:
- CSS: change
dashboard.css?v=...indashboard_v3_template.html - JS: change
dashboard_v3.js?v=...indashboard_v3_template.html
- CSS: change
- Detailed tips: see
docs/CARD_STYLING_GUIDE.md
- Branch
- Create a topic branch from
mainand point Render to it for preview.
- Create a topic branch from
- Turn on features (optional)
- Edit
ui_flags.jsand set flags (e.g.,cardV4: true). If flags don’t apply after deploy, bump the query param in the template (e.g.,ui_flags.js?v=2).
- Edit
- Change cards
- List view: edit
static/dashboard_v3.js→renderStreamCardV4() - Grid view: edit
static/dashboard_v3.js→renderGridCardV4() - Keep structure/HTML in JS; keep visual styles in
static/dashboard.css(.stream-card*,.mosaic-card*).
- List view: edit
- Style
- Add/adjust CSS in
static/dashboard.css. Prefer extending the existing V4 classes rather than inline styles.
- Add/adjust CSS in
- Cache‑bust
- Update
dashboard_v3_template.htmlto bumpdashboard.css?v=...and/ordashboard_v3.js?v=...so browsers pick up changes.
- Update
- Deploy and verify
- Commit + push; wait for Render to deploy.
- Hard‑refresh in the browser. If needed, open DevTools → Network → “Disable cache” and refresh once.
- Sanity checklist
- Filters list and cards render; pagination and sort work.
- List (Stream) and Grid (Mosaic) views switch correctly.
- Play/Pause, progress scrub, and expand/collapse work.
- Keyboard basics:
L(listen),R(read),W(watch) if present; arrow/tab navigation.
- Troubleshooting
- Still seeing old UI? Confirm the
?v=query params changed indashboard_v3_template.htmland the Render deploy completed. - Feature flags not applying? Confirm you edited root
ui_flags.js(notstatic/ui_flags.js).
- Still seeing old UI? Confirm the