HyperSaaS
FrontendRouting

Route Groups

Separate layouts for marketing, auth, and dashboard areas.

Route groups in Next.js use parenthesized folder names (group) to organize routes without affecting the URL path.

(marketing)

Public-facing pages with a marketing header and footer.

Layout:

  • Fetches session via auth() for optional user context
  • Wraps children with NextAuthSesionProvider and SessionErrorHandler
  • Renders marketing Header + Footer

Pages:

RouteComponentDescription
/HomeHero, features, stack, CTA sections
/pricingPricingThe paid plans, monthly or yearly; buttons go to the workspace's Billing page (signed in) or sign-up
/featuresFeaturesProduct feature showcase
/aboutAboutCompany/product information
/faqFAQFrequently asked questions
/contact-usContactContact form (sends via SendGrid)
/blogBlogBlog listing from content-collections
/blog/[...slug]BlogPostMDX blog post rendering
/privacy-policyPrivacyPrivacy policy (static)
/terms-and-conditionsTermsTerms of service (static)
/cookie-policyCookiesCookie policy (static)

(auth)

Minimal layout for authentication flows — no marketing header/footer.

Pages:

RouteComponentDescription
/loginUserLoginFormEmail + password login
/registerUserRegisterFormAccount creation
/reset-passwordPasswordResetFormRequest password reset
/confirm-password-reset/[uid]/[token]ConfirmPasswordResetFormSet new password
/reset-usernameUsernameResetFormRequest an email change
/confirm-username-reset/[uid]/[token]ConfirmUsernameResetFormChoose the new email; a link is sent to it
/confirm-email-change/[token]ConfirmEmailChangeFormOpened from the new address; makes the change
/user-activation/[uid]/[token]UserActivationFormEmail verification
/resend-activationResendActivationFormResend activation email

(dashboard)

Protected area requiring authentication. proxy.ts sends signed-out visits to /login, and the layouts check the session again.

Top-level routes:

RouteDescription
/dashboardOpens the workspace used last (a last_workspace cookie), else the first; with none, a page to create one
/dashboard/billing, /dashboard/profile, /dashboard/settingsRedirect to that settings page in the workspace used last, for links that don't name a workspace

Workspace Pages (workspaces/[workspaceId]/)

The workspace layout loads the user, their workspaces and the workspace's plan once per request (lib/workspaces/shell.ts, wrapped in React's cache()), and gives them to every page and the sidebar through WorkspaceProvider (useWorkspace()).

RouteDescription
.../[workspaceId]Workspace home: members, teams, chats and documents, recent chats, knowledge bases
.../chatNew chat
.../chat/historyChat list
.../chat/[chatId]A chat
.../documents, .../documents/[docId]/viewDocuments and the viewer
.../knowledge-bases, .../knowledge-bases/[kbId]Knowledge bases
.../teams, .../teams/[teamId]Teams

Settings ([workspaceId]/settings/)

Opening any settings page switches the sidebar to the settings menu. /settings itself redirects to General.

RouteSectionDescription
.../settings/profileAccountYour name; changing your email
.../settings/securityAccountChanging your password; deleting your account
.../settings/generalWorkspaceName and details; archive, transfer ownership, leave, delete
.../settings/membersWorkspaceInvite people, roles, removing members, pending invitations
.../settings/billingWorkspacePlan, usage and credit, upgrading, the billing portal. See Billing

Account pages sit under a workspace's URL so the sidebar and its "Back to" link keep their place; they're the same whichever workspace you open them from.

Older URLs (/workspaces, /dashboard/workspaces, .../details, /success, /cancel) redirect to their new place in next.config.ts.

(invitations)

Invitation acceptance at /invitations/accept/[invitationId].

Shows login form if unauthenticated, or invitation details if authenticated.

(chats)

Public shareable chat sessions at /chats/[workspaceId]/[shareableLink].

No authentication required — fetches the shared session via public API.

On this page