What are Next.js Route Groups and a practical use case?
Tests App Router conventions organizing routes without changing URLs. A good answer names parenthesized folders like (shop) removed from the path, cites multiple layouts per section, and keeps URLs clean. Red flag: confusing them with dynamic [slug] segments.
What's really being asked
This question tests whether you understand the App Router file-system conventions beyond basic nested folders. Specifically, the interviewer wants to know if you recognize that folders normally map to URL segments, and that Route Groups are the exception. They are also checking if you can use this feature to solve real architectural problems like sharing layouts across sections or organizing code by domain without affecting the public URL structure.
The full answer
A strong response starts by defining Route Groups as folders wrapped in parentheses such as (marketing) or (shop) that are completely omitted from the URL path. Next, it explains that these groups let you apply different root layouts to different parts of an application without introducing extra path segments. Then it provides a practical use case, such as splitting a project into (marketing) and (app) directories where each has its own layout.tsx but routes inside them remain at top-level URLs like / and /dashboard. Finally, it notes that Route Groups can be nested and that a group can contain its own layout.js, loading.js, or error.js files that only affect the routes within that group.
The mistakes people make
Candidates often confuse Route Groups with dynamic segments like [id] or [...catchAll], or they claim that the parenthesized folder name appears in the URL. Another red flag is suggesting Route Groups work in the Pages Router; they are an App Router convention only. Some engineers also incorrectly state that Route Groups affect caching behavior or SEO, or they propose using them as a replacement for middleware when the goal is simply URL rewriting.
What usually comes next
An interviewer might ask how you would create multiple root layouts for different sections of a site, or whether you can nest Route Groups inside one another. They may also ask how Route Groups interact with Parallel Routes and Intercepting Routes, or challenge you to explain what happens when a route belongs to multiple groups. Another common follow-up is when to choose a Route Group over a standard layout file in a non-grouped folder.
A concrete example
Consider an e-commerce application where the browsing experience needs a rich navigation header but the checkout flow needs a minimal distraction-free layout. You create app/(shop)/layout.tsx with the full header and place app/(shop)/page.tsx so the homepage lives at /. Separately, you create app/(checkout)/layout.tsx with a slim header and place app/(checkout)/cart/page.tsx so the cart lives at /cart. The (shop) and (checkout) names never appear in the browser address bar, yet each section maintains independent layouts and clean file colocation.
Interview question
Which file structure gives /about and /dashboard independent root layouts without extra URL segments in Next.js App Router?
- a.app/(marketing)/about/page.tsx and app/(app)/dashboard/page.tsx, each group with its own layout.tsxCorrect
- b.app/marketing/about/page.tsx and app/app/dashboard/page.tsx, each folder with its own layout.tsx
- c.app/[marketing]/about/page.tsx and app/[app]/dashboard/page.tsx, each segment with its own layout.tsx
- d.app/about/page.tsx and app/dashboard/page.tsx, each with a local layout.tsx but sharing app/layout.tsx
Why? this is the answer
Route Groups use parentheses to organize routes and can each define a root layout, while the group name is omitted from the URL. Option D is tempting but wrong because local layouts are nested and still inherit the single app root layout.
Just read this? Test yourself on what you have been reading.
Read the original → nextjs.org
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on next.js — each one lists the topics its interview covers.
See open roles