Build a Family TV Home Screen
Build a local TV home screen with live phone-to-TV drawing.
Introduction
30 Second Summary
A shared television sits at the center of family time, yet its home screen rarely feels personal. Drawing together on separate devices can feel just as disconnected.
In this project, you will guide Claude Code through building a local family home screen that runs in a browser on your trusted home Wi-Fi. Your phone becomes a drawing surface whose strokes appear live on the television and return after a restart.
What You'll Build
A picture drawn on your phone appears live on the television as your family watches.
By the end of this project, you'll have:
- A TV-style launcher you can navigate from across the room while its live clock and streaming tiles stay easy to read.
- A live family drawing board that carries black, red, or blue strokes from your phone to the television through WebSockets.
- A drawing that survives browser refreshes. It also returns after a complete local server restart from drawing.json.
- Secret Mission: Add a full-screen presentation mode with a mouse cursor that hides after three idle seconds.
Are there any prerequisites?
You need a Mac or Windows computer, a phone, a TV or second screen with a browser, and one trusted home Wi-Fi network. No prior coding experience is required because the setup starts with Claude Code and Node.js from scratch.
Claude Code also needs eligible account access, which the setup step explains.
Before We Start
A shared home screen works best when it starts with the people who will use it. This step helps you commit to the family experience you want to create before any hands-on work begins.
Set Up Claude Code and Node.js
Starting from scratch feels manageable when every required tool is installed before the first build prompt. A reliable setup keeps missing commands from interrupting your progress later.
In this step, you will prepare Claude Code as your editing assistant. You will also install Node.js as the local runtime for your family TV home screen.
In this step, get ready to:
- Prepare Claude Code for editing the project.
- Install the required Node.js version with its bundled npm CLI.
- Create the empty project folder on a computer connected to your trusted home network.
Install Claude Code and sign in
Claude Code runs inside your terminal. It uses your prompts to inspect files and propose changes within the current folder.
Choose Your Claude Access
Claude Code works with Claude Pro, Max, Ultra, Team, Enterprise, or Console accounts. The free Claude plan does not include Claude Code.
A Claude Pro subscription costs $20 if billed monthly before applicable tax. This subscription can keep billing after the project until you manage it separately.
- Use an eligible Claude account that you already have.
- Subscribe to one month of Claude Pro if you do not have eligible access.
macOS
- Press Cmd + Space to open Spotlight.
- Type Terminal into the search field.
- Press Enter to open Terminal.
You should see a Terminal window with a command prompt waiting for input.
Windows
- Press Win + X to open the system menu.
- Select Windows PowerShell or Terminal.
- Confirm that the prompt begins with PS.
You should see a PowerShell prompt waiting for input.
- Check whether Claude Code is already installed by running this command:
claude --version
What Does This Check Do?
The command asks Claude Code to print its installed version. The result tells you whether the required release is ready or whether installation is needed.
✔️ I see the required Claude Code version
Your output contains v2.1.322. Claude Code is ready for sign-in.
ⓧ I see an older version
Your installed release needs updating before you continue. The native installer updates Claude Code to the current release.
macOS
- Update Claude Code by running the official macOS installation command:
curl -fsSL https://claude.ai/install.sh | bash
What Does This Command Do?
This command downloads the native Claude Code installer from Anthropic. The installer updates the terminal command on your Mac.
- Close the Terminal window after the installation finishes.
- Press Cmd + Space to open Spotlight.
- Type Terminal into the search field.
- Press Enter to open a new Terminal window.
- Confirm the updated version by running this command:
claude --version
What Should I See?
The output should contain v2.1.322. This confirms that the update is available in the new Terminal session.
Windows
- Update Claude Code by running the official Windows PowerShell installation command:
irm https://claude.ai/install.ps1 | iex
What Does This Command Do?
This command downloads the native Claude Code installer from Anthropic. The installer updates the PowerShell command on your Windows computer.
- Close the PowerShell or Windows Terminal window after the installation finishes.
- Press Win + X to open the system menu.
- Select Windows PowerShell or Terminal.
- Confirm the updated version by running this command:
claude --version
What Should I See?
The output should contain v2.1.322. This confirms that the update is available in the new PowerShell session.
ⓧ Command not found
Claude Code is not installed yet. Use the native installer for your operating system.
macOS
Claude Code requires macOS 13.0+. The download may pause briefly while the installer retrieves its files.
- Install Claude Code by running the official macOS installation command:
curl -fsSL https://claude.ai/install.sh | bash
What Does This Command Do?
This command downloads the native Claude Code installer from Anthropic. The installer adds the Claude Code command to your Mac.
- Close the Terminal window after the installation finishes.
- Press Cmd + Space to open Spotlight.
- Type Terminal into the search field.
- Press Enter to open a new Terminal window.
- Verify the installation by running this command:
claude --version
What Should I See?
The output should contain v2.1.322. This confirms that Claude Code is available in the new Terminal session.
Windows
Claude Code requires Windows 10 1809+ or Windows Server 2019+. The download may pause briefly while the installer retrieves its files.
- Install Claude Code by running the official Windows PowerShell installation command:
irm https://claude.ai/install.ps1 | iex
What Does This Command Do?
This command downloads the native Claude Code installer from Anthropic. The installer adds the Claude Code command to PowerShell.
- Close the PowerShell or Windows Terminal window after the installation finishes.
- Press Win + X to open the system menu.
- Select Windows PowerShell or Terminal.
- Verify the installation by running this command:
claude --version
What Should I See?
The output should contain v2.1.322. This confirms that Claude Code is available in the new PowerShell session.
- Start Claude Code by running this command:
claude
What Does This Command Do?
The command starts an interactive Claude Code session in the terminal's current folder. It opens the browser sign-in flow when authentication is required.
- Complete the browser sign-in flow with your eligible Claude account.
- Return to the terminal after sign-in succeeds.
- Confirm that the Claude Code welcome prompt is visible.
- Press Ctrl + C to return to the terminal prompt.
Claude Code Still Not Starting?
Confirm that you opened a new terminal window after installation. Check that your operating system meets the supported version requirement.
If the browser sign-in does not complete, confirm that you selected an eligible account. Help me troubleshoot my Claude Code installation or sign-in flow.
Install Node.js and verify npm
Node.js runs the local server you will build in the next step. Its installer also includes the npm command used to install JavaScript packages.
- Check the installed Node.js version by running this command:
node --version
What Does This Check Do?
The command prints the Node.js version available in your current terminal. This project uses v26.13.1 LTS.
✔️ I see the required Node.js version
Your output is v26.13.1. Node.js is ready for this project.
ⓧ I see an older version
Your existing Node.js version needs updating. Install the required LTS release for your operating system.
macOS
- Visit the Node.js download page.
- Select Node.js 26.13.1 LTS.
- Choose the macOS Installer package.
- Open the downloaded .pkg file.
- Complete the installer with its default choices.
- Close the Terminal window after the installer finishes.
- Press Cmd + Space to open Spotlight.
- Type Terminal into the search field.
- Press Enter to open a new Terminal window.
- Verify the updated Node.js version by running this command:
node --version
What Should I See?
The new Terminal session should print v26.13.1. This confirms that the installer updated the runtime used by your terminal.
Windows
- Visit the Node.js download page.
- Select Node.js 26.13.1 LTS.
- Choose the Windows Installer option.
- Choose x64 for a typical Intel or AMD computer.
- Choose ARM64 for a Windows-on-ARM computer.
- Open the downloaded .msi file.
- Complete the installer with its default choices.
- Close the PowerShell or Windows Terminal window after the installer finishes.
- Press Win + X to open the system menu.
- Select Windows PowerShell or Terminal.
- Verify the updated Node.js version by running this command:
node --version
What Should I See?
The new PowerShell session should print v26.13.1. This confirms that the installer updated the runtime used by your terminal.
ⓧ Command not found
Node.js is not installed yet. Install the required LTS release for your operating system.
macOS
- Visit the Node.js download page.
- Select Node.js 26.13.1 LTS.
- Choose the macOS Installer package.
- Open the downloaded .pkg file.
- Complete the installer with its default choices.
- Close the Terminal window after the installer finishes.
- Press Cmd + Space to open Spotlight.
- Type Terminal into the search field.
- Press Enter to open a new Terminal window.
- Verify the Node.js installation by running this command:
node --version
What Should I See?
The new Terminal session should print v26.13.1. This confirms that Node.js is available.
Windows
- Visit the Node.js download page.
- Select Node.js 26.13.1 LTS.
- Choose the Windows Installer option.
- Choose x64 for a typical Intel or AMD computer.
- Choose ARM64 for a Windows-on-ARM computer.
- Open the downloaded .msi file.
- Complete the installer with its default choices.
- Close the PowerShell or Windows Terminal window after the installer finishes.
- Press Win + X to open the system menu.
- Select Windows PowerShell or Terminal.
- Verify the Node.js installation by running this command:
node --version
What Should I See?
The new PowerShell session should print v26.13.1. This confirms that Node.js is available.
- Verify the bundled npm CLI by running this command:
npm --version
What Does This Check Do?
The command asks npm to print its version. Any version number confirms that the bundled package manager is available.
Node.js or npm Still Missing?
Confirm that you closed the terminal window used before installation. A new terminal session reloads the commands added by the installer.
If only npm is missing, run the Node.js installer again with its default choices. Help me troubleshoot my Node.js or npm installation.
Create the workspace and check your devices
The phone and TV need to reach the computer running your future local server. A shared trusted Wi-Fi network gives those devices a private path to the app.
- Open the Wi-Fi menu on your computer.
- Record the displayed home network name: your trusted home Wi-Fi name.
- Open the Wi-Fi menu on your phone.
- Confirm that the phone shows the same home network name.
- Open the network settings on your TV or second screen.
- Confirm that the TV or second screen shows the same home network name.
- Disconnect any device that is using guest or public Wi-Fi.
Keep the Project on Your Home Network
This beginner app has no authentication. Anyone on the same local network who knows its address can reach it while the server is running.
Use only a trusted home network. Never expose the app through router port forwarding.
- Press Cmd + Space on macOS or the Windows key on Windows to open system search.
- Type Safari on macOS or Microsoft Edge on Windows.
- Press Enter to open the browser.
- Confirm that an empty browser window is ready for the first local preview.
- Return to the terminal from earlier.
- Move to your Desktop by running this command:
cd ~/Desktop
What Does This Command Do?
The command changes the terminal's current location to your Desktop. This keeps the project folder easy to find.
- Create the family-tv-home folder by running these commands:
mkdir family-tv-home
cd family-tv-home
What Do These Commands Do?
- The first command creates the empty family-tv-home folder on your Desktop.
- The second command makes that folder the terminal's current location.
Before you run the final check, do you expect all three commands to respond successfully from inside the empty project folder?
- Run the version checks before starting Claude Code in family-tv-home with these commands:
claude --version
node --version
npm --version
claude
What Should I See?
- The Claude Code check prints a version containing v2.1.322.
- The Node.js check prints v26.13.1.
- The npm check prints a version number.
- The final command displays the Claude Code welcome prompt inside the empty family-tv-home folder.
Your setup is complete. Claude Code is now open in the exact folder where your family TV home screen will take shape.
Your tools and devices are ready. Next up, you will give Claude Code its first focused build prompt and open your TV-style home screen in the browser.
Build the TV Home Screen
Your project folder is ready. Your family still has nothing to see on the screen.
Now you will guide Claude Code to build a local TV launcher with a live clock. This visible first milestone gives you something useful before real-time networking adds complexity.
In this step, get ready to:
- Guide Claude Code to create the initial Node.js application files.
- Start the local server on port 3000.
- Verify the live clock plus keyboard navigation in your browser.
Ask Claude Code to build the launcher
A focused prompt gives Claude Code clear boundaries for this milestone. It requests a dependency-free launcher without pulling future drawing features into this step.
- Build the first milestone by pasting this prompt into Claude Code:
Build the first milestone of a beginner project in this empty folder. Create a dependency-free Node.js 26.13.1 app with package.json, server.js, public/index.html, public/styles.css, and public/app.js. Use ES modules. The Node server must serve only those three public files, listen on port 3000 for local-network access, and print both localhost and non-internal IPv4 URLs. The page must be a dark, high-contrast 16:9-friendly TV home screen with a live clock at the top left and four large tiles: Netflix linking to https://www.netflix.com/, Disney+ linking to https://www.disneyplus.com/, Prime Video linking to https://www.primevideo.com/, and a Drawing Board button that can be visually present but does not work yet. Add a strong visible focus ring and arrow-key navigation between the four tiles. Enter should activate the focused link or button. Do not add a canvas, WebSocket, database, framework, or external assets yet. Add a start script that runs node server.js. Explain the files you create, then create them. Afterward, run a syntax check on server.js and tell me the exact command to start the app.
What does this prompt create?
- The prompt limits the server to three browser files inside public.
- The package.json file defines the project as an ES module application.
- The server.js file serves the launcher on port 3000.
- The three files inside public create the page structure, visual design, live clock, and keyboard navigation.
- The prompt keeps the Drawing Board as a visible placeholder for the next milestone.
- Submit the prompt in Claude Code.
- Review the proposed files when Claude Code pauses for approval.
- Confirm that the proposal contains package.json, server.js, public/index.html, public/styles.css, and public/app.js.
- Approve the proposed file changes.
- Approve the syntax-check command.
That first build is in place. Claude Code has created the launcher files and checked the server syntax.
Claude Code stopped before creating files?
- Confirm Claude Code is still running inside the family-tv-home folder.
- Approve any pending file edit before waiting for the next response.
- Paste the milestone prompt again if the previous response was interrupted before any files were created.
Help me understand why Claude Code did not create the launcher files.
✔️ Awesome, I've got everything!
The five generated files now match the first launcher milestone.
ⓧ I'd like to double check the full code
{
"name": "family-tv-home",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"start": "node server.js"
}
}
import http from 'node:http';
import fs from 'node:fs/promises';
import path from 'node:path';
import os from 'node:os';
const PORT = 3000;
const HOST = '0.0.0.0';
const ROOT = process.cwd();
const PUBLIC_DIR = path.join(ROOT, 'public');
const routes = {
'/': ['index.html', 'text/html; charset=utf-8'],
'/index.html': ['index.html', 'text/html; charset=utf-8'],
'/styles.css': ['styles.css', 'text/css; charset=utf-8'],
'/app.js': ['app.js', 'text/javascript; charset=utf-8']
};
const server = http.createServer(async (request, response) => {
const pathname = request.url?.split('?')[0] ?? '/';
const route = routes[pathname];
if (!route) {
response.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
response.end('Not found');
return;
}
const [fileName, contentType] = route;
try {
const file = await fs.readFile(path.join(PUBLIC_DIR, fileName));
response.writeHead(200, {
'Content-Type': contentType,
'Cache-Control': 'no-store'
});
response.end(file);
} catch (error) {
console.error(`Could not serve ${fileName}:`, error.message);
response.writeHead(500, { 'Content-Type': 'text/plain; charset=utf-8' });
response.end('Server error');
}
});
function localAddresses() {
const addresses = [];
for (const details of Object.values(os.networkInterfaces())) {
for (const detail of details ?? []) {
if (detail.family === 'IPv4' && !detail.internal) {
addresses.push(detail.address);
}
}
}
return [...new Set(addresses)];
}
server.listen(PORT, HOST, () => {
console.log(`Computer: http://localhost:${PORT}`);
for (const address of localAddresses()) {
console.log(`Phone or TV: http://${address}:${PORT}`);
}
console.log('Keep this terminal open. Press Ctrl + C to stop.');
});
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Family TV Home</title>
<link rel="stylesheet" href="/styles.css">
<script src="/app.js" defer></script>
</head>
<body>
<main class="app-shell">
<section id="home-screen" class="screen" aria-labelledby="home-title">
<header class="home-header">
<div>
<p class="eyebrow">Family TV</p>
<h1 id="clock">--:--</h1>
<p id="date" class="date-line"></p>
</div>
</header>
<h2 id="home-title" class="visually-hidden">Choose an app</h2>
<div class="launcher-grid" aria-label="Family TV apps">
<a class="tile launcher-item netflix" href="https://www.netflix.com/">
<span class="tile-mark">N</span>
<span>Netflix</span>
</a>
<a class="tile launcher-item disney" href="https://www.disneyplus.com/">
<span class="tile-mark">D+</span>
<span>Disney+</span>
</a>
<a class="tile launcher-item prime" href="https://www.primevideo.com/">
<span class="tile-mark">P</span>
<span>Prime Video</span>
</a>
<button id="open-board" class="tile launcher-item drawing" type="button">
<span class="tile-mark">Draw</span>
<span>Drawing Board</span>
</button>
</div>
<p class="remote-hint">Use arrow keys to move and Enter to select.</p>
</section>
</main>
</body>
</html>
:root {
color-scheme: dark;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: #05070d;
color: #f8fafc;
}
* {
box-sizing: border-box;
}
html,
body {
min-height: 100%;
margin: 0;
}
body {
min-height: 100vh;
background:
radial-gradient(circle at 15% 10%, rgba(37, 99, 235, 0.22), transparent 35%),
linear-gradient(145deg, #070b14, #020308 75%);
}
button,
a {
font: inherit;
}
button {
color: inherit;
}
.app-shell {
min-height: 100vh;
}
.screen {
min-height: 100vh;
padding: clamp(1.25rem, 4vw, 4rem);
}
.home-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 2rem;
}
.eyebrow {
margin: 0 0 0.35rem;
color: #93c5fd;
font-size: clamp(0.78rem, 1.4vw, 1.05rem);
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
#clock {
margin: 0;
font-size: clamp(3rem, 8vw, 7rem);
line-height: 0.95;
}
.date-line {
margin: 0.65rem 0 0;
color: #cbd5e1;
font-size: clamp(1rem, 2vw, 1.5rem);
}
.launcher-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: clamp(0.75rem, 2vw, 1.5rem);
margin-top: clamp(2rem, 6vh, 5rem);
}
.tile {
display: flex;
min-height: clamp(9rem, 24vh, 15rem);
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
padding: clamp(1rem, 2.5vw, 2rem);
overflow: hidden;
border: 2px solid transparent;
border-radius: 1.5rem;
box-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.28);
color: white;
cursor: pointer;
font-size: clamp(1.1rem, 2vw, 1.55rem);
font-weight: 800;
text-align: left;
text-decoration: none;
transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.tile:focus-visible {
outline: 0.3rem solid #f8fafc;
outline-offset: 0.3rem;
}
.tile:focus-visible {
transform: translateY(-0.35rem) scale(1.025);
border-color: #f8fafc;
box-shadow: 0 0 0 0.35rem #2563eb, 0 1.5rem 3rem rgba(0, 0, 0, 0.4);
}
.tile-mark {
font-size: clamp(2rem, 5vw, 4rem);
line-height: 1;
}
.netflix {
background: linear-gradient(145deg, #e50914, #5b0509);
}
.disney {
background: linear-gradient(145deg, #173c9b, #081a4b);
}
.prime {
background: linear-gradient(145deg, #00a8e1, #0b4f7a);
}
.drawing {
background: linear-gradient(145deg, #7c3aed, #312e81);
}
.remote-hint {
color: #94a3b8;
font-size: 0.95rem;
text-align: center;
}
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
@media (max-width: 899px) {
.launcher-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 599px) {
.screen {
padding: 1rem;
}
.home-header {
gap: 1rem;
}
.launcher-grid {
grid-template-columns: 1fr;
margin-top: 2rem;
}
.tile {
min-height: 7rem;
}
.tile-mark {
font-size: 2rem;
}
}
const clock = document.querySelector('#clock');
const dateLine = document.querySelector('#date');
const launcherItems = [...document.querySelectorAll('.launcher-item')];
function updateClock() {
const now = new Date();
clock.textContent = now.toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit'
});
dateLine.textContent = now.toLocaleDateString([], {
weekday: 'long',
month: 'long',
day: 'numeric'
});
}
updateClock();
setInterval(updateClock, 1000);
function columnCount() {
if (window.innerWidth >= 900) return 4;
if (window.innerWidth >= 600) return 2;
return 1;
}
function moveLauncherFocus(key) {
const currentIndex = Math.max(0, launcherItems.indexOf(document.activeElement));
const columns = columnCount();
let nextIndex = currentIndex;
if (key === 'ArrowRight') nextIndex = Math.min(launcherItems.length - 1, currentIndex + 1);
if (key === 'ArrowLeft') nextIndex = Math.max(0, currentIndex - 1);
if (key === 'ArrowDown') nextIndex = Math.min(launcherItems.length - 1, currentIndex + columns);
if (key === 'ArrowUp') nextIndex = Math.max(0, currentIndex - columns);
launcherItems[nextIndex].focus();
}
window.addEventListener('keydown', (event) => {
if (!event.key.startsWith('Arrow')) return;
event.preventDefault();
moveLauncherFocus(event.key);
});
launcherItems[0].focus();
Start the local server
A local HTTP server gives your browser access to the generated files. The process stays active so the launcher remains available while you test it.
- Ask Claude Code to start the app with the exact command it reported.
- Approve the command when Claude Code requests permission.
- Keep the server process running during the browser test.
Your local server is live. The terminal prints Computer: http://localhost:3000 plus one or more phone or TV addresses for your home network.
Server did not print an address?
- Confirm Claude Code ran the start command from the family-tv-home folder.
- Check Claude Code's earlier syntax-check result for a problem inside server.js.
- Keep the server command active if the terminal is waiting without returning to a prompt.
Help me troubleshoot why my local Node.js server did not print its browser addresses.
A firewall prompt can feel risky. This app only needs incoming access on the trusted private home network you already confirmed.
macOS
- Leave the firewall settings unchanged if no incoming-connection message appears.
- Open System Settings if macOS blocks incoming access for Node.js.
- Select Network.
- Select Firewall.
- Select Options.
- Allow incoming connections for the Node.js app.
Windows
- Keep Microsoft Defender Firewall turned on.
- Select Private networks when the firewall prompt appears.
- Clear Public networks.
- Confirm the firewall prompt after checking those network choices.
- Leave the firewall settings unchanged if no prompt appears.
Verify the TV launcher
The launcher is the first view your family sees from across the room. Its clock, large tiles, and focus ring provide the visible proof that the milestone works.
- In Safari or Microsoft Edge from earlier, enter http://localhost:3000 in the address bar.
- Press Enter.
There it is: your browser now shows a dark TV launcher with a live clock. Four large tiles fill the main area.
Before you test the remote-style controls, where do you expect the focus ring to move after one right-arrow press?
- Press the right arrow key once.
You should see the focus ring move from Netflix to Disney+.
- Press the remaining arrow keys several times.
You should see the visible focus ring move among Netflix, Disney+, Prime Video, and Drawing Board.
- Move the focus ring to Netflix.
- Press Enter.
The browser opens the official Netflix website. This confirms that Enter activates the focused streaming link.
- Use the browser's back control to return to the launcher.
- Move the focus ring to Drawing Board.
- Press Enter.
The launcher stays on screen because Drawing Board is a placeholder in this milestone. The live clock continues updating while the server runs.
What do the streaming tiles open?
The three streaming tiles open the official service websites. Playback depends on the service account plus the browser running on that device.
Launcher not behaving as expected?
- Confirm the server terminal still shows the running process.
- Reload http://localhost:3000 if the page shows unstyled text or an old result.
- Press an arrow key before checking the focus ring if the browser initially hides keyboard focus.
- Compare the five generated files with the full-code reference if a tile or clock element is missing.
Help me troubleshoot my TV launcher preview.
Your family now has a TV-style launcher with a live clock and remote-friendly navigation. Next, you will add a drawing board and discover why one browser cannot share its strokes with another.
Add the Local Drawing Board
Your TV launcher now works from across the room. The Drawing Board tile still needs a surface where your family can create.
A canvas can feel complete when you test it alone. In this step, Claude Code adds a responsive HTML canvas for a two-device test.
In this step, get ready to:
- Guide Claude Code to add a responsive Drawing Board view.
- Test touch, pen, or mouse strokes on the local canvas.
- Compare the board across two browsers.
Build the browser drawing surface
Pointer events give the canvas one input path for touch, pen, or mouse. Normalized coordinates store each point from 0 to 1 so the drawing can scale when the canvas changes size.
- Return to the Claude Code session you used to build the launcher.
- Send this milestone prompt to Claude Code by pasting it into the active session:
Extend the current app with a local-only Drawing Board milestone. Keep the launcher and streaming links. Make the Drawing Board tile switch to a responsive HTML canvas view with Back, Clear, black, red, and blue controls. Use pointerdown, pointermove, pointerup, and pointercancel so touch, pen, and mouse share one input path. Use pointer capture and touch-action: none. Store each stroke as a color plus normalized x and y points from 0 to 1 so it scales between phone and TV-sized canvases. Redraw after resizing. Keep all strokes in browser memory only. Do not add WebSockets, server persistence, localStorage, or any network message yet. Update the existing files incrementally, run syntax checks, and summarize exactly what changed.
What does this prompt build?
- The hidden board screen gives the Drawing Board tile a separate view without removing the launcher.
- The pointer events let the canvas accept touch, pen, or mouse input.
- The normalized points preserve the drawing's proportions when the canvas changes size.
- The strokes array holds the drawing in the current browser's memory.
- Approve the proposed changes to public/index.html, public/styles.css, and public/app.js.
- Allow Claude Code to run its syntax checks.
- Return to the browser at http://localhost:3000.
- Refresh the page.
- Select the Drawing Board tile.
You should see Back, Clear, three circular colour controls, and a large white drawing canvas.
Drawing Board still missing?
- Confirm that Claude Code finished updating all three files before you refreshed the page.
- Switch back to the project terminal from earlier if the local page stopped loading.
- Restart the server with the start command Claude Code reported in the previous step.
Help me diagnose why the Drawing Board tile does not open the new canvas view.
Check the canvas controls
The current browser holds each completed stroke in its strokes array. The redraw path converts normalized points back into canvas positions after a resize.
- Draw one continuous black line across the canvas.
- Select the red circular control.
- Draw a second line on the canvas.
- Select the blue circular control.
- Draw a third line on the canvas.
- Resize the browser window.
You should see all three lines retain their relative positions as the canvas changes size.
- Select Back.
- Select the Drawing Board tile again.
You should see the same three lines because the current page still holds them in browser memory.
- Select Clear.
You should see the canvas become completely white again.
Canvas input behaving strangely?
- Confirm that touch-action: none is applied to #drawing-canvas if touch input scrolls the page.
- Ask Claude Code to compare resizeCanvas with redraw if strokes disappear after resizing.
Help me troubleshoot why my local canvas does not draw or redraw correctly.
Compare the two browsers
A local IPv4 address gives another device on your trusted home Wi-Fi a route to the server. Opening that address twice creates a direct test of how the current drawing state behaves.
- Switch back to the project terminal from earlier.
- Record the address printed after Phone or TV: as http://<local-ip>:3000.
- Confirm that the computer, phone, and second display use the same trusted home Wi-Fi.
- Enter http://<local-ip>:3000 in the phone browser's address bar.
- Enter http://<local-ip>:3000 in the computer or TV browser's address bar.
- Select the Drawing Board tile on the phone.
- Select the Drawing Board tile on the second browser.
Before you draw, do you expect a stroke made on the phone to appear on one canvas or both?
- Select the red circular control on the phone.
- Draw one clear line on the phone canvas.
- Compare the phone canvas with the second browser.
You should see the red line on the phone. The other browser remains blank.
This result is intentional. Each browser owns a separate strokes array in its own memory.
Good testing caught the key limitation before more complexity was added. Next up, you will connect both browsers so a family stroke can travel between them.
Sync and Save the Family Drawing
Your drawing board now responds to touch across different screen sizes. However, the phone and TV still keep separate copies of every stroke.
In this step, you will use WebSockets to carry normalized strokes through the local server. You will also use JSON persistence so completed drawings survive a server restart.
In this step, get ready to:
- Add live phone-to-TV drawing synchronization.
- Save completed strokes in drawing.json.
- Test colors, clearing, refresh recovery, and restart recovery.
Connect the browsers through the server
A WebSocket keeps a two-way connection open between each browser and your local server. That connection lets the server relay each drawing update to every connected screen.
- Switch back to the Claude Code session inside family-tv-home.
- Extend the current app by pasting this prompt:
Now fix the isolation problem with a real WebSocket layer. Pin the only dependency to ws version 8.22.2 in package.json and install it. Update server.js to attach WebSocketServer to the existing HTTP server. Use the documented imports import WebSocket, { WebSocketServer } from 'ws'. Maintain an in-memory strokes array. Accept only these JSON message types: stroke:start with id, allowed color, and normalized point; stroke:move with id and normalized point; stroke:end with id; and clear. Validate colors and clamp points to 0 through 1. Broadcast sanitized updates to every connected client when client.readyState equals WebSocket.OPEN. Send a state message containing all strokes to each new connection. Load drawing.json at startup, create it as [] when missing, and serialize writes so fsPromises.writeFile calls never overlap. Persist after stroke:end and clear. Update public/app.js to connect with the browser's native WebSocket using the current location host, show Connecting, Live, or Reconnecting, apply server messages to the canvas, and retry after a dropped connection. Do not add cloud hosting, authentication, analytics, or more dependencies. Run npm install, run syntax checks, and explain the message flow in plain language.
What does this prompt build?
- The ws package gives the Node server a WebSocket layer.
- The server validates every color and normalized point before sharing it.
- The browser uses its native WebSocket support to send drawing input and receive shared state.
- A serialized save queue prevents overlapping writes to drawing.json.
- Submit the prompt to Claude Code.
- Approve the proposed file changes after reviewing their filenames.
- Approve the dependency installation when Claude Code requests permission.
- Approve the syntax checks when Claude Code requests permission.
Claude Code should report that ws version 8.22.2 is installed. It should also confirm that both syntax checks pass.
How does a stroke travel?
The phone sends stroke:start when drawing begins. It follows with stroke:move messages as the pointer travels.
The server broadcasts sanitized updates to every connected browser. A completed stroke:end message also queues the drawing for storage.
Dependency installation not completing?
- Check that your computer still has an internet connection for the package download.
- Confirm that package.json pins ws to version 8.22.2.
- Confirm that Claude Code created node_modules and package-lock.json.
Help me diagnose the dependency or syntax-check failure.
Restart the app on trusted Wi-Fi
The previous server process loaded the browser-only version of the app. Restarting it loads the new WebSocket server and creates the local persistence file.
- Return to the server terminal from the previous step.
- Stop the old server by pressing Ctrl+C.
- Start the updated app from family-tv-home by running:
npm start
What does this command do?
The start script runs server.js with Node.js. The server loads the saved drawing before it begins accepting browser connections.
The terminal prints a localhost address and one or more local IPv4 addresses. Keep this terminal running while the phone and TV use the board.
- Record the printed phone or TV address here: http://192.168.1.25:3000.
- Confirm that the computer uses your trusted home Wi-Fi.
- Confirm that the phone uses the same trusted home Wi-Fi.
- Confirm that the TV uses the same trusted home Wi-Fi.
- On Windows, confirm that the active home network is set to Private.
- On Windows, confirm that Node.js is not allowed on Public networks.
- Keep router port forwarding disabled.
Why keep this on trusted Wi-Fi?
This beginner app has no authentication. Anyone on the same network who knows the local address can connect to the drawing board.
A private home network keeps the board inside the household. Stopping the server closes local access when the board is no longer in use.
- Open http://192.168.1.25:3000 in the phone browser.
- Open http://192.168.1.25:3000 in the TV or computer browser.
- Select the Drawing Board tile on each screen.
Both home screens should show Live once their WebSocket connections open. Both drawing boards should display the same current server state.
Connection status not reaching Live?
- Confirm that both devices use the exact local IPv4 URL printed by the server.
- Confirm that the server terminal is still running from family-tv-home.
- Confirm that guest Wi-Fi isolation is not separating the phone from the computer.
Help me troubleshoot the local WebSocket connection.
Prove sync and persistence
Before you draw, do you expect the TV to update during the stroke or only after the line is complete?
- Select the red color control on the phone.
- Draw one continuous line on the phone canvas.
You should see the red line appear on the TV while your finger moves. That is the isolation problem fixed: both browsers now share one server-managed drawing.
- Select the black color control on the phone.
- Draw a black line on the phone canvas.
- Select the blue color control on the phone.
- Draw a blue line on the phone canvas.
The TV should show all three colors in the same positions as the phone. The normalized points keep the drawing aligned across different canvas sizes.
- Select Clear on the phone.
Both canvases should clear together. The server also saves the empty shared state.
- Select the red color control on the phone.
- Draw one completed red line on the phone canvas.
- Refresh the phone browser.
- Refresh the TV or computer browser.
The red line should return on both screens after each refresh. The server sends its current state message to every new connection.
Before you restart the server, do you think the completed red line will survive after the in-memory stroke list disappears?
- Stop the server by pressing Ctrl+C.
- Restart the app from family-tv-home by running:
npm start
Why does the drawing return?
The server loads validated strokes from drawing.json during startup. Each browser receives those strokes when its WebSocket reconnects.
The save queue writes after completed strokes and clear actions. Serialized writes protect the file from overlapping updates.
The connection status should move through Reconnecting before returning to Live. The completed red line should reappear on both screens.
Use these tabs to confirm that your generated files match the completed milestone.
✔️ Awesome, I've got everything!
Your shared board is synchronized and persistent. Confirm that you saved every generated file before continuing.
Your family-tv-home folder should now contain node_modules, package-lock.json, and drawing.json.
ⓧ I'd like to double check the full code
Compare each file with the complete milestone below. Keep the generated package-lock.json and drawing.json files as created by the app.
{
"name": "family-tv-home",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"start": "node server.js",
"check": "node --check server.js && node --check public/app.js"
},
"dependencies": {
"ws": "8.22.2"
}
}
What does this file control?
The package manifest keeps ws pinned to version 8.22.2. Its scripts start the server and check both JavaScript files.
import http from 'node:http';
import fs from 'node:fs/promises';
import path from 'node:path';
import os from 'node:os';
import WebSocket, { WebSocketServer } from 'ws';
const PORT = 3000;
const HOST = '0.0.0.0';
const ROOT = process.cwd();
const PUBLIC_DIR = path.join(ROOT, 'public');
const DATA_FILE = path.join(ROOT, 'drawing.json');
const ALLOWED_COLORS = new Set(['#111827', '#ef4444', '#2563eb']);
const routes = {
'/': ['index.html', 'text/html; charset=utf-8'],
'/index.html': ['index.html', 'text/html; charset=utf-8'],
'/styles.css': ['styles.css', 'text/css; charset=utf-8'],
'/app.js': ['app.js', 'text/javascript; charset=utf-8']
};
function isPoint(point) {
return point
&& Number.isFinite(point.x)
&& Number.isFinite(point.y)
&& point.x >= 0
&& point.x <= 1
&& point.y >= 0
&& point.y <= 1;
}
function cleanPoint(point) {
return {
x: Math.min(1, Math.max(0, Number(point.x))),
y: Math.min(1, Math.max(0, Number(point.y)))
};
}
function isStoredStroke(stroke) {
return stroke
&& typeof stroke.id === 'string'
&& ALLOWED_COLORS.has(stroke.color)
&& Array.isArray(stroke.points)
&& stroke.points.length > 0
&& stroke.points.every(isPoint);
}
async function loadDrawing() {
try {
const text = await fs.readFile(DATA_FILE, 'utf8');
const parsed = JSON.parse(text);
return Array.isArray(parsed) ? parsed.filter(isStoredStroke) : [];
} catch (error) {
if (error.code === 'ENOENT') {
await fs.writeFile(DATA_FILE, '[]', 'utf8');
return [];
}
console.error('Could not load drawing.json:', error.message);
return [];
}
}
let strokes = await loadDrawing();
let saveQueue = Promise.resolve();
function queueSave() {
const snapshot = JSON.stringify(strokes, null, 2);
saveQueue = saveQueue
.then(() => fs.writeFile(DATA_FILE, snapshot, 'utf8'))
.catch((error) => {
console.error('Could not save drawing.json:', error.message);
});
}
const server = http.createServer(async (request, response) => {
const pathname = request.url?.split('?')[0] ?? '/';
const route = routes[pathname];
if (!route) {
response.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
response.end('Not found');
return;
}
const [fileName, contentType] = route;
try {
const file = await fs.readFile(path.join(PUBLIC_DIR, fileName));
response.writeHead(200, {
'Content-Type': contentType,
'Cache-Control': 'no-store'
});
response.end(file);
} catch (error) {
console.error(`Could not serve ${fileName}:`, error.message);
response.writeHead(500, { 'Content-Type': 'text/plain; charset=utf-8' });
response.end('Server error');
}
});
const wss = new WebSocketServer({ server });
function broadcast(message) {
const payload = JSON.stringify(message);
for (const client of wss.clients) {
if (client.readyState === WebSocket.OPEN) {
client.send(payload);
}
}
}
wss.on('connection', (socket) => {
socket.send(JSON.stringify({ type: 'state', strokes }));
socket.on('error', (error) => {
console.error('WebSocket error:', error.message);
});
socket.on('message', (rawMessage) => {
let message;
try {
message = JSON.parse(rawMessage.toString());
} catch {
return;
}
if (message.type === 'stroke:start') {
if (
typeof message.id !== 'string'
|| !ALLOWED_COLORS.has(message.color)
|| !isPoint(message.point)
|| strokes.some((stroke) => stroke.id === message.id)
) {
return;
}
const stroke = {
id: message.id,
color: message.color,
points: [cleanPoint(message.point)]
};
strokes.push(stroke);
broadcast({ type: 'stroke:start', stroke });
return;
}
if (message.type === 'stroke:move') {
const stroke = strokes.find((item) => item.id === message.id);
if (!stroke || !isPoint(message.point) || stroke.points.length >= 5000) {
return;
}
const point = cleanPoint(message.point);
stroke.points.push(point);
broadcast({ type: 'stroke:move', id: stroke.id, point });
return;
}
if (message.type === 'stroke:end') {
if (!strokes.some((stroke) => stroke.id === message.id)) {
return;
}
queueSave();
broadcast({ type: 'stroke:end', id: message.id });
return;
}
if (message.type === 'clear') {
strokes = [];
queueSave();
broadcast({ type: 'clear' });
}
});
});
function localAddresses() {
const addresses = [];
for (const details of Object.values(os.networkInterfaces())) {
for (const detail of details ?? []) {
if (detail.family === 'IPv4' && !detail.internal) {
addresses.push(detail.address);
}
}
}
return [...new Set(addresses)];
}
server.listen(PORT, HOST, () => {
console.log(`Computer: http://localhost:${PORT}`);
for (const address of localAddresses()) {
console.log(`Phone or TV: http://${address}:${PORT}`);
}
console.log('Keep this terminal open. Press Ctrl + C to stop.');
});
What does the server manage?
The server validates incoming drawing messages before broadcasting them. It sends the complete stroke state to each new connection.
The save queue stores completed drawing state in drawing.json without overlapping file writes.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Family TV Home</title>
<link rel="stylesheet" href="/styles.css">
<script src="/app.js" defer></script>
</head>
<body>
<main class="app-shell">
<section id="home-screen" class="screen" aria-labelledby="home-title">
<header class="home-header">
<div>
<p class="eyebrow">Family TV</p>
<h1 id="clock">--:--</h1>
<p id="date" class="date-line"></p>
</div>
<p id="connection-status" class="connection-status" role="status">Connecting</p>
</header>
<h2 id="home-title" class="visually-hidden">Choose an app</h2>
<div class="launcher-grid" aria-label="Family TV apps">
<a class="tile launcher-item netflix" href="https://www.netflix.com/">
<span class="tile-mark">N</span>
<span>Netflix</span>
</a>
<a class="tile launcher-item disney" href="https://www.disneyplus.com/">
<span class="tile-mark">D+</span>
<span>Disney+</span>
</a>
<a class="tile launcher-item prime" href="https://www.primevideo.com/">
<span class="tile-mark">P</span>
<span>Prime Video</span>
</a>
<button id="open-board" class="tile launcher-item drawing" type="button">
<span class="tile-mark">Draw</span>
<span>Drawing Board</span>
</button>
</div>
<p class="remote-hint">Use arrow keys to move and Enter to select.</p>
</section>
<section id="board-screen" class="screen board-screen" aria-labelledby="board-title" hidden>
<header class="board-header">
<button id="back-button" class="text-button" type="button">Back</button>
<div>
<p class="eyebrow">Shared space</p>
<h1 id="board-title">Family Drawing Board</h1>
</div>
</header>
<div class="toolbar" aria-label="Drawing controls">
<button class="color-button selected" type="button" data-color="#111827" aria-label="Draw in black"></button>
<button class="color-button red" type="button" data-color="#ef4444" aria-label="Draw in red"></button>
<button class="color-button blue" type="button" data-color="#2563eb" aria-label="Draw in blue"></button>
<button id="clear-button" class="text-button danger" type="button">Clear</button>
</div>
<canvas id="drawing-canvas">A shared family drawing canvas.</canvas>
</section>
</main>
</body>
</html>
What changed in the page?
The home header now includes connection-status for the WebSocket state. The launcher and drawing controls keep their existing identifiers.
:root {
color-scheme: dark;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: #05070d;
color: #f8fafc;
}
* {
box-sizing: border-box;
}
html,
body {
min-height: 100%;
margin: 0;
}
body {
min-height: 100vh;
background:
radial-gradient(circle at 15% 10%, rgba(37, 99, 235, 0.22), transparent 35%),
linear-gradient(145deg, #070b14, #020308 75%);
}
button,
a {
font: inherit;
}
button {
color: inherit;
}
.app-shell {
min-height: 100vh;
}
.screen {
min-height: 100vh;
padding: clamp(1.25rem, 4vw, 4rem);
}
.home-header,
.board-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 2rem;
}
.eyebrow {
margin: 0 0 0.35rem;
color: #93c5fd;
font-size: clamp(0.78rem, 1.4vw, 1.05rem);
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
#clock {
margin: 0;
font-size: clamp(3rem, 8vw, 7rem);
line-height: 0.95;
}
.date-line {
margin: 0.65rem 0 0;
color: #cbd5e1;
font-size: clamp(1rem, 2vw, 1.5rem);
}
.connection-status {
margin: 0;
padding: 0.65rem 0.9rem;
border: 1px solid #334155;
border-radius: 999px;
background: rgba(15, 23, 42, 0.85);
color: #fbbf24;
font-weight: 800;
}
.connection-status.live {
color: #86efac;
}
.launcher-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: clamp(0.75rem, 2vw, 1.5rem);
margin-top: clamp(2rem, 6vh, 5rem);
}
.tile {
display: flex;
min-height: clamp(9rem, 24vh, 15rem);
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
padding: clamp(1rem, 2.5vw, 2rem);
overflow: hidden;
border: 2px solid transparent;
border-radius: 1.5rem;
box-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.28);
color: white;
cursor: pointer;
font-size: clamp(1.1rem, 2vw, 1.55rem);
font-weight: 800;
text-align: left;
text-decoration: none;
transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.tile:focus-visible,
.text-button:focus-visible,
.color-button:focus-visible {
outline: 0.3rem solid #f8fafc;
outline-offset: 0.3rem;
}
.tile:focus-visible {
transform: translateY(-0.35rem) scale(1.025);
border-color: #f8fafc;
box-shadow: 0 0 0 0.35rem #2563eb, 0 1.5rem 3rem rgba(0, 0, 0, 0.4);
}
.tile-mark {
font-size: clamp(2rem, 5vw, 4rem);
line-height: 1;
}
.netflix {
background: linear-gradient(145deg, #e50914, #5b0509);
}
.disney {
background: linear-gradient(145deg, #173c9b, #081a4b);
}
.prime {
background: linear-gradient(145deg, #00a8e1, #0b4f7a);
}
.drawing {
background: linear-gradient(145deg, #7c3aed, #312e81);
}
.remote-hint {
color: #94a3b8;
font-size: 0.95rem;
text-align: center;
}
.board-screen {
display: grid;
grid-template-rows: auto auto minmax(18rem, 1fr);
gap: 1rem;
}
.board-screen[hidden] {
display: none;
}
.board-header {
justify-content: flex-start;
}
.board-header h1 {
margin: 0;
font-size: clamp(1.6rem, 4vw, 3rem);
}
.toolbar {
display: flex;
align-items: center;
gap: 0.75rem;
flex-wrap: wrap;
}
.text-button,
.color-button {
border: 2px solid #475569;
background: #111827;
cursor: pointer;
}
.text-button {
min-height: 3rem;
padding: 0.65rem 1rem;
border-radius: 0.8rem;
font-weight: 800;
}
.text-button.danger {
margin-left: auto;
border-color: #7f1d1d;
background: #450a0a;
color: #fecaca;
}
.color-button {
width: 3rem;
height: 3rem;
border-radius: 50%;
background: #111827;
}
.color-button.red {
background: #ef4444;
}
.color-button.blue {
background: #2563eb;
}
.color-button.selected {
box-shadow: 0 0 0 0.25rem #f8fafc;
}
#drawing-canvas {
display: block;
width: 100%;
height: 100%;
min-height: 18rem;
border: 0.25rem solid #334155;
border-radius: 1.25rem;
background: #ffffff;
cursor: crosshair;
touch-action: none;
}
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
@media (max-width: 899px) {
.launcher-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 599px) {
.screen {
padding: 1rem;
}
.home-header {
gap: 1rem;
}
.launcher-grid {
grid-template-columns: 1fr;
margin-top: 2rem;
}
.tile {
min-height: 7rem;
}
.tile-mark {
font-size: 2rem;
}
.board-header {
align-items: center;
}
}
What does the stylesheet preserve?
The existing launcher and board remain responsive across phone and TV dimensions. The connection status changes color when the browser reaches its live state.
const homeScreen = document.querySelector('#home-screen');
const boardScreen = document.querySelector('#board-screen');
const clock = document.querySelector('#clock');
const dateLine = document.querySelector('#date');
const connectionStatus = document.querySelector('#connection-status');
const openBoardButton = document.querySelector('#open-board');
const backButton = document.querySelector('#back-button');
const clearButton = document.querySelector('#clear-button');
const canvas = document.querySelector('#drawing-canvas');
const colorButtons = [...document.querySelectorAll('.color-button')];
const launcherItems = [...document.querySelectorAll('.launcher-item')];
const context = canvas.getContext('2d');
let selectedColor = '#111827';
let strokes = [];
let activeStrokeId = null;
let activePointerId = null;
let socket = null;
let reconnectTimer = null;
function updateClock() {
const now = new Date();
clock.textContent = now.toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit'
});
dateLine.textContent = now.toLocaleDateString([], {
weekday: 'long',
month: 'long',
day: 'numeric'
});
}
updateClock();
setInterval(updateClock, 1000);
function columnCount() {
if (window.innerWidth >= 900) return 4;
if (window.innerWidth >= 600) return 2;
return 1;
}
function moveLauncherFocus(key) {
const currentIndex = Math.max(0, launcherItems.indexOf(document.activeElement));
const columns = columnCount();
let nextIndex = currentIndex;
if (key === 'ArrowRight') nextIndex = Math.min(launcherItems.length - 1, currentIndex + 1);
if (key === 'ArrowLeft') nextIndex = Math.max(0, currentIndex - 1);
if (key === 'ArrowDown') nextIndex = Math.min(launcherItems.length - 1, currentIndex + columns);
if (key === 'ArrowUp') nextIndex = Math.max(0, currentIndex - columns);
launcherItems[nextIndex].focus();
}
window.addEventListener('keydown', (event) => {
if (homeScreen.hidden || !event.key.startsWith('Arrow')) return;
event.preventDefault();
moveLauncherFocus(event.key);
});
function showBoard() {
homeScreen.hidden = true;
boardScreen.hidden = false;
requestAnimationFrame(() => {
resizeCanvas();
backButton.focus();
});
}
function showHome() {
boardScreen.hidden = true;
homeScreen.hidden = false;
openBoardButton.focus();
}
openBoardButton.addEventListener('click', showBoard);
backButton.addEventListener('click', showHome);
function resizeCanvas() {
const bounds = canvas.getBoundingClientRect();
const ratio = window.devicePixelRatio || 1;
canvas.width = Math.max(1, Math.round(bounds.width * ratio));
canvas.height = Math.max(1, Math.round(bounds.height * ratio));
context.setTransform(ratio, 0, 0, ratio, 0, 0);
redraw();
}
function drawStroke(stroke) {
if (!stroke.points.length) return;
context.beginPath();
context.strokeStyle = stroke.color;
context.lineWidth = 5;
context.lineCap = 'round';
context.lineJoin = 'round';
const first = stroke.points[0];
context.moveTo(first.x * canvas.clientWidth, first.y * canvas.clientHeight);
if (stroke.points.length === 1) {
context.lineTo(
first.x * canvas.clientWidth + 0.01,
first.y * canvas.clientHeight + 0.01
);
} else {
for (const point of stroke.points.slice(1)) {
context.lineTo(point.x * canvas.clientWidth, point.y * canvas.clientHeight);
}
}
context.stroke();
}
function redraw() {
context.clearRect(0, 0, canvas.clientWidth, canvas.clientHeight);
strokes.forEach(drawStroke);
}
function normalizedPoint(event) {
const bounds = canvas.getBoundingClientRect();
return {
x: Math.min(1, Math.max(0, (event.clientX - bounds.left) / bounds.width)),
y: Math.min(1, Math.max(0, (event.clientY - bounds.top) / bounds.height))
};
}
function send(message) {
if (socket?.readyState === WebSocket.OPEN) {
socket.send(JSON.stringify(message));
}
}
function beginStroke(event) {
if (event.button !== 0 && event.pointerType === 'mouse') return;
activePointerId = event.pointerId;
activeStrokeId = `${Date.now()}-${Math.random().toString(16).slice(2)}`;
canvas.setPointerCapture(event.pointerId);
send({
type: 'stroke:start',
id: activeStrokeId,
color: selectedColor,
point: normalizedPoint(event)
});
}
function extendStroke(event) {
if (event.pointerId !== activePointerId || !activeStrokeId) return;
send({
type: 'stroke:move',
id: activeStrokeId,
point: normalizedPoint(event)
});
}
function finishStroke(event) {
if (event.pointerId !== activePointerId || !activeStrokeId) return;
send({ type: 'stroke:end', id: activeStrokeId });
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
activePointerId = null;
activeStrokeId = null;
}
canvas.addEventListener('pointerdown', beginStroke);
canvas.addEventListener('pointermove', extendStroke);
canvas.addEventListener('pointerup', finishStroke);
canvas.addEventListener('pointercancel', finishStroke);
for (const button of colorButtons) {
button.addEventListener('click', () => {
selectedColor = button.dataset.color;
colorButtons.forEach((item) => item.classList.toggle('selected', item === button));
});
}
clearButton.addEventListener('click', () => {
send({ type: 'clear' });
});
function setConnectionStatus(text, isLive = false) {
connectionStatus.textContent = text;
connectionStatus.classList.toggle('live', isLive);
}
function applyMessage(message) {
if (message.type === 'state' && Array.isArray(message.strokes)) {
strokes = message.strokes;
}
if (message.type === 'stroke:start' && message.stroke) {
if (!strokes.some((stroke) => stroke.id === message.stroke.id)) {
strokes.push(message.stroke);
}
}
if (message.type === 'stroke:move') {
const stroke = strokes.find((item) => item.id === message.id);
if (stroke && message.point) stroke.points.push(message.point);
}
if (message.type === 'clear') {
strokes = [];
}
if (!boardScreen.hidden) redraw();
}
function connect() {
clearTimeout(reconnectTimer);
setConnectionStatus('Connecting');
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
socket = new WebSocket(`${protocol}//${window.location.host}`);
socket.addEventListener('open', () => {
setConnectionStatus('Live', true);
});
socket.addEventListener('message', (event) => {
try {
applyMessage(JSON.parse(event.data));
} catch {
setConnectionStatus('Invalid message');
}
});
socket.addEventListener('close', () => {
setConnectionStatus('Reconnecting');
reconnectTimer = setTimeout(connect, 1500);
});
socket.addEventListener('error', () => {
setConnectionStatus('Connection error');
});
}
window.addEventListener('resize', () => {
if (!boardScreen.hidden) resizeCanvas();
});
launcherItems[0].focus();
connect();
What does the browser manage?
The browser sends pointer input through its native WebSocket. It applies server state and live stroke messages to the canvas.
A dropped connection changes the status to Reconnecting. The retry timer reconnects to the current location host.
Your phone and TV now share one persistent family canvas. Next up, you will audit every file and test the finished experience with another person.
Audit and Run the Family Test
Your phone can now send a drawing to the TV through WebSockets. The completed picture also survives a server restart.
A working demo can still hide mismatched files or device assumptions. In this step, Claude Code audits the whole project before another person tests it on two devices.
In this step, get ready to:
- Audit every project file with Claude Code.
- Prove the launcher and shared drawing pass the manual checklist.
- Document a two-person family test in one privacy-safe photo.
Audit the complete project
A final audit checks the contracts between files. It catches problems that can remain hidden during a successful drawing test.
- Switch back to the Claude Code session running inside family-tv-home.
- Paste this audit prompt into the session:
Audit the entire family-tv-home project as if you did not write it. Compare package.json, server.js, public/index.html, public/styles.css, and public/app.js for mismatched IDs, unused imports, broken routes, invalid message names, unsafe overlapping drawing.json writes, missing error handling, and keyboard or touch regressions. Confirm ws is pinned exactly to 8.22.2 and no other package is required. Run node --check server.js and node --check public/app.js. Fix only issues you can demonstrate. Do not add features. End with a short manual test checklist for localhost, phone-to-TV drawing, Clear, refresh persistence, restart persistence, arrow keys, and the three streaming links.
What does this audit cover?
- The file comparison checks that routes, element IDs, message types, and controls agree across the project.
- The dependency review confirms that ws remains pinned to version 8.22.2.
- The syntax checks parse server.js and public/app.js without launching another server.
- The final checklist turns the audit results into observable tests on your devices.
- Submit the prompt by pressing Enter.
- Review each issue that Claude can demonstrate.
- Approve only fixes that preserve the existing project scope.
- Allow Claude to run both syntax checks from the prompt.
- Read the manual checklist that Claude produces at the end.
Claude should finish without syntax errors. Its checklist should cover the launcher, shared drawing, persistence, and streaming links.
That is the code review complete. Your files now agree on the same tested behavior.
Audit Trying to Add Features?
Reject any proposed feature that goes beyond a demonstrated issue. Remind Claude to preserve the current files and fix only the specific problem it can reproduce.
If either syntax check fails, share the reported file and line with Claude before approving a correction. Help me diagnose the failed project audit.
Run the manual checklist
The audit proves that the files agree. The manual checklist proves that the controls still work in a real browser.
- Switch back to http://localhost:3000 in the computer browser.
- Watch the clock until its displayed time changes.
- Use the arrow keys to move across all four launcher tiles.
You should see a strong focus ring move with the arrow keys. The live clock should continue updating.
- Focus the Netflix tile.
- Press Enter to activate it.
You should reach the official Netflix website. This check confirms the destination only.
- Return to the home screen with the browser's Back control.
- Focus the Disney+ tile.
- Press Enter to activate it.
You should reach the official Disney+ website.
- Return to the home screen with the browser's Back control.
- Focus the Prime Video tile.
- Press Enter to activate it.
You should reach the official Prime Video website. Playback depends on the service account and browser.
- Return to the home screen with the browser's Back control.
- Switch the phone browser back to the exact printed local IPv4 URL from earlier.
- Switch the TV browser back to the same printed local IPv4 URL.
- Select Drawing Board on the phone.
- Select Drawing Board on the TV.
Both devices should show the same blank or previously saved canvas. The connection indicator should read Live.
- Draw one black stroke from the phone.
- Select the red color control on the phone.
- Draw one red stroke from the phone.
- Select the blue color control on the phone.
- Draw one blue stroke from the phone.
You should see all three colored strokes appear on the TV while you draw them.
- Select Clear on the phone.
Both canvases should clear together.
- Draw a new red line from the phone.
- Refresh the phone browser.
- Refresh the TV browser.
- Return to Drawing Board on the phone.
- Return to Drawing Board on the TV.
The same red line should return on both devices. Refresh persistence is working.
TV Browser Not Keeping Up?
Some TV browsers lack the canvas or WebSocket support this project needs. Connect a laptop to the TV with HDMI and use the laptop browser as the display fallback.
Keep the existing code unchanged. Help me check whether my TV browser supports this project.
Complete the two-person family test
A second person tests whether the controls make sense without your guidance. Their drawing also gives you a recognizable result for the final persistence check.
Before they draw, do you expect each phone stroke to reach the display while it is still being made?
- Invite another person to use the phone drawing board.
- Ask them to draw a recognizable family message or picture.
- Watch the TV or second screen while they draw.
You should see their strokes appear live on the larger display. You have now proved that the app works for someone besides its builder.
Before you restart the server, do you expect their completed drawing to return from drawing.json?
- Stop the running server by pressing Ctrl+C in its terminal.
- Restart the app by following the server start instruction in Claude's manual checklist.
- Refresh the phone browser.
- Refresh the TV or fallback display browser.
- Select Drawing Board on the phone.
- Select Drawing Board on the larger display.
The completed family drawing should return on both devices. That proves the shared result survives a full server restart.
The final photo is easy to keep safe when you control the frame. Keep private information outside the camera view.
- Keep account details outside the photo.
- Keep Wi-Fi passwords outside the photo.
- Keep terminal windows outside the photo.
- Frame the phone beside the TV or second screen.
- Take one photo showing the same family drawing on both devices.
The family test is complete. Your photo now captures live synchronization and the finished shared experience.
Secret mission
Add TV Presentation Mode
Give the family home screen a presentation mode that feels deliberate on a television. You will add a feature-detected full-screen control and hide the mouse cursor after three idle seconds.
Clean Up Your Resources
Clean Up Your Resources
Choose whether to keep the home screen available, pause its local server, or remove the project entirely. This project uses local Node.js execution. It creates no hosting bill.
Cost warning
Local execution and local file storage add no ongoing infrastructure cost. Claude Pro or Console usage can continue billing until you manage it separately in the relevant account.
Resources you used:
- The local family-tv-home folder containing the project source files.
- The node_modules directory containing ws version 8.22.2.
- The generated package-lock.json dependency lockfile.
- The generated drawing.json file containing the latest shared drawing.
- An optional operating-system firewall allowance for Node.js on trusted private networks.
- A Claude subscription or Console billing relationship if you created one for this project.
Keep everything running
Keep this option while your family is actively using the home screen. The server should stay available only on your trusted home Wi-Fi.
- Leave the existing server terminal running while the home screen is in use.
- Keep the family-tv-home folder to retain the source files and saved drawing.
- Keep firewall access limited to the private network profile.
- Stop the server before connecting the computer to public or guest Wi-Fi.
- Review your Claude plan or Console usage separately if billing remains active.
Who can reach the board?
Anyone on the trusted local network who knows the printed address can use the drawing board. This beginner version has no authentication.
Pause - I'll come back to this later
Pause the local server to make the site unreachable while preserving every project file. Your saved drawing remains in drawing.json.
- Switch back to the server terminal from earlier.
- Press Ctrl + C to stop the server.
- Refresh the local address on the phone or TV to check that the app is offline.
You will see the browser's unavailable-page state. This confirms that the local server has stopped accepting connections.
Start It Again Later
- Return to the server terminal inside family-tv-home.
- Run the same start command you used during the project.
The terminal prints the local addresses again. Your saved family drawing returns when the browsers reconnect.
Delete - I don't want to use this again
Removing the project is permanent. The saved drawing disappears with the family-tv-home folder.
macOS
- Stop the running server by pressing Ctrl + C.
- Use your computer's file browser to locate the family-tv-home folder from earlier.
- Move the family-tv-home folder to Trash.
The optional firewall allowance is stored separately from the project folder.
- Open System Settings.
- Select Network.
- Select Firewall.
- Select Options.
- Remove the Node.js app allowance if you added one for this project.
Windows
- Stop the running server by pressing Ctrl + C.
- Use your computer's file browser to locate the family-tv-home folder from earlier.
- Move the family-tv-home folder to the Recycle Bin.
The optional firewall allowance is stored separately from the project folder.
- Open Windows Security.
- Select Firewall & network protection.
- Select Allow an app through firewall.
- Remove Node.js from the allowed apps list for the Private profile if you added it.
Your local files and optional firewall allowance are now removed. Claude billing is managed separately from this project.
- Cancel Claude Pro separately in your Claude account if you purchased it only for this project.
- Review any Console billing relationship separately in the relevant account.
- Refresh the previous local address on one device to confirm that the app is gone.
You will see the browser's unavailable-page state. The family home screen is no longer running on your computer.
Nice Work!
Nice Work!
You pulled it off! You built a private family TV home screen that runs from a local Node.js server. Your phone and TV now share a persistent drawing board through WebSockets.
What you learned:
- Built a TV-style launcher with a live clock plus three streaming links. Added arrow-key navigation with a visible focus ring for across-the-room control.
- Created a responsive HTML canvas that supports touch plus mouse input. Used normalized coordinates to keep each stroke aligned across different screen sizes.
- Synchronized the shared family drawing between a phone and TV. Persisted completed strokes in a local JSON file. Audited the app before proving it with a two-person device test.
- Secret Mission: Added a feature-detected full-screen presentation mode with an idle cursor that disappears after three seconds. Preserved the existing drawing sync plus persistence behavior.
Ready to quiz yourself?