• Townie
    AI
  • Blog
  • Docs
  • Pricing
Log inSign up
yisding

yisding

hello-realtime-video

Remix of jubertioai/hello-realtime
Public
Like
3
hello-realtime-video
Home
Code
9
.claude
1
frontend
1
routes
3
.gitignore
.vtignore
CLAUDE.md
README.md
deno.json
H
main.tsx
Branches
1
Pull requests
Remixes
3
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
CLAUDE.md
Code
/
CLAUDE.md
Search
8/29/2025
Viewing readonly version of main branch: v47
View latest version
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

This is an OpenAI Realtime API application built with Deno and Val Town that supports WebRTC video/audio communication. The app is deployed at https://hello-realtime-video.val.run.

Tech Stack

  • Runtime: Deno (with Val Town platform)
  • Framework: Hono (web framework)
  • API: OpenAI Realtime API with WebRTC
  • Frontend: Vanilla HTML/CSS/JavaScript

Project Structure

ā”œā”€ā”€ frontend/
│   └── index.html          # Main UI with WebRTC client implementation
ā”œā”€ā”€ routes/
│   ā”œā”€ā”€ rtc.ts             # WebRTC call management endpoint
│   ā”œā”€ā”€ observer.ts        # WebSocket observer for call monitoring
│   └── utils.ts           # Shared utilities and OpenAI configuration
ā”œā”€ā”€ main.tsx               # Main Hono app entry point
ā”œā”€ā”€ deno.json             # Deno configuration
└── README.md

Environment Setup

Required environment variable:

  • OPENAI_API_KEY - OpenAI API key from platform.openai.com

Development Commands

Running the Application

# Run with Deno (requires network and env permissions) deno run --allow-net --allow-env main.tsx

Linting

# Lint all TypeScript/JavaScript files deno lint

Type Checking

# Type check without running deno check main.tsx

Architecture

API Endpoints

  • GET / - Serves the main HTML frontend
  • POST /rtc - Creates a new WebRTC call with OpenAI
    • Query param: ?video=true enables video support
  • POST /observer/:callId - Starts WebSocket observer for a call

Key Components

  1. main.tsx: Hono application router that serves the frontend and routes API calls
  2. routes/rtc.ts: Handles WebRTC call creation via OpenAI's /v1/realtime/calls endpoint
  3. routes/observer.ts: WebSocket connection for monitoring call status
  4. routes/utils.ts: Configuration for OpenAI API (model, voice, instructions)
  5. frontend/index.html: Complete WebRTC client implementation with video/audio UI

OpenAI Configuration (routes/utils.ts)

  • Model: gpt-realtime
  • Voice: marin
  • Audio: Near-field noise reduction
  • Video: Optional, enabled via query parameter

Val Town Platform Specifics

This project uses Val Town utilities for file serving:

import { readFile } from "https://esm.town/v/std/utils@85-main/index.ts";

The application is deployed as a Val Town HTTP trigger with the entry point:

export default app.fetch;

Important Notes

  • The app requires a valid OpenAI API key with access to the Realtime API
  • WebRTC connections are established directly with OpenAI's servers
  • The observer pattern allows monitoring of active calls
  • Frontend handles all WebRTC negotiation and media streaming
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
Ā© 2025 Val Town, Inc.