What this app teaches
Twelve small lessons from building the Job Tracker, each with the file to read and the official docs.
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. 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. 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. 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. 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. Never trust data you did not just create
Backup files and even localStorage can hold old or broken data, so both go through one normalizeApplication function. Unknown statuses fall back to 'Applied', bad dates are dropped, and older records get the new fields as empty values.
src/features/jobs/validation.ts
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. Use the browser's own <dialog> for modals
showModal() gives a backdrop, keeps keyboard focus inside the dialog, and closes on Escape, with no extra library. The form, the details view, and every confirmation use it.
src/features/ui/modal.tsx
9. Never define a component inside another component
The form's Field helper was first written inside ApplicationForm. Each re-render made it a new component type, so React rebuilt the inputs and wiped what the user typed. Moving it outside fixed it.
src/features/jobs/application-form.tsx
10. A scroll box needs position: relative
The board scrolls sideways on phones. Its screen-reader-only labels use position: absolute, and without 'relative' on the scroll box they escaped it and made the whole page scroll. A browser test caught it.
src/features/jobs/kanban-board.tsx
11. Undo is kinder than 'Are you sure?'
Deleting asks once, then shows a toast with Undo that puts the same record back in the same place. Toasts use aria-live so screen readers announce them.
src/features/ui/toasts.tsx
12. 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