X Enterprises

Configuration

app.config.ts and runtimeConfig reference for @xenterprises/nuxt-x-auth-stack.

Configuration

app.config.ts

export default defineAppConfig({
  xAuth: {
    redirects: {
      login: '/auth/login',
      signup: '/auth/signup',
      afterLogin: '/',
      afterSignup: '/',
      afterLogout: '/auth/login',
      forgotPassword: '/auth/forgot-password',
    },
    features: {
      oauth: false,
      magicLink: false,
      otp: false,
      forgotPassword: true,
      signup: false,
    },
    oauthProviders: [],
  },
})

Schema Reference

KeyTypeDefaultDescription
redirects.loginstring'/auth/login'Path of the login page.
redirects.signupstring'/auth/signup'Path of the signup page.
redirects.afterLoginstring'/'Redirect destination after a successful login.
redirects.afterSignupstring'/'Redirect destination after a successful signup.
redirects.afterLogoutstring'/auth/login'Redirect destination after logout.
redirects.forgotPasswordstring'/auth/forgot-password'Path of the forgot-password page.
features.oauthbooleanfalseEnable OAuth/social login buttons.
features.magicLinkbooleanfalseEnable magic link authentication.
features.otpbooleanfalseEnable OTP (email code) authentication.
features.forgotPasswordbooleantrueEnable forgot-password flow.
features.signupbooleanfalseEnable signup page and link.
oauthProviders{ id, label, icon }[][]OAuth providers shown by XAuthOAuthButtonGroup. Each entry requires id (Stack Auth provider name), label (display text), and icon (Iconify class).
publicRoutesstring[][]Additional paths the global middleware treats as public (matched by exact path or path prefix). /auth/handler/*, /auth/logout, /terms, and /privacy are always public.
legal.termsUrlstring'/terms'Terms-of-service link shown in the signup form.
legal.privacyUrlstring'/privacy'Privacy-policy link shown in the signup form.
ui.layout'centered' | 'split''centered'Auth page layout variant.
ui.backgroundobjectvideo (Mixkit)Background for the centered layout: type ('gradient' | 'image' | 'video' | 'solid'), imageUrl, videoUrl, videoCredit, videoCreditUrl, overlayOpacity. Ships with a glassmorphism-over-video default.
ui.cardobjectglass enabledCard styling: glass (blur effect), glassIntensity ('subtle' | 'medium' | 'strong'), opacity (0–100, ~40 recommended over video).
ui.splitobjecthero leftSplit-layout options: heroPosition, heroImageUrl, headline, subheadline, features (string[]).
ui.showLogo / ui.logoUrl / ui.brandName / ui.taglinelogo shownBranding shown above the auth card.
ui.formobjectseparator shownicon (Iconify class above the form title) and showSeparator ("or" divider between OAuth buttons and the form).

See the layer's own app.config.ts for the full ui defaults — override only the keys you need; layer configs deep-merge.

oauthProviders example

oauthProviders: [
  { id: 'google', label: 'Google', icon: 'i-simple-icons-google' },
  { id: 'github', label: 'GitHub', icon: 'i-simple-icons-github' },
]

Runtime Config / Environment Variables

VariableRequiredDescription
NUXT_PUBLIC_STACK_PROJECT_IDYes (for auth)Stack Auth project ID (UUID format).
NUXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEYYes (for auth)Stack Auth publishable client key.

Missing credentials degrade gracefully. useXAuth builds the StackClientApp lazily and guards construction, so without valid credentials nothing throws: public pages render, protected routes still redirect to login, and auth pages show a configuration-warning card instead of a form. Auth methods no-op with error toasts (forgotPassword keeps its identical success UX to prevent email enumeration). Check useXAuth().isConfigured in custom components. (Before this fix, the client was constructed eagerly and every page 500'd without valid-format credentials.)

Note the layer's defaults live in app/app.config.ts — Nuxt 4 ignores a layer-level app.config.ts at the package root, and site-overridable ui.* fields ship as undefined (never "") so consumer values always win.


AI Context

package: "@xenterprises/nuxt-x-auth-stack"
config-key: xAuth
use-when: >
  Configuring redirect paths, enabling/disabling features (OAuth, magic link,
  OTP, forgot password, signup), or listing OAuth providers for nuxt-x-auth-stack.
  Set NUXT_PUBLIC_STACK_PROJECT_ID and NUXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY
  in environment variables to connect the layer to your Stack Auth project.
Copyright © 2026