Build Tiny Log with Claude Code

Build a secure shared baby tracker with Claude Code, Supabase, and Vercel.

Introduction

30 Second Summary

Baby updates often disappear into scattered messages. The same question comes back all day: when was the last feed?

In this project, you will use Claude Code to build Tiny Log, a phone-friendly baby tracker for two parents. You will take it from a local prototype to a protected live app that both parents can update from separate devices.

What You'll Build

Open Tiny Log on two phones and watch each parent's feed, nappy, or sleep entry reach the shared activity list without a refresh.

By the end of this project, you'll have:

  • One-tap care logging for feeds, nappies, and sleep sessions. The Today view shows the latest feed time, today's sleep total, and today's nappy count.
  • A protected two-parent timeline backed by Supabase. Parent A can create a family. Parent B can join using the displayed family ID. New entries appear on both devices without a refresh.
  • A deployed tracker on Vercel that works across two devices. Its built-in privacy check shows zero readable families, babies, and events for a third identity.
  • Secret Mission: Add Tiny Log to both device home screens and rerun the two-direction realtime test.

Are there any prerequisites?

The project requires a Mac or Windows computer, internet access, and two test devices. Claude Code also requires an eligible paid plan or Console account because the free claude.ai plan does not include access.

Before We Start

Before the hands-on work begins, define who will share Tiny Log. Choose the repeated care question your shared timeline should answer instantly.

Set Up Node.js and Claude Code

Your care question gives Tiny Log a clear purpose. The project now needs a dependable development environment before any files can be created.

Node.js provides the JavaScript runtime for the tools you use later. Claude Code turns your instructions into the tracker's files.

The command and your account access must both work. Checking them now prevents an environment or account blocker halfway through the build.

In this step, get ready to:
  • Install Node.js v26.13.1 LTS.
  • Install Claude Code with Anthropic's native installer.
  • Authenticate Claude Code and complete its diagnostics.
Install Node.js

Node.js runs the development tools that build Tiny Log. Using v26.13.1 LTS keeps your environment aligned with this project.

  • Press Cmd+Space on macOS or the Windows key on Windows to open system search.
  • Type Terminal on macOS or PowerShell on Windows.
  • Press Enter to open the selected terminal app.
  • Check your installed Node.js version by running this command:
node --version

What does this check do?

This command prints the Node.js version available in your current terminal session. The result tells you which setup path to follow.

✔️ I see the required LTS version

You should see v26.13.1. Your Node.js runtime is ready.

ⓧ I see an older version

Your existing version needs an upgrade to v26.13.1 LTS before you continue.

macOS

You should see the installer in your downloads when it is ready.

  • Run the offered installer.
  • Keep the default installation location.

You should see the installer confirm that Node.js has been installed.

  • Close the existing Terminal window.
  • Press Cmd+Space to open Spotlight.
  • Type Terminal into Spotlight.
  • Press Enter to open a fresh Terminal session.
  • Confirm the upgraded version by running this command:
node --version
What does this check prove?

The fresh Terminal session should print v26.13.1. This confirms the upgraded runtime is available.

Windows

  • Visit the official Node.js download page.
  • Choose v26.13.1 LTS.
  • Select the Windows Installer when possible.

You should see the installer in your downloads when it is ready.

  • Run the downloaded installer.
  • Keep the default installation options.

You should see the installer confirm that Node.js has been installed.

  • Close the existing PowerShell window.
  • Press the Windows key to open system search.
  • Type PowerShell into system search.
  • Press Enter to open a fresh PowerShell session.
  • Confirm the upgraded version by running this command:
node --version
What does this check prove?

The fresh PowerShell session should print v26.13.1. This confirms the upgraded runtime is available.

ⓧ Command not found

Node.js is not installed yet. Use the official installer for your operating system.

macOS

You should see the installer in your downloads when it is ready.

  • Run the offered installer.
  • Keep the default installation location.

You should see the installer confirm that Node.js has been installed.

  • Close the existing Terminal window.
  • Press Cmd+Space to open Spotlight.
  • Type Terminal into Spotlight.
  • Press Enter to open a fresh Terminal session.
  • Confirm the installed version by running this command:
node --version
What does this check prove?

The fresh Terminal session should print v26.13.1. This confirms Node.js is installed.

Windows

  • Visit the official Node.js download page.
  • Choose v26.13.1 LTS.
  • Select the Windows Installer when possible.

You should see the installer in your downloads when it is ready.

  • Run the downloaded installer.
  • Keep the default installation options.

You should see the installer confirm that Node.js has been installed.

  • Close the existing PowerShell window.
  • Press the Windows key to open system search.
  • Type PowerShell into system search.
  • Press Enter to open a fresh PowerShell session.
  • Confirm the installed version by running this command:
node --version
What does this check prove?

The fresh PowerShell session should print v26.13.1. This confirms Node.js is installed.

  • Confirm that the bundled npm command is available by running this check:
npm --version

What does this check prove?

Node.js includes npm for installing project dependencies. A printed version number confirms that the package manager is available.

You should see an npm version number. Your JavaScript toolchain is now ready.

Still not seeing the Node.js tools?

Make sure you opened a fresh terminal after the installer finished. An older terminal session may not find the new commands.

Check that you downloaded the installer for your computer's operating system and architecture.

Help me diagnose my Node.js installation.

Install Claude Code

Claude Code runs inside your terminal. Anthropic's native installer adds the command that starts each coding session.

macOS

  • Install Claude Code with Anthropic's native installer by running this command in Terminal:
curl -fsSL https://claude.ai/install.sh | bash

What does this command do?

The command downloads Anthropic's official installation script. Your shell runs that script to install Claude Code.

You should see the installation finish without a reported blocker.

  • Close the Terminal window used for installation.
  • Press Cmd+Space to open Spotlight.
  • Type Terminal into Spotlight.
  • Press Enter to open a fresh Terminal session.
  • Check that Claude Code is available by running this command:
claude --version

What does this check prove?

The command asks Claude Code to print its installed version. A version number confirms that the fresh Terminal session can find the installation.

You should see a Claude Code version number in Terminal.

Claude Code command unavailable?

Confirm that the native installation finished before you closed Terminal. Run the installer again if it stopped early.

Help me find the Claude Code command.

Windows

  • Install Claude Code with Anthropic's native installer by running this command in PowerShell:
irm https://claude.ai/install.ps1 | iex

What does this command do?

The command downloads Anthropic's official PowerShell installation script. PowerShell runs that script to install Claude Code.

You should see the installation finish without a reported blocker.

  • Close the PowerShell window used for installation.
  • Press the Windows key to open system search.
  • Type PowerShell into system search.
  • Press Enter to open a fresh PowerShell session.
  • Check that Claude Code is available by running this command:
claude --version

What does this check prove?

The command asks Claude Code to print its installed version. A version number confirms that the fresh PowerShell session can find the installation.

You should see a Claude Code version number in PowerShell.

Claude Code command unavailable?

Confirm that the native installation finished before you closed PowerShell. Run the installer again if it stopped early.

Help me find the Claude Code command.

Authenticate Claude Code and run diagnostics

The installed command proves that the software is present. Authentication proves that your account can start a Claude Code session.

