X Enterprises

Configuration

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

Configuration

How to configure this module via app.config.ts and environment variables.

app.config.ts

export default defineAppConfig({
  xAuth: {
    provider: 'stack', // 'stack' | 'better-auth' | 'neon-auth' | 'local'

    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: true,
    },

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

    tokens: {
      accessCookie: 'x_auth_access',
      refreshCookie: 'x_auth_refresh',
      hasRefresh: true,
    },

    ui: {
      showLogo: true,
      logoUrl: '',
      brandName: 'My App',
      tagline: 'Welcome back',
      layout: 'centered', // 'centered' | 'split'
      background: {
        type: 'gradient', // 'gradient' | 'image' | 'solid'
        imageUrl: '',
        overlayOpacity: 50,
      },
      card: {
        glass: false,
        glassIntensity: 'medium', // 'subtle' | 'medium' | 'strong'
      },
      split: {
        heroPosition: 'left', // 'left' | 'right'
        heroImageUrl: '',
        headline: '',
        subheadline: '',
        features: [],
      },
      form: {
        icon: '',
        showSeparator: true,
      },
    },

    // Optional: endpoint overrides for 'local' provider or custom backends
    endpoints: {
      login: '/auth/login',
      signup: '/auth/signup',
      logout: '/auth/logout',
      refresh: '/auth/refresh',
      me: '/auth/me',
      forgotPassword: '/auth/forgot-password',
      resetPassword: '/auth/reset-password',
    },

    // Optional: field mapping to normalize provider-specific user shapes
    fieldMapping: {
      id: 'sub',
      name: 'full_name',
      avatar: 'image',
      emailVerified: 'verified',
    },
  },
})

Schema Reference

Top-level

KeyTypeDefaultDescription
xAuth.provider'stack' | 'better-auth' | 'neon-auth' | 'local''stack'Auth backend to use. Determines which provider adapter is loaded.

redirects

KeyTypeDefaultDescription
redirects.loginstring'/auth/login'Path to the login page.
redirects.signupstring'/auth/signup'Path to the signup page.
redirects.afterLoginstring'/'Redirect destination after successful login.
redirects.afterSignupstring'/'Redirect destination after successful signup.
redirects.afterLogoutstring'/auth/login'Redirect destination after logout.
redirects.forgotPasswordstring'/auth/forgot-password'Path to the forgot password page.

features

KeyTypeDefaultDescription
features.oauthbooleanfalseShow OAuth provider buttons on auth forms.
features.magicLinkbooleanfalseShow magic link option on login form.
features.otpbooleanfalseShow OTP verification option.
features.forgotPasswordbooleantrueShow forgot password link on login form.
features.signupbooleantrueShow signup link on login form.

oauthProviders

An array of OAuth provider definitions rendered by <XAuthOAuthButtonGroup />:

FieldTypeDescription
idstringProvider ID (e.g. 'google', 'github').
labelstringDisplay label on the button.
iconstringIconify icon string (e.g. 'i-logos-google-icon').

tokens

KeyTypeDefaultDescription
tokens.accessCookiestring'x_auth_access'Cookie name for the access token.
tokens.refreshCookiestring'x_auth_refresh'Cookie name for the refresh token.
tokens.hasRefreshbooleantrueWhether the provider issues a separate refresh token.

ui

KeyTypeDefaultDescription
ui.showLogobooleantrueShow logo on auth pages.
ui.logoUrlstring''URL of the logo image.
ui.brandNamestring'My App'Brand name displayed on auth pages.
ui.taglinestring'Welcome back'Tagline shown below the brand name.
ui.layout'centered' | 'split''centered'Auth page layout style.
ui.background.type'gradient' | 'image' | 'solid''gradient'Background style for auth pages.
ui.background.imageUrlstring''Background image URL (used when type is 'image').
ui.background.overlayOpacitynumber50Overlay opacity over background image (0–100).
ui.card.glassbooleanfalseApply glassmorphism effect to the auth card.
ui.card.glassIntensity'subtle' | 'medium' | 'strong''medium'Intensity of the glass effect.
ui.split.heroPosition'left' | 'right''left'Position of the hero panel in split layout.
ui.split.heroImageUrlstring''Hero panel background image URL.
ui.split.headlinestring''Headline text in the split layout hero.
ui.split.subheadlinestring''Subheadline text in the split layout hero.
ui.split.featuresstring[][]Feature list displayed in the split layout hero.
ui.form.iconstring''Icon shown at the top of the auth form.
ui.form.showSeparatorbooleantrueShow an "or" separator between password and OAuth sections.

endpoints (optional — Local JWT / custom backends)

KeyTypeDefaultDescription
endpoints.loginstring'/auth/login'Login API endpoint.
endpoints.signupstring'/auth/signup'Signup API endpoint.
endpoints.logoutstring'/auth/logout'Logout API endpoint.
endpoints.refreshstring'/auth/refresh'Token refresh endpoint.
endpoints.mestring'/auth/me'Current user endpoint.
endpoints.forgotPasswordstring'/auth/forgot-password'Forgot password endpoint.
endpoints.resetPasswordstring'/auth/reset-password'Password reset endpoint.

fieldMapping (optional)

Maps provider-specific field names to the unified AuthUser shape:

KeyTypeDescription
fieldMapping.idstringField name for the user ID (tries id, sub, user_id by default).
fieldMapping.namestringField name for the display name (tries displayName, name, full_name, fullName).
fieldMapping.avatarstringField name for the avatar URL (tries avatarUrl, image, profile_picture).
fieldMapping.emailVerifiedstringField name for email verification status.

Runtime Config (Environment Variables)

Configure the active auth provider via environment variables:

VariableProviderRequiredDescription
NUXT_PUBLIC_STACK_PROJECT_IDStack AuthYesStack project ID.
NUXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEYStack AuthYesPublishable client key.
NUXT_PUBLIC_BETTER_AUTH_BASE_URLBetter AuthYesBetter Auth API base URL.
NUXT_PUBLIC_NEON_AUTH_PROJECT_IDNeon AuthYesNeon project ID.
NUXT_PUBLIC_NEON_AUTH_BRANCH_IDNeon AuthYesNeon branch ID.
NUXT_PUBLIC_NEON_AUTH_BASE_URLNeon AuthYesNeon Auth base URL.
NUXT_PUBLIC_LOCAL_AUTH_BASE_URLLocal JWTYesYour local API base URL.

AI Context

package: "@xenterprises/nuxt-x-auth"
config-key: xAuth
use-when: >
  Configuring auth provider, redirect paths, feature flags (OAuth, magic link,
  OTP, forgot password), OAuth provider list, cookie names, or UI appearance
  (layout, branding, background, glass card, split panel) for nuxt-x-auth.
  Also use when overriding API endpoints for local/custom JWT backends or
  normalizing provider field names via fieldMapping.
Copyright © 2026