Introducing a new way to review your PRs.

Read the announcement

arhamkhnz / next-shadcn-admin-dashboard

Modern Admin Dashboard Template built with Shadcn UI and Next.js 16

View on GitHub

22 documents · Updated Nov 23, 2026

docs / route-composition

Route groups and dashboard layout

The route tree separates the public landing page, shared application experiences, the dashboard, and standalone workspaces. The root layout gives every route the same document and preference boundary. Child layouts then add only the shell that their route family needs.

Route group boundaries

Route groups organize pages without adding group names to the URL. The external home route renders the public landing experience, while the main group holds authentication, dashboard, mail, chat, and access-denied destinations under the shared root boundary. The landing page links to the explicit default dashboard rather than redirecting to it. See the application shell for the root entry, the authentication entrypoints for sign-in and registration, and dashboard experiences for the feature views behind the route entrypoints.

The route families have distinct roles:

Route familyUser-facing roleLayout behavior
ExternalPublic entry into the hosted experienceRenders the landing page at / without adding an external group segment
MainShared home for application destinationsInherits the root layout without one extra group-wide layout
AuthenticationSign-in and registration entrypointsProvides separate visual variants under /auth/v1 and /auth/v2
DashboardFocused administrative and operational viewsAdds the application sidebar, header, preference controls, and page content area
MailStandalone email workspaceAdds a mail sidebar around a full-height mail page
ChatStandalone conversation workspaceAdds a chat header and conversation sidebar around the chat page

External landing page

The external landing page introduces the product before a user enters the application. It composes the product message, live default-dashboard link, repository action, dashboard preview, featured screens and editions, theme control, and public profile links into one public experience.

The page sets public metadata and structured website data for the root URL. It uses its own visual token scope so its colors stay independent from saved dashboard theme presets. Its theme control cycles through light, dark, and system modes. The repository star count starts from a server-fetched value when available and can load in the browser when the first request has no usable value. A failed request leaves the count unavailable instead of blocking the page.

This diagram shows how the public entry leads users toward the application without sharing the dashboard frame.

flowchart TD
    Root[/] --> Landing[External landing page]
    Landing --> Intro[Product introduction]
    Landing --> Preview[Dashboard preview]
    Landing --> Overview[Featured screens and editions]
    Landing --> Theme[Landing theme control]
    Intro --> Demo[Live demo link]
    Demo --> Default[/dashboard/default]

References: src/…/page.tsx• L16-72 src/…/intro.tsx• L9-59 src/…/overview.tsx• L5-109 src/…/footer.tsx• L6-41 src/…/github-star-button.tsx• L9-29 src/…/showcase.tsx• L6-27 src/…/landing-theme-switcher.tsx• L9-43 src/…/use-github-star-count.ts• L11-46 src/…/landing.module.css• L1-68

Authentication and access routes

The authentication entrypoints give the main route group two presentation choices for account access. Version 1 uses a split-screen sign-in or registration page, while version 2 uses a compact branded form with the same login and registration pair. Both variants connect to shared account actions and let users move between sign-in and registration without leaving their selected version.

The access-denied route is a separate application destination for users who cannot view requested content. It presents a full-screen explanation and is excluded from search results, so it acts as an application response rather than a public landing destination. See the authentication entrypoints for the account flow.

References: src/…/page.tsx• L9-53 src/…/page.tsx• L9-53 src/…/page.tsx• L11-53 src/…/page.tsx• L11-53 src/…/page.tsx• L6-34

Dashboard layout

The dashboard layout is the common frame for dashboard pages. It restores sidebar state from a cookie, reads sidebar display preferences, and places each page inside a header-and-content shell. The header connects navigation, search, layout and theme controls, repository access, and account selection to the same dashboard frame.

The content area provides normal page padding by default. A page can opt out with data-content-padding="false" when its content needs a full-bleed surface, as the Kanban, patient monitoring, products, and profile pages do. The dashboard shell also honors the selected centered content mode and keeps the main content from causing horizontal overflow.

The dashboard layout surrounds each page with the following structure:

  1. A preference-aware sidebar provides the main application navigation.
  2. A header provides controls that apply across dashboard destinations.
  3. A padded content region renders the selected page entrypoint.

This diagram shows how a dashboard URL reaches its page while retaining the shared shell.