This access check can save you from a frustrating stop later. Claude Code requires a Pro, Max, Ultra, Team, Enterprise, or Console account.

  • Start Claude Code by running this command:
claude

What does this command do?

The command opens Claude Code in your terminal. Claude Code guides you through browser sign-in when authentication is required.

  • Complete the browser sign-in with your eligible Anthropic account.
  • Return to the terminal after the browser confirms authentication.
  • Confirm that an authenticated Claude Code session opens.

That is an important blocker cleared. Your account can now start the coding sessions used throughout this project.

Account access unavailable?

The free claude.ai plan does not include Claude Code access. Continue only after signing in with an eligible paid plan or Console account.

Help me understand the Claude Code access requirement.

The final diagnostic is read-only. It checks the installation and settings without changing your setup.

  • Press Cmd+Space on macOS or the Windows key on Windows to open system search.
  • Type Terminal on macOS or PowerShell on Windows.
  • Press Enter to open a fresh terminal session.

Before you run the final checks, which two results do you expect to be version numbers? What do you expect the diagnostic to inspect?

macOS

  • Run the final setup checks in Terminal with these commands:
npm --version
claude --version
claude doctor

What do these checks prove?

  • The first line confirms that the Node.js package manager is available.
  • The second line confirms that Terminal can find Claude Code.
  • The final line runs read-only installation and settings diagnostics.

You should see two version numbers. The diagnostic should complete without reporting an access blocker.

Windows

  • Run the final setup checks in PowerShell with these commands:
npm --version
claude --version
claude doctor

What do these checks prove?

  • The first line confirms that the Node.js package manager is available.
  • The second line confirms that PowerShell can find Claude Code.
  • The final line runs read-only installation and settings diagnostics.

You should see two version numbers. The diagnostic should complete without reporting an access blocker.

Final diagnostics not completing?

Confirm that you completed browser authentication with an eligible account. Open another fresh terminal if either installed command is still unavailable.

Help me diagnose the final setup checks.

Your development environment is ready. Node.js can supply project dependencies.

Claude Code is installed and authenticated. Its diagnostics confirm that you can begin the build.

Your tools are ready. Next up, you'll ask Claude Code to build the first local version of Tiny Log.

Build the Local Tracker

Your development tools are ready. Tiny Log now needs a working browser experience that turns each care action into a visible entry.

You will use Claude Code to build the prototype with JavaScript and Vite 8.3.8. A second browser session will then test the boundary of page-local memory.

In this step, get ready to:
  • Create the local baby-tracker folder and generate the prototype with Claude Code.
  • Install the pinned dependency and run Tiny Log in your browser.
  • Compare a Feed entry across normal and Private browser sessions.
Create Tiny Log

A focused prompt gives Claude Code clear boundaries for the first version. This prototype keeps every entry in an in-memory array so you can test the interaction before adding shared storage.

  • Switch back to the terminal or PowerShell session from the previous step.
  • Move to your Desktop by running this command:
cd ~/Desktop

What does this command do?

The cd command changes the terminal's current location. Using the Desktop gives the new project a predictable home.

  • Create the baby-tracker folder by running this command:
mkdir baby-tracker

What does this command do?

The mkdir command creates an empty folder named baby-tracker. Claude Code will place the prototype files inside it.

  • Check your Desktop for the new baby-tracker folder.

You should see the empty baby-tracker folder on your Desktop.

  • Move the terminal into baby-tracker by running this command:
cd baby-tracker

Why change folders?

Claude Code works with the folder where you start it. Moving into baby-tracker keeps every generated file inside this project.

Your terminal prompt should now end with baby-tracker.

  • Start Claude Code inside the empty folder by running this command:
claude

What happens when Claude Code starts?

Claude Code now treats baby-tracker as its project context. Any approved files are created inside this folder.

  • Ask Claude Code to build the scoped local prototype by pasting this prompt:
Create a mobile-first local-only baby tracker in this empty folder. Use vanilla JavaScript and Vite 8.3.8. Create `package.json`, `index.html`, `src/main.js`, and `src/style.css`. Add one-tap Feed and Nappy buttons, a Start sleep and Stop sleep button, Today cards, and an activity list. Keep entries only in the page's in-memory JavaScript array for now. Pin every dependency exactly. Do not add a database, authentication, or deployment.

Why keep the prompt this specific?

  • The file list gives Claude Code a fixed project structure.
  • The feature list defines the visible behavior you need to test.
  • The local-only boundary keeps database work outside this step.
  • The exact dependency rule keeps Vite pinned to 8.3.8.
  • Review Claude Code's file plan before approving any edits.
  • Confirm the plan includes package.json, index.html, src/main.js, and src/style.css.
  • Approve the proposed edits after the plan matches the prompt.

Claude Code should report that it created the local prototype files.

  • Confirm the generated files by exiting the Claude Code session or opening another terminal in baby-tracker.
  • List the project files and the contents of src by running these commands:
ls
ls src

What should the file check show?

The first command lists package.json, index.html, and the src folder. The second command lists main.js and style.css.

Missing a generated file?

  • Check that the terminal path ends with baby-tracker.
  • Return to Claude Code and ask it to compare the created files with the original prompt.
  • Review any new plan before approving the missing file.

Help me find why Claude Code did not create every requested Tiny Log file.

✔️ Awesome, I've got everything!

Your four prototype files are present. Keep the terminal in the baby-tracker folder for the installation.

ⓧ I'd like to double check the full code

Use this artifact checklist to confirm that Claude Code produced the intended local prototype.

  • index.html: Mobile-first Tiny Log HTML entry page loading /src/main.js into an #app element.
  • package.json: Local Vite project package manifest with exact Vite 8.3.8 dependency and dev, build, and preview scripts.
  • src/main.js: Vanilla JavaScript local-only Tiny Log application with an in-memory entries array, Feed and Nappy logging, start-stop Sleep handling, Today summary cards, and activity-list rendering.
  • src/style.css: Responsive mobile-first Tiny Log styling for onboarding, cards, action buttons, Today cards, and activity list.
Run Tiny Log

The generated package.json tells npm which dependency to install. Installing it prepares the Vite development server that serves Tiny Log locally.

  • Install the dependency pinned in package.json by running this command:
npm install

What does this command do?

The command reads package.json and downloads the listed modules. It also creates the local node_modules directory used by the project.

You should see npm finish with an installation summary. The terminal returns to a prompt when the dependency is ready.

Did the installation fail?

  • Check that the terminal path ends with baby-tracker.
  • Confirm that package.json appears in the file listing.
  • Confirm that its Vite dependency is pinned to 8.3.8.

Help me troubleshoot npm install in my Tiny Log project.

The development server stays attached to this terminal while Tiny Log is available. Keep this terminal running during the browser tests.

  • Start the Vite development server by running this command:
npm run dev

What does this command do?

The dev script starts Vite's local development server. It serves Tiny Log at http://localhost:5173 while the terminal process remains active.

  • Press Cmd+Space on macOS or the Windows key on Windows to open system search.
  • Type Safari on macOS or Chrome on Windows to find the browser.
  • Press Enter to open the browser.
  • Enter http://localhost:5173 in the address bar.

You should see Tiny Log with Today cards, Feed and Nappy controls, sleep controls, and an activity list.

  • Click the Feed control once.

