← Back to the tracker

What this app teaches

Eight small lessons from building the Job Tracker, each with the file to read and the official docs.

  1. 1. Keep data in the browser with localStorage

    There is no server or database. Applications are saved as JSON text in localStorage, so they stay after a reload but only on this browser.

    src/features/jobs/storage.ts

  2. 2. Read outside data in React with useSyncExternalStore

    localStorage lives outside React. useSyncExternalStore reads it safely: the server renders an empty list, the browser shows the saved list, and there is no hydration error.

    src/features/jobs/use-applications.ts

  3. 3. Read a whole form with FormData

    Instead of one state variable per field, the form reads every field at once when it is submitted. Only 'Found on' is kept in state, so pasting a link can change it.

    src/features/jobs/application-form.tsx

  4. 4. Match a link's website safely

    new URL(link).hostname gives the website name. Checking hostname.endsWith('.indeed.com') is safe; checking link.includes('indeed') can be fooled by look-alike sites.

    src/features/jobs/detect-source.ts

  5. 5. Calculate, don't store, what you can derive

    Counts, the filtered list, and due follow-ups are calculated from the list on every render. Keeping them in separate state would let them get out of sync.

    src/features/jobs/filters.ts

  6. 6. Never trust an imported file

    A backup file can come from anywhere, so every field is checked. Unknown statuses fall back to 'Applied' and bad dates are dropped before anything is saved.

    src/features/jobs/backup.ts

  7. 7. Test the logic with Vitest

    The pure functions (no React) are easy to test. Each test file sits next to the code it tests. Run them with pnpm test.

    src/features/jobs/*.test.ts

  8. 8. Ship it as a static site

    output: 'export' turns the app into plain HTML, CSS, and JS files that any static host can serve. Partial prerendering (PPR) does not work in export mode, so it is turned off.

    next.config.ts