flowchart TD
    URL[Dashboard URL] --> DLayout[Dashboard layout]
    DLayout --> Sidebar[Application sidebar]
    DLayout --> Header[Dashboard header]
    DLayout --> Content[Content region]
    Content --> Page[Dashboard page entrypoint]
    Page --> FullBleed{Full-bleed content?}
    FullBleed -->|No| Padded[Padded page surface]
    FullBleed -->|Yes| Edge[Edge-to-edge page surface]

References: src/…/layout.tsx• L19-78 src/…/page.tsx• L4-9

Dashboard page entrypoints

Each dashboard URL has a page entrypoint that selects the content for one experience. The entrypoints compose focused views such as analytics, finance, files, invoices, Kanban, productivity, products, profiles, and patient monitoring inside the shared dashboard frame. Some entries are previews or placeholders: the dashboard chat route embeds the standalone chat experience, while the coming-soon route marks work that is not ready. The dashboard index itself has no page content, so the external landing page links to the explicit default dashboard instead.

Some page entrypoints also define local view rules. The file manager reads a query value to choose grid or list presentation, and the Kanban view requests the full content width. These choices stay inside the page and do not change the dashboard shell.

References: src/…/page.tsx• L1-3 src/…/page.tsx• L5-12 src/…/page.tsx• L15-94 src/…/page.tsx• L8-32 src/…/page.tsx• L3-15 src/…/page.tsx• L15-73 src/…/page.tsx• L17-107 src/…/page.tsx• L8-42 src/…/page.tsx• L8-24 src/…/page.tsx• L13-79 src/…/page.tsx• L13-47 src/…/page.tsx• L6-28 src/…/page.tsx• L23-118 src/…/intro.tsx• L50-55

Dashboard fallbacks

The dashboard fallback handles unknown paths within the dashboard route family. It keeps the dashboard shell and shows a local not-found message that states the requested section is not yet available. This differs from the root not-found page, which uses a full viewport message and offers a link back to the default dashboard.

The dashboard also includes a legacy route group for older versioned dashboard variants. The group keeps those variants organized with the dashboard pages while leaving the version marker out of the URL. Its layout passes children through without adding another visual shell and marks those pages as not for search indexing while allowing link following. New dashboard links should therefore target the current named destinations rather than infer behavior from the legacy group.

References: src/…/page.tsx• L1-10 src/…/not-found.tsx• L1-17 src/…/layout.tsx• L3-14 src/…/page.tsx• L1-20 src/…/page.tsx• L1-20

Mail route

The mail route is a standalone full-height workspace within the main group. Its layout supplies a mail-specific sidebar and a sidebar provider, then gives the page the remaining screen area. The page entrypoint loads the mail set and restores the saved desktop panel proportions from a cookie before rendering the mail experience. This workspace follows its own navigation model rather than the dashboard frame; see collaboration workspaces for the broader mail and chat experience.

The mail experience changes shape by screen size. Desktop users see a resizable inbox and message view. Mobile users see the inbox first and open the selected message in a drawer. This keeps the same mail entrypoint while adapting the workspace to the available screen.

References: src/…/layout.tsx• L7-15 src/…/page.tsx• L9-25 src/…/mail.tsx• L21-45 src/…/mail.tsx• L47-87

Chat route

The chat route is a standalone conversation workspace with its own header and sidebar. Its layout stacks the header above a flexible body that contains the conversation list and the page content. The page entrypoint supplies the conversation set to the chat experience, and the dashboard chat route exposes this workspace as a preview rather than duplicating it.

The chat page uses one route for desktop, tablet, and mobile interaction. Larger screens can show the conversation list, active thread, and contact details together. Smaller screens move the thread and contact details into focused transitions or a sheet so the user can keep the conversation readable.

References: src/…/layout.tsx• L8-19 src/…/page.tsx• L1-17 src/…/chat.tsx• L20-87 src/…/page.tsx• L15-32

Route selection relationships

The route family determines which layout owns the screen before the page entrypoint supplies its feature view. The external entry presents the landing page and offers the default dashboard as its main next step. Authentication and access routes provide focused account or permission surfaces. Dashboard pages share navigation and controls. Mail and chat instead replace that application frame with workspaces built around their own navigation patterns.

This diagram shows the main route choices and their resulting page surfaces.

flowchart LR
    Root[/] --> External[External landing page]
    External --> DefaultLink[Live demo link]
    DefaultLink --> Default[/dashboard/default]
    Main[Main route group] --> Auth[Auth routes]
    Main --> Access[Access-denied route]
    Main --> Dashboard[Dashboard routes]
    Main --> Mail[Mail route]
    Main --> Chat[Chat route]
    Dashboard --> DashboardLayout[Dashboard shell]
    DashboardLayout --> DashboardPages[Named dashboard pages]
    Mail --> MailLayout[Mail workspace shell]
    MailLayout --> MailPage[Mail page]
    Chat --> ChatLayout[Chat workspace shell]
    ChatLayout --> ChatPage[Chat page]