You should see a timestamped Feed entry in the activity list. The Today summary should show the recent feed.

That first entry is your visible win. Tiny Log can now turn a care action into an immediate record.

Tiny Log did not load?

  • Check that the terminal still shows the running development server.
  • Confirm that the browser address is http://localhost:5173.
  • Return to the terminal to read any file or syntax error reported by Vite.

Help me get the local Tiny Log page running.

Test Tiny Log

Your normal browser window now contains a Feed entry. A separate browser session gives you a clean test of whether that record can travel beyond its original page.

Before you open the second session, do you expect its activity list to contain the Feed entry?

Safari

  • Click File in the Safari menu bar.
  • Choose New Private Window.
  • Enter http://localhost:5173 in the Smart Search field.

Chrome

  • Click More in the top-right corner of Chrome.
  • Choose New Incognito window.
  • Enter http://localhost:5173 in the address bar.

You will see a fresh Tiny Log page with no Feed entry in its activity list. The original window still shows the entry you logged.

Why is the Feed entry missing?

Each page owns a separate in-memory entries array. The Feed entry exists only inside the normal window's running JavaScript session.

This is the intended shortfall. A shared household tracker needs storage that both browser sessions can reach.

  • Return to the normal browser window.
  • Confirm that its activity list still contains the timestamped Feed entry.
  • Return to the Private or Incognito window.
  • Confirm that its activity list contains no Feed entry.

You have a working Tiny Log prototype plus clear evidence of its sharing limit. Next, you will replace page-local memory with a protected shared backend.

Add the Secure Shared Backend

Your Vite prototype proved that Tiny Log can capture feeds, nappies, and sleep. The Private window also exposed its limit because page memory belongs to one browser session.

This step moves the timeline into Supabase so both parents can reach shared rows. Anonymous authentication gives each browser a distinct identity. Row Level Security keeps every identity outside its family until it joins.

In this step, get ready to:
  • Create a Supabase Free project with anonymous sign-ins and a protected database.
  • Connect Tiny Log using a Project URL and publishable key.
  • Run the privacy check as a fresh identity and confirm it reads zero rows.
Create the protected Supabase project

Supabase provides the shared Postgres database that replaces the prototype's in-memory array. Its security policies decide which rows each signed-in identity can read or change.

Why Supabase for this step?

A custom REST server would add routing, hosting, and authorization code before Tiny Log could share an entry. Supabase combines authentication, Postgres, and Realtime in one project.

The database enforces family membership for every browser request. Client-side filtering cannot provide that boundary.

  • Return to the terminal where the development server is running.
  • Stop the development server by pressing Ctrl+C.
  • Start Claude Code in the existing baby-tracker folder by running this command:
claude

Why return to Claude Code?

Claude Code can create the database script inside the same project folder. Keeping supabase.sql with the app gives you a repeatable record of the database structure and security rules.

  • Visit the Supabase Dashboard in your normal browser window.
  • Sign in to your Supabase account.
  • Use the Dashboard project creation flow to create a Supabase Free project named baby-tracker.

Project creation can sit in a provisioning state for a few minutes. That delay is Supabase preparing the database and authentication services.

  • Open Auth settings in the new project.
  • Enable Allow anonymous sign-ins.
  • Apply the authentication setting.

What does anonymous authentication provide?

Each browser receives a distinct authenticated identity without an email address. That identity uses the authenticated database role, so Row Level Security can protect its requests.

Clearing browser data or signing out makes an anonymous identity unrecoverable. Tiny Log uses this approach for a learning prototype.

  • Ask Claude Code to create supabase.sql inside baby-tracker using the complete file in the double-check tab below.
  • Review Claude's file plan.
  • Confirm the plan includes four tables, two private helpers, Row Level Security policies, least-privilege grants, indexes, and the events Realtime publication.
  • Approve the creation of supabase.sql.

✔️ Claude created supabase.sql

Great. Keep supabase.sql in the baby-tracker folder so the database definition stays with the app.

ⓧ I'd like to double check the full code

create schema if not exists private;
create table public.families (id uuid primary key default gen_random_uuid(), name text not null check (char_length(name) between 1 and 80), created_by uuid not null references auth.users(id) on delete cascade, created_at timestamptz not null default now());
create table public.family_members (family_id uuid not null references public.families(id) on delete cascade, user_id uuid not null references auth.users(id) on delete cascade, display_name text not null check (char_length(display_name) between 1 and 50), joined_at timestamptz not null default now(), primary key (family_id, user_id));
create index family_members_user_id_idx on public.family_members using btree (user_id);
create table public.babies (id uuid primary key default gen_random_uuid(), family_id uuid not null references public.families(id) on delete cascade, name text not null check (char_length(name) between 1 and 50), created_at timestamptz not null default now());
create index babies_family_id_idx on public.babies using btree (family_id);
create table public.events (id uuid primary key default gen_random_uuid(), family_id uuid not null references public.families(id) on delete cascade, baby_id uuid not null references public.babies(id) on delete cascade, user_id uuid not null references auth.users(id) on delete cascade, event_type text not null check (event_type in ('feed', 'nappy', 'sleep')), started_at timestamptz not null default now(), ended_at timestamptz, created_at timestamptz not null default now(), check (ended_at is null or ended_at >= started_at));
create index events_family_started_idx on public.events using btree (family_id, started_at desc);

create function private.is_family_member(target_family_id uuid) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.family_members where family_id = target_family_id and user_id = (select auth.uid())); $$;
create function private.family_exists(target_family_id uuid) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.families where id = target_family_id); $$;
revoke all on function private.is_family_member(uuid) from public;
revoke all on function private.family_exists(uuid) from public;
grant usage on schema private to authenticated;
grant execute on function private.is_family_member(uuid) to authenticated;
grant execute on function private.family_exists(uuid) to authenticated;

alter table public.families enable row level security;
alter table public.family_members enable row level security;
alter table public.babies enable row level security;
alter table public.events enable row level security;
revoke all on table public.families from anon, authenticated;
revoke all on table public.family_members from anon, authenticated;
revoke all on table public.babies from anon, authenticated;
revoke all on table public.events from anon, authenticated;
grant select, insert on table public.families to authenticated;
grant select, insert on table public.family_members to authenticated;
grant select, insert on table public.babies to authenticated;
grant select, insert, update on table public.events to authenticated;

create policy "Creators and members can read families" on public.families for select to authenticated using (created_by = (select auth.uid()) or (select private.is_family_member(id)));
create policy "Authenticated users can create their own family" on public.families for insert to authenticated with check (created_by = (select auth.uid()));
create policy "Members can read family membership" on public.family_members for select to authenticated using ((select private.is_family_member(family_id)));
create policy "Users can join themselves with a family ID" on public.family_members for insert to authenticated with check (user_id = (select auth.uid()) and (select private.family_exists(family_id)));
create policy "Members can read babies" on public.babies for select to authenticated using ((select private.is_family_member(family_id)));
create policy "Members can create babies" on public.babies for insert to authenticated with check ((select private.is_family_member(family_id)));
create policy "Members can read events" on public.events for select to authenticated using ((select private.is_family_member(family_id)));
create policy "Members can create events" on public.events for insert to authenticated with check (user_id = (select auth.uid()) and (select private.is_family_member(family_id)) and exists (select 1 from public.babies where public.babies.id = baby_id and public.babies.family_id = events.family_id));
create policy "Members can finish sleep events" on public.events for update to authenticated using ((select private.is_family_member(family_id))) with check ((select private.is_family_member(family_id)) and exists (select 1 from public.babies where public.babies.id = baby_id and public.babies.family_id = events.family_id));
alter publication supabase_realtime add table public.events;

