BowlerKitBowlerKit
Features

User Account

10/11/2026

Profile data, preferences, sessions, and account lifecycle in the Expo template.

Account profile

The Account profile loads the current user from /api/v1/app/me after restoring a Sanctum token. The shared User type includes:

  • id, uuid, name, and email.
  • role, is_verified, and has_password.
  • avatar_url and phone_number.
  • created_at and updated_at.

Guest projects do not create or restore a remote user. The Guest runtime clears stale Account tokens and uses local onboarding/profile state instead.

Editing the profile

Profile updates use useUpdateProfileMutation and the PUT /api/v1/app/users/{uuid} contract. The API client maps Laravel validation errors into the mutation error state. Avatar uploads use the Laravel-owned /uploads endpoint and require the Account backend.

const mutation = useUpdateProfileMutation();

await mutation.mutateAsync({
  name: 'Ada Lovelace',
  phone_number: '+1 555 0100',
});

Use the generated form and mutation types rather than constructing a second request client.

Preferences

The preferences store persists language, region, timezone, data-sharing choices, notification settings, and onboarding completion locally. In Account mode, changes are debounced and synchronized to:

  • PUT /api/v1/app/preferences
  • PUT /api/v1/app/notifications/preferences

Failed writes are marked pending and retried after authentication. In Guest mode, preferences remain local-only and are never queued for remote sync.

Security and account deletion

The security screens expose:

  • Active sessions with per-session revoke and revoke-all actions.
  • Login history.
  • Password change.
  • Account deletion with local auth cleanup after success.

These are Account-only operations. Laravel owns destructive security mutations; the Go service serves the protected security reads.

Token and logout behavior

Logout clears the Zustand auth state and removes the secure token. A 401 from the API performs the same cleanup and the root layout returns the user to the auth flow.

Relevant files

  • store/auth-store.ts
  • store/preferences-store.ts and store/preferences-sync.ts
  • queries/use-auth.ts and queries/use-security.ts
  • mutations/use-update-profile-mutation.ts and mutations/use-security-mutations.ts
  • services/storage.ts