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 / application-shell

Application shell and route composition

The application shell is the shared boundary for every Next.js route. It provides the document context and global visual rules that all experiences use, while route groups separate the public landing experience from the main application without changing the visible URL structure.

Root application boundary

The root layout is the first shared entrypoint for the application. It wraps every route group in one document and keeps metadata, preferences, measurement, and common UI support consistent as users move between experiences.

The root boundary establishes:

  • Application metadata and document language.
  • Font variables and default preference attributes.
  • Site measurement.
  • Tooltip, preference, and toast providers around route content.

The root layout does not select a dashboard, workspace, or authentication view. Each route family adds the shell that fits its experience. References: src/…/layout.tsx• L15-30, src/…/layout.tsx• L32-74, src/…/app-config.ts• L1-14

Route group structure

Route groups organize routes by user experience while keeping their grouping names out of the URL. The external group owns / and presents the public product entry. The main group owns the working application and account access routes.

The high-level relationship is:

flowchart TD
    Root[Root URL] --> External[External route group]
    External --> Landing[Product landing page]
    Landing --> MainEntry[Main application entry]
    RootLayout[Root application layout] --> External
    RootLayout --> Main[Main route group]
    Main --> Auth[Authentication entrypoints]
    Main --> Dashboard[Dashboard routes]
    Main --> Mail[Mail workspace]
    Main --> Chat[Chat workspace]

The external home page combines the product introduction, dashboard preview, overview, and external links. It also gives users a theme control before they enter the main application. Read route composition for the route-family layouts and page flow. References: src/…/page.tsx• L32-95, src/…/layout.tsx• L18-76, src/…/layout.tsx• L7-15, src/…/layout.tsx• L8-19

External landing experience

The external landing experience is the public entry at /. It gives visitors a focused product view and paths into the live application, featured screens, available editions, and external project profiles.

The page defines its own metadata and structured site data. Its repository signal is optional, so a failed or delayed external request does not block the main landing content. The landing page also keeps its visual surface separate from saved dashboard theme presets while still exposing the shared theme preference. References: src/…/page.tsx• L16-30, src/…/page.tsx• L32-95, src/…/landing-theme-switcher.tsx• L11-37, src/…/use-github-star-count.ts• L11-47

Experience shell boundaries

The main group contains separate shell boundaries for dashboard, mail, and chat. Each boundary preserves the controls and content shape that belong to its experience instead of forcing focused workspaces into the dashboard frame.

ExperienceShell purpose
DashboardShared navigation and content region for operational views
MailFull-height email work area with mail navigation
ChatConversation-focused work area with chat navigation
AuthenticationDedicated entry into login and registration flows

The dashboard shell also defines the content spacing contract. Mail and chat control their own full-height arrangements. Read route composition for the detailed route-family behavior. References: src/…/layout.tsx• L26-74, src/…/layout.tsx• L7-15, src/…/layout.tsx• L8-19

Authentication entrypoints

Authentication belongs to the main route group but uses dedicated versioned login and registration paths. Each version provides the same account access purpose with a different surrounding visual frame.

Login and registration remain paired within each version. The entrypoints expose password and Google account actions through shared authentication controls. Read authentication entrypoints for the sign-in and registration flow. References: src/…/page.tsx• L8-43, src/…/page.tsx• L8-43, src/…/layout.tsx• L8-35, src/…/page.tsx• L10-43, src/…/page.tsx• L10-43

Global styling boundary

The global stylesheet is the visual contract shared by every route. It maps semantic color roles and shape values to the utility style system, then applies theme mode, visual presets, font choices, landing-page rules, and print behavior through document state.

The stylesheet also marks the public landing page as a distinct visual surface. Landing selectors keep its font and view-transition behavior stable without creating a second document boundary. The root layout supplies the document attributes that the stylesheet reads, so the same boundary supports both the public entry and the main application. References: src/…/globals.css• L1-10, src/…/globals.css• L12-53, src/…/globals.css• L55-94, src/…/globals.css• L130-142, src/…/globals.css• L235-247, src/…/page.tsx• L40-95

Preference and theme flow

Preferences are shared display choices that affect the document or a route shell. Saved values and defaults become document attributes before or during application startup. Global CSS then uses those attributes to shape the rendered page, while the client preference state keeps later user changes in sync.

This diagram shows how a saved preference reaches both global styles and route shells.

flowchart LR
    Saved[Saved preference] --> Boot[Theme startup]
    Defaults[Preference defaults] --> Root[Root layout]
    Boot --> Document[HTML attributes and dark class]
    Root --> Document
    Document --> CSS[Global styles]
    Document --> Provider[Interactive preference state]
    Provider --> Shell[Route shell controls]
    CSS --> Page[Rendered route]
    Shell --> Page

Layout-critical preferences use cookie-backed values so the server-rendered shell and browser can agree. Theme mode can also follow the system color scheme when the user selects system. References: src/…/preferences-config.ts• L24-37, src/…/preferences-config.ts• L55-103, src/…/theme-boot.tsx• L1-77, src/…/preferences-provider.tsx• L21-54, src/…/preferences-provider.tsx• L56-84, src/…/globals.css• L144-237

Fallback surfaces

Fallback pages preserve a useful recovery path when a route does not resolve. The root fallback provides a full-screen return to the default dashboard, while the dashboard catch-all keeps the user inside the dashboard context and reports that the requested section is unavailable.

These surfaces differ because they preserve the route boundary where the failure occurs. References: src/…/not-found.tsx• L7-16, src/…/page.tsx• L3-9

Change checklist

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

  • A root layout or global stylesheet change affects every route family. Check both focused workspaces and dashboard pages.
  • A document preference must stay aligned across its registry, root HTML attributes, startup behavior, provider state, and CSS selectors.
  • Landing links must continue to target valid main application routes and remain usable if optional external data fails.
  • Landing visual rules must preserve the separation between the public surface and saved dashboard presets.
  • A new route must use the shell that matches its experience. Do not place mail, chat, or authentication content under the dashboard shell by convenience.
  • Authentication version paths must preserve the login-to-registration link within the same version.

Important failure modes

TriggerConsequenceGuard
A preference is added in one layer but not in the registry, startup step, provider, or CSSThe first render and later interactive state can show different appearance or layoutTreat the preference layers as one contract
A landing link targets a removed dashboard routeVisitors reach a missing or unintended destinationKeep landing links aligned with the current main route set
A workspace route uses the wrong child layoutUsers receive the wrong navigation and content shapeSelect the route family from the required shell before adding the page
Optional landing data fails and becomes required for renderingThe public entry loses its main product linksKeep external signals separate from core landing content

Key files

FileWhy to read it
src/…/layout.tsxDefines the shared document and provider boundary
src/…/page.tsxDefines the public landing entry and its section composition
src/…/layout.tsxDefines the dashboard shell and content spacing contract
src/…/layout.tsxDefines the mail workspace boundary
src/…/layout.tsxDefines the chat workspace boundary
src/…/layout.tsxShows the shared frame for one authentication entrypoint version
src/…/globals.cssDefines the global visual, theme, landing, and print boundary
src/…/theme-boot.tsxApplies saved display preferences at startup
src/…/preferences-config.tsDefines preference values, defaults, and document attributes
src/…/preferences-provider.tsxConnects document preferences to interactive controls
src/…/not-found.tsxDefines the root recovery surface
src/…/page.tsxDefines the dashboard-level recovery surface