What does this SQL create?

  • The four public tables hold families, memberships, babies, and timeline events.
  • The private helper functions check family access without creating recursive membership policies.
  • The grants expose only the operations the browser app needs.
  • The policies enforce membership for reads and event changes.
  • The final statement publishes event changes through Supabase Realtime.
  • Open the SQL Editor in the Supabase Dashboard.
  • Copy the complete contents of supabase.sql from the double-check tab.
  • Paste the SQL into the SQL Editor.
  • Click Run.

You should see a successful query result. The database now has four protected tables plus a Realtime publication for events.

Did the SQL stop with an error?

Make sure you pasted the entire file from the first create schema statement through the final alter publication statement. A missing helper or policy line can stop later statements from running.

If you ran only part of the script, create a fresh Supabase project before retrying the complete file. This avoids collisions with tables that were already created.

Help me diagnose my Supabase SQL error.

Connect Tiny Log to Supabase

The browser app now needs the Supabase Project URL and publishable key. Vite reads those values from .env.local when the development server starts.

The publishable key is designed for browser code. A secret key bypasses Row Level Security, so Tiny Log must never contain one.

  • Ask Claude Code to replace the local prototype with the complete Supabase-backed versions of package.json, index.html, src/main.js, and src/style.css shown in the double-check tab below.
  • Tell Claude Code to create .env.example and .gitignore from the same tab.
  • Tell Claude Code to keep Vite at 8.3.8.
  • Tell Claude Code to add @supabase/supabase-js at 2.119.0.
  • Review Claude's file plan before approving the edits.
  • Confirm that the plan leaves the Vercel dependency for the deployment step.
  • Approve the file edits.

✔️ Claude updated every file

Good progress. Claude has replaced the page-local array with authenticated database queries while preserving the Feed, Nappy, Sleep, Today, and activity features.

ⓧ I'd like to double check the full code

VITE_SUPABASE_URL=https://your-project-id.supabase.co
VITE_SUPABASE_PUBLISHABLE_KEY=sb_publishable_your-key-here

What does this example file do?

This file documents the two public connection values Tiny Log expects. Its placeholder values are safe to keep with the project.

node_modules/
dist/
*.local
.vercel/

What stays out of Git?

The *.local rule ignores .env.local. The other rules exclude installed packages, build output, and future local Vercel metadata.

{"name":"tiny-log-baby-tracker","private":true,"version":"1.0.0","type":"module","scripts":{"dev":"vite","build":"vite build","preview":"vite preview"},"dependencies":{"@supabase/supabase-js":"2.119.0"},"devDependencies":{"vite":"8.3.8"}}

What changes in the package file?

The dependency list now includes the Supabase browser client at the required version. The existing Vite scripts remain available for development, builds, and previews.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="theme-color" content="#3f6c5b" />
    <title>Tiny Log Baby Tracker</title>
  </head>
  <body>
    <main id="app" aria-live="polite"><p class="loading">Loading Tiny Log...</p></main>
    <script type="module" src="/src/main.js"></script>
  </body>
</html>

What does the entry page provide?

The page gives the JavaScript app one live region named #app. Tiny Log replaces its loading message with onboarding, dashboard, or error content.

import './style.css'
import { createClient } from '@supabase/supabase-js'

const app = document.querySelector('#app')
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL
const supabasePublishableKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY

let supabase
let session = null
let currentUser = null
let family = null
let baby = null
let members = []
let events = []
let realtimeChannel = null

if (!supabaseUrl || !supabasePublishableKey) {
  app.innerHTML = `<section class="shell narrow"><div class="card"><p class="eyebrow">Setup needed</p><h1>Add your Supabase connection</h1><p>Create <code>.env.local</code> from <code>.env.example</code>, add the Project URL and publishable key, then restart the development server.</p></div></section>`
} else {
  supabase = createClient(supabaseUrl, supabasePublishableKey)
  boot()
}

async function boot() {
  try {
    const { data, error } = await supabase.auth.getSession()
    if (error) throw error
    session = data.session
    if (!session) return renderOnboarding()
    const userResult = await supabase.auth.getUser()
    if (userResult.error) throw userResult.error
    currentUser = userResult.data.user
    await loadFamilyContext()
  } catch (error) {
    renderFatal(error)
  }
}

async function ensureIdentity() {
  if (!session) {
    const signInResult = await supabase.auth.signInAnonymously()
    if (signInResult.error) throw signInResult.error
    const sessionResult = await supabase.auth.getSession()
    if (sessionResult.error) throw sessionResult.error
    session = sessionResult.data.session
  }
  if (!currentUser) {
    const userResult = await supabase.auth.getUser()
    if (userResult.error) throw userResult.error
    currentUser = userResult.data.user
  }
}

function renderOnboarding(message = '') {
  app.innerHTML = `
    <section class="shell narrow">
      <header class="hero"><p class="eyebrow">Shared care, fewer messages</p><h1>Tiny Log</h1><p>Track feeds, nappies, and sleep with another caregiver.</p></header>
      ${message ? `<p class="notice">${escapeHtml(message)}</p>` : ''}
      <div class="card stack"><h2>Create a family</h2><label>Your display name<input id="create-display-name" autocomplete="name" placeholder="Parent A" /></label><label>Baby's test name<input id="baby-name" placeholder="Sam" /></label><button id="create-family" class="primary">Create family</button></div>
      <div class="card stack"><h2>Join a family</h2><label>Your display name<input id="join-display-name" autocomplete="name" placeholder="Parent B" /></label><label>Family ID<input id="join-family-id" placeholder="Paste the shared family ID" /></label><button id="join-family" class="secondary">Join family</button></div>
      <div class="card stack"><h2>Privacy test</h2><p>Create a fresh anonymous identity and ask the database what it can read before it joins a family.</p><button id="privacy-check" class="ghost">Run privacy check</button></div>
    </section>`
  document.querySelector('#create-family').addEventListener('click', createFamily)
  document.querySelector('#join-family').addEventListener('click', joinFamily)
  document.querySelector('#privacy-check').addEventListener('click', runPrivacyCheck)
}

async function createFamily() {
  const displayName = document.querySelector('#create-display-name').value.trim()
  const babyName = document.querySelector('#baby-name').value.trim()
  if (!displayName || !babyName) return renderOnboarding('Enter both a parent name and a baby test name.')
  try {
    await ensureIdentity()
    const familyResult = await supabase.from('families').insert({ name: `${babyName}'s family`, created_by: currentUser.id }).select().single()
    if (familyResult.error) throw familyResult.error
    const familyId = familyResult.data.id
    const membershipResult = await supabase.from('family_members').insert({ family_id: familyId, user_id: currentUser.id, display_name: displayName })
    if (membershipResult.error) throw membershipResult.error
    const babyResult = await supabase.from('babies').insert({ family_id: familyId, name: babyName })
    if (babyResult.error) throw babyResult.error
    await loadFamilyContext()
  } catch (error) {
    renderOnboarding(error.message)
  }
}

