The app

Its screens by route, one store they share, the toasts, light and dark

5 min readWritten for your agentMarkdown

Start a new app here: it makes the screen recipes one app. node goop/agent/start.mjs writes the files below and the frame (README, "Start here"). By hand: copy the three files below whole, at the paths their first lines name, beside the frame recipe's two (src/screens/frame.tsx and the app's router, src/screens/router.ts, docs/screen-frame.md); then write each screen from its recipe in src/screens/ and give it its route: a screen is its one import and its one route line in App.tsx (if (page === 'notes') return <NotesScreen />;), and its place in the frame's NAVIGATION. A route with no screen shows the frame's "No page here". With a sign-in, the account recipe's three lines go into App.tsx too (docs/screen-account.md: its import, the /profile route and <SignedIn> round the screens); an app with no sign-in leaves them out. App.tsx holds the store round every screen, the one <Toaster /> and the scroll to the top on a new route (on a phone the page scrolls). The sample rows live in sample.ts, read through the store: in a screen, const { notes, updateNote } = useStore(); (from ./store), so a note changed on one screen shows on every other. Swap the rows for your data, or your API's first answer, in that one file.

To open in the kept light or dark mode with no flash, put this in index.html's <head>; the frame's rail holds the switch (ColorModeToggle), which keeps the choice under the same key:

HTML
<script>
  try { var colorMode = localStorage.getItem('theme'); } catch (e) {}
  document.documentElement.classList.toggle('dark', colorMode === 'dark' ||
    (colorMode !== 'light' && matchMedia('(prefers-color-scheme: dark)').matches));
</script>
Show the code57 lines
TSX
// src/screens/sample.ts: the app's sample rows, in one place: swap them for your data
// ---- the sample data: swap it for yours
export const PEOPLE = ['Teodora Valk', 'Bilal Rashed', 'Ngozi Ilori', 'Dagny Holm', 'Cormac Foley'] as const;

export interface Note {
  id: string;
  title: string;
  /** The day it was last changed, `YYYY-MM-DD`. */
  updated: string;
  owner: (typeof PEOPLE)[number];
  pinned: boolean;
  /** The note's words, as its page shows and edits them. */
  text?: string;
}

export const NOTES: readonly Note[] = [
  {
    id: 'FW-121',
    title: 'Hedgerow planting plan',
    updated: '2026-11-23',
    owner: 'Teodora Valk',
    pinned: true,
    text: 'Hawthorn and hazel along the north edge, one row a metre apart.',
  },
  {
    id: 'FW-117',
    title: 'Soil sample results',
    updated: '2026-11-21',
    owner: 'Dagny Holm',
    pinned: false,
    text: 'The lower beds read slightly acid; lime before the spring sowing.',
  },
  {
    id: 'FW-112',
    title: 'Drainage survey debrief',
    updated: '2026-11-19',
    owner: 'Ngozi Ilori',
    pinned: false,
    text: 'The east ditch holds water after rain: clear the culvert first.',
  },
  {
    id: 'FW-110',
    title: 'Riverside orchards check-in',
    updated: '2026-11-17',
    owner: 'Bilal Rashed',
    pinned: false,
    text: 'Apples set well; two old pear trees need a hard prune.',
  },
  {
    id: 'FW-108',
    title: 'Greenhouse layout review',
    updated: '2026-11-12',
    owner: 'Cormac Foley',
    pinned: false,
    text: 'Benches along the south wall, the propagator by the door.',
  },
];
Show the code36 lines
TSX
// src/screens/store.tsx: what every screen shares, held once, so a change on one screen shows on all
import { createContext, type ReactNode, useContext, useMemo, useState } from 'react';
import { NOTES, type Note } from './sample';

interface Store {
  /** Every note, as the screens show it. */
  notes: readonly Note[];
  /** Changes one note (its title, its words, pinned or not): every screen showing it follows. */
  updateNote: (id: string, change: Partial<Omit<Note, 'id'>>) => void;
  /** Puts a new note at the top (a create dialog's result). */
  addNote: (note: Note) => void;
}

