beginner · 23 minute study
Ask where and when this code runs
The same JavaScript syntax can run during a build, on a request server or inside a browser. Confusing those locations creates broken builds and misplaced trust.
Useful preparation · 1 prerequisite
Use this as a map, not a lock. If these ideas are familiar, continue.
- One thread can still have overlapping operations — Understand why a seemingly valid read-check-write sequence can fail when operations interleave, and why a UI check does not protect a shared database.
First, build a mental model
A runtime supplies capabilities. A browser has a document and user input; a build process emits files; a trusted request runtime can make private decisions for each request.
- Label both location and time: build-time execution is different from per-request execution even if both happen outside the browser.
- Browser modules can use browser APIs when actually running in the browser. Client Components may also be prerendered, so reading window during module evaluation or initial render is not automatically safe.
- A Server Component can run at build time for a static route. Its name alone does not imply there is a server available after deployment.
- Anything serialized into HTML, component data or a JavaScript bundle is delivered to the user. A server-side origin does not make emitted data private.
{
"build": ["read public curriculum", "emit HTML and assets"],
"requestServer": ["verify actor", "authorize protected write"],
"browser": ["handle pointer input", "save local practice history"]
}
- Before hosting
The build reads safe curriculum data and produces files that can be served repeatedly.
- At a protected request
A live trusted runtime would verify identity and authority; an exported HTML file cannot perform that private decision.
- In the learner's tab
JavaScript handles input and local progress. The learner controls that browser and its storage.
Production thinking
Take this beyond the example.
Draw execution boundaries before choosing libraries or hosting. LearnLab's public curriculum and browser-local learning fit static hosting; a private write API would need a separate justified trusted runtime.
Sources and further reading
Your evidence
unseen is a local learning signal, not a credential or proof of production competence.
Explain the mental model, then explicitly acknowledge it. Opening a page is not evidence.
Supported retries can complete this lesson. Independent evidence and delayed review determine the skill stage.
Next lesson · Read an App Router application as a route tree →