async function joinFamily() {
  const displayName = document.querySelector('#join-display-name').value.trim()
  const familyId = document.querySelector('#join-family-id').value.trim()
  if (!displayName || !familyId) return renderOnboarding('Enter a parent name and the full family ID.')
  try {
    await ensureIdentity()
    const result = await supabase.from('family_members').insert({ family_id: familyId, user_id: currentUser.id, display_name: displayName })
    if (result.error) throw result.error
    await loadFamilyContext()
  } catch (error) {
    renderOnboarding(`Join failed: ${error.message}`)
  }
}

async function runPrivacyCheck() {
  try {
    await ensureIdentity()
    const results = await Promise.all([supabase.from('families').select('id'), supabase.from('babies').select('id'), supabase.from('events').select('id')])
    const failed = results.find((result) => result.error)
    if (failed) throw failed.error
    renderOnboarding(`Secure check: ${results[0].data.length} families, ${results[1].data.length} babies, ${results[2].data.length} events.`)
  } catch (error) {
    renderOnboarding(`Privacy check failed: ${error.message}`)
  }
}

async function loadFamilyContext() {
  try {
    const membershipResult = await supabase.from('family_members').select()
    if (membershipResult.error) throw membershipResult.error
    if (membershipResult.data.length === 0) return renderOnboarding('This identity has not joined a family yet.')
    const membership = membershipResult.data[0]
    const results = await Promise.all([supabase.from('families').select(), supabase.from('babies').select(), supabase.from('family_members').select(), supabase.from('events').select()])
    const failed = results.find((result) => result.error)
    if (failed) throw failed.error
    family = results[0].data.find((item) => item.id === membership.family_id)
    baby = results[1].data.find((item) => item.family_id === membership.family_id)
    members = results[2].data.filter((item) => item.family_id === membership.family_id)
    events = results[3].data.filter((item) => item.family_id === membership.family_id).sort((a, b) => new Date(b.started_at) - new Date(a.started_at))
    if (!family || !baby) throw new Error('The family or baby record is missing.')
    renderDashboard()
    subscribeToEvents()
  } catch (error) {
    renderFatal(error)
  }
}

function subscribeToEvents() {
  if (realtimeChannel) return
  realtimeChannel = supabase.channel('family-events').on('postgres_changes', { event: '*', schema: 'public', table: 'events' }, () => loadEvents()).subscribe()
}

async function loadEvents() {
  const result = await supabase.from('events').select()
  if (result.error) return showStatus(result.error.message, 'error')
  events = result.data.filter((item) => item.family_id === family.id).sort((a, b) => new Date(b.started_at) - new Date(a.started_at))
  renderDashboard()
}

function renderDashboard() {
  const lastFeed = events.find((event) => event.event_type === 'feed')
  const activeSleep = events.find((event) => event.event_type === 'sleep' && !event.ended_at)
  const todayStart = new Date()
  todayStart.setHours(0, 0, 0, 0)
  const nappyCount = events.filter((event) => event.event_type === 'nappy' && new Date(event.started_at) >= todayStart).length
  const sleepMilliseconds = events.filter((event) => event.event_type === 'sleep').reduce((total, event) => {
    const start = new Date(event.started_at)
    const end = event.ended_at ? new Date(event.ended_at) : new Date()
    const countedStart = start < todayStart ? todayStart : start
    return total + Math.max(0, end - countedStart)
  }, 0)
  const activity = events.slice(0, 20).map(renderEvent).join('')
  app.innerHTML = `
    <section class="shell">
      <header class="dashboard-header"><div><p class="eyebrow">${escapeHtml(family.name)}</p><h1>${escapeHtml(baby.name)}'s Today</h1></div><label class="family-code">Family ID<input readonly value="${escapeHtml(family.id)}" aria-label="Family ID" /></label></header>
      <section class="stats" aria-label="Today's summary"><article class="stat-card"><span>Last feed</span><strong>${lastFeed ? timeSince(lastFeed.started_at) : 'No feed yet'}</strong></article><article class="stat-card"><span>Sleep today</span><strong>${formatDuration(sleepMilliseconds)}</strong></article><article class="stat-card"><span>Nappies today</span><strong>${nappyCount}</strong></article></section>
      <section class="actions card" aria-label="Log an event"><button data-event="feed" class="primary">Log feed</button><button data-event="nappy" class="secondary">Log nappy</button><button id="sleep-button" class="sleep ${activeSleep ? 'active' : ''}">${activeSleep ? 'Stop sleep' : 'Start sleep'}</button></section>
      <p id="status" class="status" role="status"></p>
      <section class="card"><div class="section-heading"><h2>Shared activity</h2><span>Live</span></div><ol class="activity-list">${activity || '<li class="empty">No entries yet. Log the first feed, nappy, or sleep.</li>'}</ol></section>
    </section>`
  document.querySelectorAll('[data-event]').forEach((button) => button.addEventListener('click', () => logEvent(button.dataset.event)))
  document.querySelector('#sleep-button').addEventListener('click', toggleSleep)
}

async function logEvent(eventType) {
  await performAction(async () => {
    const result = await supabase.from('events').insert({ family_id: family.id, baby_id: baby.id, user_id: currentUser.id, event_type: eventType, started_at: new Date().toISOString() })
    if (result.error) throw result.error
  }, `${capitalize(eventType)} logged.`)
}

async function toggleSleep() {
  const activeSleep = events.find((event) => event.event_type === 'sleep' && !event.ended_at)
  await performAction(async () => {
    const result = activeSleep
      ? await supabase.from('events').update({ ended_at: new Date().toISOString() }).eq('id', activeSleep.id)
      : await supabase.from('events').insert({ family_id: family.id, baby_id: baby.id, user_id: currentUser.id, event_type: 'sleep', started_at: new Date().toISOString() })
    if (result.error) throw result.error
  }, activeSleep ? 'Sleep stopped.' : 'Sleep started.')
}

async function performAction(action, successMessage) {
  setActionsDisabled(true)
  try {
    await action()
    await loadEvents()
    showStatus(successMessage, 'success')
  } catch (error) {
    showStatus(error.message, 'error')
  } finally {
    setActionsDisabled(false)
  }
}

function setActionsDisabled(disabled) {
  document.querySelectorAll('.actions button').forEach((button) => { button.disabled = disabled })
}

function renderEvent(event) {
  const member = members.find((item) => item.user_id === event.user_id)
  const displayName = member ? member.display_name : 'Family member'
  const detail = event.event_type === 'sleep'
    ? event.ended_at ? `Sleep for ${formatDuration(new Date(event.ended_at) - new Date(event.started_at))}` : 'Sleep in progress'
    : capitalize(event.event_type)
  const timestamp = new Date(event.started_at).toLocaleString([], { weekday: 'short', hour: 'numeric', minute: '2-digit' })
  return `<li><div><strong>${escapeHtml(detail)}</strong><span>${escapeHtml(displayName)}</span></div><time datetime="${escapeHtml(event.started_at)}">${escapeHtml(timestamp)}</time></li>`
}

