<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Edema Ero</title>
    <description>The latest articles on DEV Community by Edema Ero (@beyondlogic).</description>
    <link>https://dev.to/beyondlogic</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F843887%2Fe4e273ae-1dd4-481b-90b3-46a9cab42ea1.jpeg</url>
      <title>DEV Community: Edema Ero</title>
      <link>https://dev.to/beyondlogic</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/beyondlogic"/>
    <language>en</language>
    <item>
      <title>In this article, I dive into Next.js Route Groups — what they are, how they work, and why they can make your app structure cleaner and more maintainable. I also cover some practical tips, common pitfalls, and layout strategies you can start using today.</title>
      <dc:creator>Edema Ero</dc:creator>
      <pubDate>Tue, 18 Nov 2025 21:32:19 +0000</pubDate>
      <link>https://dev.to/beyondlogic/in-this-article-i-dive-into-nextjs-route-groups-what-they-are-how-they-work-and-why-they-can-177h</link>
      <guid>https://dev.to/beyondlogic/in-this-article-i-dive-into-nextjs-route-groups-what-they-are-how-they-work-and-why-they-can-177h</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/beyondlogic" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F843887%2Fe4e273ae-1dd4-481b-90b3-46a9cab42ea1.jpeg" alt="beyondlogic"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/beyondlogic/why-you-should-start-using-nextjs-route-groups-47o2" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Why You Should Start Using Next.js Route Groups&lt;/h2&gt;
      &lt;h3&gt;Edema Ero ・ Nov 18&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#nextjsroutegroups&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#nextjsapprouter&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#nextjslayouts&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#nextjsroutingbestpractices&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>nextjsroutegroups</category>
      <category>nextjsapprouter</category>
      <category>nextjslayouts</category>
      <category>nextjsroutingbestpractices</category>
    </item>
    <item>
      <title>Why You Should Start Using Next.js Route Groups</title>
      <dc:creator>Edema Ero</dc:creator>
      <pubDate>Tue, 18 Nov 2025 17:05:28 +0000</pubDate>
      <link>https://dev.to/beyondlogic/why-you-should-start-using-nextjs-route-groups-47o2</link>
      <guid>https://dev.to/beyondlogic/why-you-should-start-using-nextjs-route-groups-47o2</guid>
      <description>&lt;p&gt;I’ve been developing with Next.js for a while now, and with every major release, we get introduced to new features that make our workflow even better.&lt;/p&gt;

&lt;p&gt;However, there’s one feature I believe many developers overlook. I rarely see it used in codebases I work on, and I honestly wonder why. Is it because they don’t know it exists? Or they’re not sure how it actually works?&lt;/p&gt;

&lt;p&gt;So in today’s article, I’m going to introduce you to a Next.js feature called Route Groups. Once you understand this, you’ll be ahead of many Next.js developers.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Exactly Are Route Groups?
&lt;/h3&gt;

&lt;p&gt;I’m not going to give you a textbook definition. Instead, I'll show you how they work and why they matter.&lt;/p&gt;

&lt;p&gt;Let’s say your design team delivers 4 sets of designs for your company's MVP:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;Website&lt;/em&gt; – marketing and legal pages&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Authentication&lt;/em&gt; – sign in, sign up, forgot password&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Dashboard&lt;/em&gt; – protected pages for signed-in users&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Public Profile&lt;/em&gt; – profile pages accessible publicly&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each of these sections has its own unique layout:&lt;/p&gt;

&lt;p&gt;Website → Header + Footer&lt;/p&gt;

&lt;p&gt;Dashboard → Header + Sidebar + Footer&lt;/p&gt;

&lt;p&gt;Auth → Minimal layout&lt;/p&gt;

&lt;p&gt;Profile → Custom layout&lt;/p&gt;

&lt;p&gt;Now you’re thinking:&lt;/p&gt;

&lt;p&gt;“What’s the best way to give each section its own layout without messing up the folder structure?”&lt;/p&gt;

&lt;p&gt;This is where Next.js Route Groups come in.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Route Groups Work
&lt;/h3&gt;

&lt;p&gt;You create a route group by wrapping a folder name in parentheses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(website)
(auth)
(dashboard)
(profile)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By doing this, you're telling Next.js:&lt;/p&gt;

&lt;p&gt;“Don’t include this folder in the final URL. It’s only for organization.”&lt;/p&gt;

&lt;p&gt;Once you do that, some powerful features become available.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Root Layouts per Route Group
&lt;/h2&gt;

&lt;p&gt;Each route group can have its own &lt;code&gt;layout.js&lt;/code&gt; or &lt;code&gt;layout.tsx.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example folder structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app/
  (website)/
    layout.js
  (auth)/
    layout.js
  (dashboard)/
    layout.js
  (profile)/
    layout.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means you can:&lt;/p&gt;

&lt;p&gt;Give website pages a shared header and footer&lt;/p&gt;

&lt;p&gt;Give dashboard pages a shared sidebar and protected layout&lt;/p&gt;

&lt;p&gt;Give auth pages a minimal layout&lt;/p&gt;

&lt;p&gt;Give profile pages their own custom structure&lt;/p&gt;

&lt;p&gt;All without messing up your URLs.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Layout Logic
&lt;/h2&gt;

&lt;p&gt;Every layout can contain unique logic.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ukml27v126pp299xymw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ukml27v126pp299xymw.png" alt="Layout logic" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This makes it easy to protect routes without middleware.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Shared SEO Metadata
&lt;/h2&gt;

&lt;p&gt;If SEO matters for your project, you can define shared metadata in each root layout.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ragnu2yh4b1bxeycrlf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ragnu2yh4b1bxeycrlf.png" alt="SEO Metadata" width="800" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Page-level metadata will override layout metadata when needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  But There Are Caveats
&lt;/h2&gt;

&lt;p&gt;To avoid getting confused, here are a few things you must keep in mind.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Full Page Reload Between Layouts
&lt;/h3&gt;

&lt;p&gt;When navigating between pages that use different root layouts, Next.js triggers a full page reload.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/about&lt;/code&gt; → uses &lt;code&gt;(website)&lt;/code&gt; layout&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/login&lt;/code&gt; → uses &lt;code&gt;(auth)&lt;/code&gt; layout&lt;/p&gt;

&lt;p&gt;Navigating between them will reload the page.&lt;/p&gt;

&lt;p&gt;This only happens when switching between multiple root layouts.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Conflicting Paths
&lt;/h3&gt;

&lt;p&gt;Avoid creating routes in different groups that resolve to the same URL.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app/(website)/about/page.js   // → /about
app/(profile)/about/page.js   // → /about  ❌ conflict
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will throw route resolution errors.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. No Top-Level Layout? Then One Group Must Define /
&lt;/h3&gt;

&lt;p&gt;If you don't have a global app/layout.js and you're using multiple root layouts, one of them must contain your homepage:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app/(website)/page.js  // becomes "/"&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Once you understand these caveats, you’ll be able to use the power of Next.js Route Groups seamlessly.&lt;/p&gt;

&lt;p&gt;Let me know what you think about Route Groups in the comments.&lt;br&gt;
Have you used this before, or are you trying it for the first time after reading this?&lt;/p&gt;

</description>
      <category>nextjsroutegroups</category>
      <category>nextjsapprouter</category>
      <category>nextjslayouts</category>
      <category>nextjsroutingbestpractices</category>
    </item>
  </channel>
</rss>
