Add a Dashboard Page

GuideDashboard sectionsProtected sections

The dashboard uses a section-switcher pattern inside a single page at src/app/[locale]/dashboard/page.tsx.

This guide explains how to add a new section while keeping navigation, localization, and the switcher logic aligned with the current architecture.

Before adding a dashboard section

Review Project Structure first so the new section keeps component, sidebar, and service boundaries in the right places.

What this guide covers

Section creation

How to create a new section component and register it in the dashboard page switcher.

Sidebar registration

How to add a navigation entry in the sidebar so users can switch to the new section.

Data boundaries

How to keep data loading, API access, and reusable business logic in the right layers.

Main files and folders

FilePropósito
src/app/[locale]/dashboard/<segment>/page.tsxDashboard page.
src/config/dashboard.tsDashboard section definitions.
messages/*.jsonLocalized dashboard labels.
src/app/[locale]/dashboard/_components/sidebar.tsxDashboard sidebar.
Recommended workflow

Steps

1. Create the section component

Add a new section file in the dashboard features folder:

src/features/dashboard/<name>-section.tsx

2. Add the section to the switcher

Open src/features/dashboard/dashboard-page.tsx and add a new conditional render for your section:

{section === "<name>" ? <YourSection /> : null}

This registers the section in the page so the sidebar can activate it.

3. Add a navigation entry to the sidebar

Open src/features/dashboard/sidebar.tsx and add an entry for your new section with:

  • section identifier
  • label (or translation key)
  • icon

The sidebar is the single source of truth for dashboard navigation.

4. Add translation keys

Add the matching label key to all message files used by the dashboard sidebar.

5. Add data loading

Use:

  • server components for page-level data loading when possible
  • tRPC protected procedures for authenticated server access
  • src/server/services when domain logic grows beyond the page

6. Verify the full flow

After adding the section, test:

  • sidebar navigation switches to the new section
  • sidebar highlighting is correct
  • localized label rendering
  • authenticated access and redirect behavior
  • responsive sidebar behavior on mobile and desktop

Keep the dashboard sidebar-driven

Register new sections in the sidebar and the page switcher instead of hardcoding navigation state inside the section component itself.