function timeSince(timestamp) {
  const minutes = Math.max(0, Math.floor((Date.now() - new Date(timestamp)) / 60000))
  if (minutes < 1) return 'Just now'
  if (minutes < 60) return `${minutes} min ago`
  const hours = Math.floor(minutes / 60)
  const remainder = minutes % 60
  return remainder ? `${hours}h ${remainder}m ago` : `${hours}h ago`
}

function formatDuration(milliseconds) {
  const totalMinutes = Math.max(0, Math.floor(milliseconds / 60000))
  const hours = Math.floor(totalMinutes / 60)
  const minutes = totalMinutes % 60
  if (hours === 0) return `${minutes} min`
  return minutes ? `${hours}h ${minutes}m` : `${hours}h`
}

function capitalize(value) { return value.charAt(0).toUpperCase() + value.slice(1) }
function showStatus(message, type) {
  const status = document.querySelector('#status')
  if (!status) return
  status.textContent = message
  status.className = `status ${type}`
}
function renderFatal(error) {
  app.innerHTML = `<section class="shell narrow"><div class="card stack"><p class="eyebrow">Something stopped the app</p><h1>Check the setup</h1><p>${escapeHtml(error.message)}</p><button id="retry" class="primary">Try again</button></div></section>`
  document.querySelector('#retry').addEventListener('click', () => window.location.reload())
}
function escapeHtml(value) {
  return String(value).replace(/[&<>'"]/g, (character) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', "'": '&#39;', '"': '&quot;' })[character])
}

What does the application code handle?

  • The startup flow restores an existing anonymous session or renders onboarding.
  • Family actions create or join protected database rows.
  • The privacy check queries all three family data areas before the identity joins.
  • The dashboard logs events and updates sleep records through secured queries.
  • The Realtime channel reloads events after database changes.