References: src/…/page.tsx• L32-70 src/…/intro.tsx• L50-55 src/…/page.tsx• L18-53 src/…/page.tsx• L20-53 src/…/page.tsx• L13-34 src/…/layout.tsx• L19-78 src/…/layout.tsx• L7-15 src/…/layout.tsx• L8-19

Change checklist

When these files or sections are changed, remember to consider these:

  • A change to the dashboard layout can affect every dashboard page. Check the full-bleed opt-out contract used by pages such as Kanban.
  • A change to the external entry must preserve the public landing content and the link from / to the explicit default dashboard destination.
  • A change to the landing metadata or structured website data must keep the root URL and product identity aligned with the public entry.
  • A change to the landing theme scope or theme control must preserve the separation between landing colors and saved dashboard theme presets.
  • A change to the landing screen or edition links must keep them aligned with available application destinations and related repositories.
  • A change to an authentication variant must preserve its paired login and registration paths and its link to the matching form.
  • A change to the access-denied route must preserve its non-indexable application-only behavior.
  • A change to mail or chat layout must preserve each workspace's independent navigation shell. Do not assume dashboard header or sidebar controls apply there.
  • A new dashboard path should have a named page entrypoint or a deliberate dashboard fallback outcome.
  • A dashboard preview route must stay aligned with the standalone workspace route that it embeds or opens.
  • A change to the legacy group must preserve its no-index policy and its lack of an extra visual shell.

Important failure modes

TriggerConsequenceGuard
The landing page link and default dashboard path drift apartThe public entry sends users to a missing or unintended destinationKeep the live demo link aligned with the current default dashboard page
Landing styles use the shared dashboard theme scopeSaved dashboard preferences can change the public entry's appearance unexpectedlyKeep landing tokens scoped to the landing page and route theme changes through the landing control
The public metadata or structured website data names the wrong root or productSearch and shared links can describe the wrong public entryKeep the metadata and website data tied to the canonical landing route and app identity
A full-bleed page omits or misuses data-content-padding="false"The page receives unwanted inset space or breaks the intended edge-to-edge viewTreat the page attribute as the contract with the dashboard content region
A dashboard preview points to a changed standalone workspace pathThe preview opens a missing or unrelated experienceKeep the preview iframe and open-in-new-tab destination aligned with the standalone route
A legacy dashboard page is treated as a current public destinationSearch engines can index an old variant and users can enter an unsupported pathKeep legacy pages under the legacy group and preserve its no-index metadata
A route intended for mail or chat is placed under the dashboard familyThe destination receives the wrong navigation shell and layout behaviorChoose the route family from the required workspace shell before adding the page
An unknown dashboard URL bypasses the dashboard fallbackUsers lose the dashboard context or receive the wrong not-found surfaceKeep the catch-all dashboard route alongside the dashboard layout

Key files

FileWhy to read it
src/…/layout.tsxShows the root boundary inherited by every route family
src/…/page.tsxShows the public landing composition, metadata, structured website data, and independent visual scope
src/…/intro.tsxShows the landing message, live demo link, and repository action
src/…/overview.tsxShows how the landing page points to featured dashboard screens and editions
src/…/footer.tsxShows the public author links at the end of the landing page
src/…/github-star-button.tsxShows the repository action and its unavailable-count state
src/…/landing-theme-switcher.tsxShows the landing page's light, dark, and system theme control
src/…/landing.module.cssDefines the landing page's independent light and dark visual scope
src/…/page.tsxShows the split-screen login variant
src/…/page.tsxShows the compact branded login variant
src/…/page.tsxDefines the application-only access-denied surface
src/…/layout.tsxDefines the shared dashboard shell and content contract
src/…/page.tsxShows that the dashboard index is a route container without its own view
src/…/page.tsxDefines the dashboard-specific fallback surface
src/…/layout.tsxDefines the legacy group boundary and its search indexing policy
src/…/layout.tsxDefines the standalone mail workspace frame
src/…/page.tsxConnects the mail entrypoint to its saved layout state
src/…/layout.tsxDefines the standalone chat workspace frame
src/…/page.tsxConnects the chat entrypoint to conversation data
src/…/page.tsxShows how the dashboard exposes the standalone chat as a preview