Spacerr
  • Features
  • Pricing
  • FAQ
  • Docs
Get Access
Spacerr
  • Introduction
  • Features
  • Tech Stack
  • Setup
  • Configuration
  • Agents
  • Database
  • Jobs
  • Admin
  • Settings
  • Billing
  • Storage
  • Email
  • Support
  • Localization
  • SEO
  • Analytics
  • UI And Navigation
  • Deploying To Production
  • Testing And QA
  • Troubleshooting

Search documentation

Search documentation pages.

Documentation/Settings

Settings

The settings dialog is the user's control center for account and product preferences. It combines authenticated account controls with public preferences such as theme, language, and legal links.

Settings code lives under src/features/settings. The feature owns the dialog UI, section navigation, profile image upload, notification preferences, account security helpers, and client state for opening the dialog globally.

What It Includes

The visible settings sections are defined in src/features/settings/constants/settings-nav.constants.ts.

SectionAuthenticationPurpose
AccountRequiredProfile details, email verification, email change, passkeys, password state, two factor authentication, and account deactivation.
NotificationsRequiredEmail marketing and personalized email preferences.
AppearancePublicLight, dark, and system theme selection.
LanguagePublicApp language selection.
LegalPublicLinks to Terms of Service and Privacy Policy.

Account and notification sections require a signed in user. Appearance, language, and legal sections can be shown without account data.

Dialog Structure

The main settings dialog lives in src/features/settings/components/settings-dialog/settings-dialog.tsx.

It supports desktop and mobile layouts. On desktop, the section list and active section can appear together. On mobile, the dialog tracks whether the user is viewing the section list or a single section.

The global bridge lives in src/features/settings/components/settings-dialog/settings-dialog-global-bridge.tsx. It listens for global settings actions so other product surfaces can open settings without prop drilling the dialog state through unrelated components.

Dialog open state is stored in src/features/settings/store/settings-dialog.store.ts.

Account Section

The account section lives in src/features/settings/components/settings-account-section/settings-account-section.tsx.

It includes:

  • Profile editing through the profile subsection.
  • Current email display.
  • Email verification and resend support.
  • Email change request support.
  • Passkey add and remove flows.
  • Password set and change flows.
  • Two factor authentication setup, verification, backup code download, and disable flow.
  • Account deactivation entry point.

Several account operations use server actions because they depend on the current session, Better Auth, or database state:

FilePurpose
src/features/settings/actions/get-password-status.action.tsChecks whether the current user has a password set.
src/features/settings/actions/get-passkey-status.action.tsChecks whether the current user has passkeys.
src/features/settings/actions/remove-passkeys.action.tsRemoves passkeys for the current user.
src/features/settings/actions/send-email-verification.action.tsSends an email verification request.
src/features/settings/actions/check-change-email-availability.action.tsChecks whether a requested new email is available.

Account deactivation uses the auth feature because deactivation changes account lifecycle state. The feedback flow lives under src/features/auth/account-deactivation.

Profile

The profile subsection lives in src/features/settings/components/settings-profile-section/settings-profile-section.tsx.

It lets users edit their display name and upload a profile image. Profile name validation uses src/features/settings/schemas/settings-profile.schema.ts.

Profile images are uploaded through:

txt
POST /api/account/profile-image
GET /api/account/profile-image?pathname=...

The upload route accepts image files up to 2MB and stores them in the private Blob store under the current user's profile image path. Read requests are also scoped to the signed in user, so one user cannot read another user's private profile image by guessing a pathname.

Notifications

The notifications section lives in src/features/settings/components/settings-notifications-section/settings-notifications-section.tsx.

It currently stores two preferences on the user record:

  • notificationsEmailMarketing
  • notificationsEmailPersonalized

The API route is src/app/api/account/notification-preferences/route.ts.

The client hooks are:

  • src/features/settings/hooks/use-fetch-notification-preferences.ts
  • src/features/settings/hooks/use-mutate-notification-preferences.ts

Validation lives in src/features/settings/schemas/notification-preferences.schema.ts, and database access lives in src/features/settings/repositories/account-notification-preferences.repository.ts.

Use this section when adding new user owned notification preferences. Add the database field, schema field, repository selection, API handling, hook usage, and UI control together so the preference is complete end to end.

Appearance

The appearance section lives in src/features/settings/components/settings-appearance-section/settings-appearance-section.tsx.

It uses next-themes through the shared app provider stack. The available choices are light, dark, and system.

Use this section for user facing theme preferences. Keep provider setup in src/providers, and keep the settings control in the settings feature.

Language

The language section lives in src/features/settings/components/settings-language-section/settings-language-section.tsx.

It is the user facing entry point for locale changes. Locale routing and default locale behavior are documented in the Localization section and governed by skills/i18n.md.

Use this section when changing language selection UI. Use the localization feature and route helpers when changing how locale paths, cookies, or messages work.

Legal

The legal section lives under src/features/settings/components/settings-legal-section.

It gives users quick access to Terms of Service and Privacy Policy from inside the settings dialog. Legal page content itself lives in src/i18n/en/legal.json, and legal rendering is documented in Configuration.

Where To Customize

  • src/features/settings/constants/settings-nav.constants.ts for adding, removing, or reordering settings sections.
  • src/i18n/en/settings.json for settings copy.
  • src/features/settings/components/settings-dialog/settings-dialog.tsx for dialog layout behavior.
  • src/features/settings/components/settings-dialog/settings-section-content.tsx for section rendering.
  • src/features/settings/components/settings-account-section/settings-account-section.tsx for account and security controls.
  • src/features/settings/components/settings-profile-section/settings-profile-section.tsx for profile name and avatar behavior.
  • src/features/settings/components/settings-notifications-section/settings-notifications-section.tsx for notification controls.
  • src/features/settings/components/settings-appearance-section/settings-appearance-section.tsx for theme controls.
  • src/features/settings/components/settings-language-section/settings-language-section.tsx for language controls.
  • src/features/settings/components/settings-legal-section for legal links.

When adding a new settings section, define its section id in src/features/settings/types/settings.types.ts, add the navigation item, add localized copy, render the section content, and keep any data fetching behind feature owned hooks or server actions.

Admin

Learn how the admin dashboard, user management, roles, and protected admin routes are structured.

Billing

Learn how Stripe checkout, price IDs, webhooks, access state, and pricing customization work.

On this page
What It IncludesDialog StructureAccount SectionProfileNotificationsAppearanceLanguageLegalWhere To Customize