:root { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #18332a; background: #f5f1e8; font-synthesis: none; text-rendering: optimizeLegibility; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at top left, rgba(240, 190, 92, 0.28), transparent 32rem), #f5f1e8; }
button, input { font: inherit; }
button { min-height: 3rem; border: 0; border-radius: 1rem; padding: 0.8rem 1rem; font-weight: 750; cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.6; }
input { width: 100%; min-height: 3rem; margin-top: 0.4rem; border: 1px solid #c9d2cc; border-radius: 0.8rem; padding: 0.75rem; color: #18332a; background: #fff; }
label { display: grid; gap: 0.2rem; color: #345247; font-size: 0.92rem; font-weight: 700; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0.55rem; font-size: clamp(2rem, 7vw, 3.4rem); line-height: 0.98; letter-spacing: -0.05em; }
h2 { margin-bottom: 0.8rem; font-size: 1.1rem; }
code { padding: 0.1rem 0.35rem; border-radius: 0.35rem; background: #edf2ef; }
.shell { width: min(100% - 1.5rem, 48rem); margin: 0 auto; padding: 1.2rem 0 3rem; }
.shell.narrow { width: min(100% - 1.5rem, 34rem); }
.hero, .dashboard-header { padding: 1.2rem 0 1rem; }
.hero p:last-child, .dashboard-header p { color: #567166; }
.eyebrow { margin-bottom: 0.45rem; color: #567166; font-size: 0.75rem; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.card, .stat-card { border: 1px solid rgba(63, 108, 91, 0.14); border-radius: 1.2rem; background: rgba(255, 255, 255, 0.92); box-shadow: 0 0.8rem 2rem rgba(32, 57, 48, 0.08); }
.card { margin-bottom: 1rem; padding: 1rem; }
.stack { display: grid; gap: 0.9rem; }
.primary { color: #fff; background: #3f6c5b; }
.secondary { color: #18332a; background: #f0be5c; }
.ghost { color: #315548; border: 1px solid #9fb4ab; background: #fff; }
.notice, .status.success { color: #204b3b; border: 1px solid #a8cdbf; border-radius: 0.85rem; padding: 0.8rem; background: #eaf6f1; }
.dashboard-header { display: grid; gap: 1rem; }
.family-code input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.65rem; margin-bottom: 1rem; }
.stat-card { min-height: 7rem; padding: 0.85rem; }
.stat-card span, .activity-list span, .activity-list time { display: block; color: #6c8178; font-size: 0.78rem; }
.stat-card strong { display: block; margin-top: 0.55rem; font-size: clamp(1rem, 4vw, 1.35rem); }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.65rem; }
.sleep { color: #fff; background: #6a5c91; }
.sleep.active { background: #9a4c4c; }
.status { min-height: 1.25rem; margin: 0 0 0.75rem; font-size: 0.9rem; }
.status.error { color: #9a2f2f; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-heading span { color: #315548; border-radius: 999px; padding: 0.25rem 0.55rem; background: #dcece5; font-size: 0.72rem; font-weight: 800; }
.activity-list { margin: 0; padding: 0; list-style: none; }
.activity-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 0; border-top: 1px solid #e5ebe7; }
.activity-list li:first-child { border-top: 0; }
.activity-list time { flex: 0 0 auto; text-align: right; }
.activity-list .empty { color: #6c8178; }
.loading { padding: 3rem 1rem; text-align: center; }
@media (min-width: 42rem) { .dashboard-header { grid-template-columns: 1fr minmax(16rem, 0.8fr); align-items: end; } }
@media (max-width: 34rem) { .stats, .actions { grid-template-columns: 1fr; } .stat-card { min-height: auto; } }

What does the stylesheet cover?

The styles support onboarding forms, Today cards, event buttons, status messages, and the shared activity list. The responsive rules collapse the dashboard controls into one column on narrow screens.

How does the shared version differ?

The in-memory array has been replaced by queries against protected Supabase tables. The interface still exposes the same tracking actions, but every saved event now belongs to an authenticated user and family.

The app also gains family onboarding, a privacy test, error states, and a subscription that listens for database event changes.

The connection values deserve a careful check because a wrong key can block every request. You are using the low-privilege publishable key, so the database policies remain in control.

  • Open the project's Connect dialog in the Supabase Dashboard.
  • Copy the Project URL.
  • Return to Claude Code.
  • Ask Claude Code to create .env.local as a copy of .env.example.
  • Replace the Project URL placeholder in .env.local with the copied Project URL.
  • Return to the Connect dialog.
  • Copy the publishable key.
  • Replace the publishable-key placeholder in .env.local with the copied publishable key.

Keep the local file private

The *.local entry in .gitignore keeps .env.local out of Git. Keep the placeholder-only .env.example as the shareable configuration guide.

Restart and prove the privacy boundary

Vite reads environment files when the development server starts. Restarting now loads the real Supabase connection and gives the updated app its first database-backed run.

  • Leave Claude Code and return to the shell prompt in baby-tracker.
  • Install the new Supabase dependency by running:
npm install

What does this command install?

The command reads package.json and installs @supabase/supabase-js at the pinned version. It also updates the local dependency tree for the rewritten app.

You should see an installation summary with no dependency failure. The Supabase browser client is now available to src/main.js.

Did the dependency installation fail?

Check that the shell prompt is inside the existing baby-tracker folder. The folder must contain the updated package.json.

Confirm that the dependency entry spells @supabase/supabase-js exactly and uses version 2.119.0.

Help me fix the Supabase package installation.

  • Start the updated development server by running:
npm run dev

What happens during this restart?

Vite loads .env.local and exposes the two prefixed values to the browser build. Tiny Log uses them to initialize its Supabase client.

  • Close every Private window left from the local-only test.
  • Open a fresh Private window.
  • Visit http://localhost:5173 in that window.

You should see the Tiny Log onboarding screen with sections for creating a family, joining a family, and testing privacy.

Before you run the check, how many families, babies, and events do you think this unjoined identity can read?

  • Click Run privacy check.

You should see Secure check: 0 families, 0 babies, 0 events. The browser has an authenticated identity, but Row Level Security gives it no family data.

That is the security boundary working. Tiny Log can now share data with family members while an unjoined identity sees an empty database.

Privacy check failed?

If Tiny Log asks for its connection, confirm that .env.local contains the real Project URL and publishable key. Restart the development server after correcting either value.

If the check reports a database error, confirm that anonymous sign-ins are enabled and that the complete supabase.sql script ran successfully.

Help me debug the zero-row privacy check.

Your tracker now has authenticated shared storage with a database-enforced privacy boundary. Next, you will create two parent identities and prove that family entries move between them in realtime.

Prove Realtime Sharing and Privacy

Your local Vite app is connected to Supabase. Its Row Level Security rules already returned zero rows to an unjoined identity.

A database connection alone does not prove a protected shared workflow. You will test Realtime between two family members while a third identity remains locked out.

In this step, get ready to:
  • Create a shared family as Parent A.
  • Join the shared family as Parent B.
  • Prove live event delivery while a third identity receives zero rows.
Create Parent A's family

The normal browser window keeps Parent A's identity in its existing browser storage. Creating the family there gives the next session a shared destination.

  • Return to the normal browser window where Tiny Log is already open.
  • Enter Parent A in the Your display name field.
  • Enter Sam in the Baby's test name field.
  • Click Create family.

You should see Sam's Today above three summary cards. The dashboard also shows the Family ID.

  • Record the displayed Family ID here: your displayed family ID.

Strong start: Parent A's family timeline is ready for Parent B.

Join as Parent B and test realtime

A Private window gives Tiny Log separate browser storage. Tiny Log uses anonymous authentication to create a distinct identity for Parent B.

  • Use your browser's main menu to open a new private-browsing window.
  • Visit http://localhost:5173 in the Private window.
  • Enter Parent B in the Your display name field.
  • Paste your displayed family ID into the Family ID field.
  • Click Join family.

Parent B should see Sam's Today with the same family timeline. This confirms the second identity joined the protected family.

Before you log the next entry, do you expect Parent A's normal window to update without a refresh?

  • Place the Parent A window beside the Parent B window.
  • Click Log nappy in Parent B's Private window.

Within a moment, Parent A's activity list should show Nappy credited to Parent B. No refresh is needed.

That live Nappy entry proves the database change reached the other identity.

  • Return to Parent A's normal window.
  • Click Start sleep.
  • Wait a few seconds.
  • Click Stop sleep.
  • Click Log feed.

Parent B's Private window should add Parent A's completed Sleep entry. It should also add Parent A's Feed entry without a refresh.

The normal window's activity list should now contain entries credited to Parent A and Parent B. The Last feed card should show Just now.

No live Nappy entry in Parent A's window?

  • Compare the Family ID shown in both dashboards.
  • Confirm the Vite terminal still shows the local server as running.
  • Refresh Parent A's page once.

An entry that appears only after a refresh confirms the database write. It also exposes a problem with the realtime subscription.

Help me troubleshoot the missing realtime update.

Prove the third identity stays private

Closing every Private window deliberately ends Parent B's temporary identity. That anonymous identity cannot be recovered after its browser storage disappears.

The shared events remain in the family timeline. A new Private window gives the privacy check a third identity.

  • Close every Private window.
  • Use your browser's main menu to open one new private-browsing window.
  • Visit http://localhost:5173 in the new Private window.

Before you run the check, do you think this fresh identity can read the earlier shared rows?

  • Click Run privacy check.

You should see Secure check: 0 families, 0 babies, 0 events. That zero-row result is the privacy boundary holding for a complete stranger.

Privacy check shows existing rows?

  • Close every Private window to discard the earlier session.
  • Open one new private-browsing window from your browser's main menu.
  • Visit http://localhost:5173.
  • Click Run privacy check again.
  • Stop the test if the fresh identity still reads any rows.

Help me investigate the failed privacy boundary.

  • Close the third identity's Private window.

Before you return to Parent A's normal window, do you expect Parent B's earlier Nappy entry to remain in the shared timeline?

  • Return to Parent A's normal window.

Parent B's Nappy entry should still appear beside Parent A's Sleep and Feed entries. Both parent names should remain visible in the activity list.

What do these checks prove?

Parent B's Nappy appearing in Parent A's window without a refresh proves realtime database delivery.

The third identity's zero-row result proves that Row Level Security blocks non-members.

Parent B's entry remaining after the Private session closes proves that the timeline lives in the shared database.

You have proved that Tiny Log shares live updates between family members while protecting the timeline from outsiders. Next, you will deploy that protected workflow for two physical devices.

Deploy and Test on Two Devices

Your secured Supabase timeline now contains entries from Parent A and Parent B. Your privacy check also proves a third identity reads zero family rows.

The local Vite URL cannot serve as a real shared household tool. In this step, you'll use Vercel to put Tiny Log online for a two-device test.

In this step, get ready to:
  • Configure the project for a pinned Vercel deployment.
  • Create a temporary deployment and claim it with a Vercel Hobby account.
  • Prove two-direction updates across two test devices.
Add the Vercel deployment setup

The Vercel CLI becomes a development dependency inside your project. Pinning version 65.15.0 ensures Claude Code installs the exact deployment tool used by this project.

  • Switch back to the authenticated Claude Code session for baby-tracker.
  • Ask Claude Code to update package.json to match the exact target below.
{
  "name": "tiny-log-baby-tracker",
  "private": true,
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "deploy": "vercel deploy --temporary"
  },
  "dependencies": {
    "@supabase/supabase-js": "2.119.0"
  },
  "devDependencies": {
    "vercel": "65.15.0",
    "vite": "8.3.8"
  }
}

What does this configuration do?

  • The vercel dependency adds the deployment CLI to this project.
  • The deploy script creates a temporary production deployment.
  • The existing Vite and Supabase dependencies remain pinned to their project versions.
  • Approve Claude Code's edit to package.json.
  • Install the updated project dependencies by running:
npm install

What does this command do?

The command reads package.json and installs its pinned packages. It also updates the project's dependency lock data.

You'll see npm process the dependency list. The terminal returns to its prompt when installation finishes.

Good progress. Your project can now create a Vercel deployment through its npm script.

Did the dependency installation fail?

Confirm that the terminal is inside the baby-tracker folder. Check that package.json matches the target above.

A network interruption can also stop package downloads. Restore the connection before running the installation again.

Help me troubleshoot the Vercel CLI installation.

✔️ Awesome, I've got everything!

Great. Your saved package.json now includes the pinned deployment dependency and script.

ⓧ I'd like to double check the full code

{
  "name": "tiny-log-baby-tracker",
  "private": true,
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "deploy": "vercel deploy --temporary"
  },
  "dependencies": {
    "@supabase/supabase-js": "2.119.0"
  },
  "devDependencies": {
    "vercel": "65.15.0",
    "vite": "8.3.8"
  }
}
Deploy and claim Tiny Log

A temporary production deployment gives Tiny Log an internet URL without requiring an account first. The deployment expires unless you claim it.

This account step links the deployment to you. Vercel Hobby costs $0/mo., so claiming the project does not add a paid subscription.

Before you deploy, do you expect the new URL to persist before you claim it?

  • Create the temporary production deployment by running:
npm run deploy

What does this command do?

The npm script runs vercel deploy --temporary from your local dependency. Vercel builds the app as a production deployment.

The command prints a deployment URL and a claim URL. The claim URL is what makes the temporary project persistent.

You'll see Vercel report its deployment progress. The final output includes both URLs.

  • Open the claim URL printed by the deployment command.
  • Create or sign in to a Vercel Hobby account.
  • Follow the account page prompt to claim the deployment.
  • Record the claimed production URL here: your claimed Vercel URL.

You should see the deployment associated with your Vercel Hobby account. The temporary expiry no longer applies to the claimed project.

That's the deployment secured. Tiny Log now has a persistent URL that your test devices can reach.

Could not claim the deployment?

Use the claim URL from the most recent deployment output. Confirm that you completed the Vercel account sign-in in the same browser tab.

If the page cannot load, check your internet connection before reopening the claim URL.

Help me claim my temporary Vercel deployment.

Run the two-device test

The claimed Vercel URL uses a different browser origin from localhost. Each test device therefore receives a fresh identity through anonymous authentication.

A fresh deployed family gives both devices access to the same protected timeline. Events from either parent should reach the other device without a refresh.

  • Open your claimed Vercel URL on Device A in Safari or Chrome.
  • Enter Parent A in the Your display name field.
  • Enter Sam in the Baby's test name field.
  • Click Create family.

You'll see the deployed dashboard for Sam. A new family ID appears in the dashboard header.

  • Record the deployed family ID here: your deployed family ID.

Why create a fresh family?

Anonymous identities live in browser storage for one origin. The identities used on localhost do not move to the claimed Vercel URL.

Creating a deployed family proves the complete workflow under the same origin your household devices use.

  • Open your claimed Vercel URL on Device B in Safari or Chrome.
  • Enter Parent B in the Your display name field.
  • Paste your deployed family ID into the Family ID field.
  • Click Join family.

Device B now shows the same deployed family dashboard as Device A.

Before you test, do you expect each device to receive the other parent's event without a refresh?

  • Click Log feed on Device A.

On Device B, you'll see the Feed entry credited to Parent A without refreshing the page.

  • Click Log nappy on Device B.

On Device A, you'll see the Nappy entry credited to Parent B without refreshing the page. The two observations prove live updates work in both directions.

Did one device miss an update?

Confirm that both devices show the same family ID. Check that each device still has an internet connection.

If one parent name is missing, confirm that Device B joined the deployed family before logging its event.

Help me troubleshoot the two-device update test.

  • Scroll Device A until the family ID is outside the visible screen.
  • Capture a screenshot of the shared activity list showing entries credited to Parent A and Parent B.

You've done it. Tiny Log now works as a claimed two-device household tracker. Its activity list proves both parents can contribute without refreshing.

Secret mission

Put Tiny Log on Both Home Screens

Give Tiny Log a home-screen icon on both test devices. Launch the tracker from each icon. Then prove that a Feed from one device and a Nappy from the other still synchronize without refreshing.

Clean Up Your Resources

Clean Up Your Resources

Tiny Log currently costs $0 to keep within the included Supabase Free and Vercel Hobby limits. Choose whether to keep every resource available, pause the backend for later, or delete the project.

Resources you used:

  • One Supabase Free project containing the families, family_members, babies, and events tables, anonymous authentication users, security policies, and realtime configuration.
  • One claimed Vercel Hobby project with the persistent Tiny Log production deployment URL.
  • One local baby-tracker folder containing the application files, node_modules, .env.local, and supabase.sql.
  • One iPhone home-screen Tiny Log icon and one Android home-screen Tiny Log icon.

Keep everything running

Choose this option while you are still using Tiny Log. The deployment, shared timeline, home-screen icons, local project, and final screenshot stay available.

  • Leave the Tiny Log Supabase Free project active.
  • Leave the claimed Vercel Hobby deployment available at its production URL.
  • Keep the baby-tracker folder on your Desktop.
  • Keep both Tiny Log home-screen icons for quick access.
  • Store the final two-parent screenshot as proof of the completed realtime test.
  • Expect Supabase Free to pause the project after one week of inactivity.

Pause - I'll come back to this later

Use this option when you want to preserve the project without active backend use. The claimed Vercel deployment can remain available while the Supabase project is paused.

  • Pause the Tiny Log Supabase project from its project dashboard.
  • Confirm the project status shows that the Supabase project is paused.
  • Leave the claimed Vercel Hobby deployment available.
  • Keep the baby-tracker folder on your Desktop.
  • Keep both Tiny Log home-screen icons and the final two-parent screenshot.
  • Resume the Tiny Log Supabase project from its dashboard when you return.

Delete - I don't want to use this again

Pick this option when you are finished with Tiny Log. Deleting the Supabase project permanently removes its protected data and anonymous users, so treat this as the irreversible choice.

Preserve your result:

  • Save the final two-parent screenshot somewhere outside the baby-tracker folder.

Delete the cloud projects:

  • Select the Tiny Log project in the Supabase Dashboard.
  • Open the project's settings area.
  • Use the project deletion control to permanently delete the Supabase project.
  • Confirm the Supabase Dashboard no longer lists the Tiny Log project.
  • Select the claimed Tiny Log Hobby project in the Vercel dashboard.
  • Open the project's settings area.
  • Use the project deletion control to permanently delete the Vercel project.
  • Confirm the claimed production URL no longer serves Tiny Log.

Remove the remaining local items:

  • Remove the Tiny Log icon from the iPhone home screen through the device's shortcut-removal controls.
  • Remove the Tiny Log icon from the Android home screen through the device's shortcut-removal controls.
  • Permanently delete the baby-tracker folder from your Desktop with your operating system's file manager.
  • Confirm the baby-tracker folder no longer appears on your Desktop.

Nice Work!

Nice Work!

You made it! You turned Tiny Log into a deployed baby tracker where two parents can securely log care from separate devices.

You've learned how to:

  • Build a mobile-first baby tracker that logs Feed or Nappy events with one tap. Add a start-stop Sleep timer with a live Today summary.
  • Create two parent identities through anonymous authentication. Protect their shared Supabase timeline with Row Level Security. Prove a third identity can read zero family data.
  • Deploy Tiny Log to a claimed Vercel Hobby URL. Prove realtime synchronization works in both directions across two physical devices. Capture an activity list with entries from both parent identities.
  • Secret Mission: Launched Tiny Log from home-screen icons on iPhone and Android. Repeated the two-direction Feed and Nappy test without refreshing.

Ready to quiz yourself?