Question presented to candidate: "Walk me through how a URL like /blog/my-post maps to files in the app directory. What happens to a helper file or a components folder that sits next to page.tsx?"
What a strong answer should cover:
- Folders define URL segments; a route is public only when the folder contains a
pagefile (or aroutefile for an API endpoint). - Other files in the folder (components, utils, styles) are colocated safely and never become routes.
- Dynamic segments use brackets:
[slug], catch-all[...slug], optional catch-all[[...slug]]. - Route groups
(name)organise folders without adding a URL segment; private folders_nameopt out of routing entirely. - Special files in a segment (layout, loading, error, not-found) add UI around the page for that segment and below.
Clarifying questions expected:
- "Is this App Router or Pages Router?" β in the Pages Router every file under pages/ is a route.
- "Should shared layouts apply to a subset of pages?" β that is what route groups are for.
Code / implementation expected: Yes β a small app tree and the URLs it produces.