const StoreContext = createContext<Store | null>(null);

/** The store for the screens under it: mounted once, in `App.tsx`, round them all. */
export function StoreProvider({ children }: { children: ReactNode }) {
  const [notes, setNotes] = useState(NOTES);
  const store = useMemo<Store>(
    () => ({
      notes,
      updateNote: (id, change) =>
        setNotes((now) => now.map((note) => (note.id === id ? { ...note, ...change } : note))),
      addNote: (note) => setNotes((now) => [note, ...now]),
    }),
    [notes],
  );
  return <StoreContext value={store}>{children}</StoreContext>;
}

/** The store, in any screen: `const { notes, updateNote } = useStore();`. */
export function useStore(): Store {
  const store = useContext(StoreContext);
  if (!store) throw new Error('useStore() needs <StoreProvider> round the screens, in App.tsx');
  return store;
}
Show the code80 lines
TSX
// src/App.tsx: the app, its screens by route, the store round them and the toasts' one region
import { type ReactNode, useEffect, useRef } from 'react';
import { AppFramePanel } from '@/components/goop/patterns/app-frame';
import { PageBody } from '@/components/goop/patterns/page-body';
import { Button } from '@/components/ui/goop/button';
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyTitle } from '@/components/ui/goop/empty';
import { Toaster } from '@/components/ui/goop/toast';
import BoardScreen from './screens/board';
import ChatScreen from './screens/chat';
import { ScreenFrame, ScreenTopBar } from './screens/frame';
import InboxScreen from './screens/inbox';
import NoteScreen from './screens/note';
import NotesScreen from './screens/notes';
import OverviewScreen from './screens/overview';
import { go, useRoute } from './screens/router';
import ScheduleScreen from './screens/schedule';
import SettingsScreen from './screens/settings';
import SitesScreen from './screens/states';
import { StoreProvider } from './screens/store';
import VisitsScreen from './screens/visits';

/** The screen a route shows: one a place of the frame's rail, and a record's page by its id. */
function screenFor(route: string): ReactNode {
  // a screen is its route line here and its import above
  const at = route.split('/');
  const page = at[1];
  if (page === '') return <OverviewScreen />;
  // a note's own page (`/notes/FW-121`) reads its note by the id in the route
  if (page === 'notes' && at[2]) return <NoteScreen key={at[2]} />;
  if (page === 'notes') return <NotesScreen />;
  if (page === 'inbox') return <InboxScreen />;
  if (page === 'calendar') return <ScheduleScreen />;
  if (page === 'board') return <BoardScreen />;
  if (page === 'chat') return <ChatScreen />;
  if (page === 'sites') return <SitesScreen />;
  if (page === 'visits') return <VisitsScreen />;
  // the settings cover the app, its frame too: they are drawn in the frame's place
  if (page === 'settings') return <SettingsScreen />;
  return <NotFoundScreen key={page} />;
}

/** A route the app has no screen for: said in the frame, with the way back. */
function NotFoundScreen() {
  return (
    <ScreenFrame>
      <AppFramePanel header={<ScreenTopBar title="Not found" />}>
        <PageBody variant="wide">
          <Empty>
            <EmptyHeader>
              <EmptyTitle asChild>
                <h1>No page here</h1>
              </EmptyTitle>
              <EmptyDescription>The link may be old, or the page has moved.</EmptyDescription>
            </EmptyHeader>
            <EmptyContent>
              <Button onClick={() => go('/')}>Back to the start</Button>
            </EmptyContent>
          </Empty>
        </PageBody>
      </AppFramePanel>
    </ScreenFrame>
  );
}

export default function App() {
  const route = useRoute();
  // On a phone the document scrolls under the top bar: a new route opens at its top (the first is left where it is).
  const shown = useRef(route);
  useEffect(() => {
    if (shown.current === route) return;
    shown.current = route;
    if (document.scrollingElement) document.scrollingElement.scrollTop = 0;
  }, [route]);
  return (
    <StoreProvider>
      {screenFor(route)}
      <Toaster />
    </StoreProvider>
  );
}

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.