Skip to content

Login + onboarding #22

Description

@ezrakoreen

Summary

Implement the app entry flow, including authentication/session management, login for existing users, post-signup onboarding for new users, and voice enrollment using an LLM-generated one-minute reading passage and pyannote Community-1 audio embedding.

Context

The app needs a complete entry flow before users can reach the main frontend. This includes a real authentication/session system, login for returning users, and onboarding for newly created users or any users who have not yet completed voice enrollment. After authentication succeeds, users should either be routed directly into the app or, if onboarding is incomplete, be taken through a voice-enrollment flow that captures an initial voice sample for later speaker-recognition and personalization features.

Tasks

  • Implement the backend authentication/session system needed to support real login behavior
  • Add backend endpoints for login, logout, and fetching the current authenticated session/user
  • Define how authenticated sessions are persisted and validated across requests
  • Build frontend auth bootstrap logic that checks whether a user is logged in when the app loads
  • Build the frontend login flow for users who already have an account
  • Add protected-route behavior so unauthenticated users are redirected to login
  • Route authenticated users with completed onboarding directly into the main app
  • Route newly created users, or existing users whose onboarding is incomplete, into the onboarding flow after authentication
  • Build a frontend onboarding flow that presents the generated passage and recording UI to the phone
  • Add a backend service that generates a one-minute onboarding passage using the existing LLM service pattern (app.services.llm_client.LLMClient) or a dedicated onboarding wrapper
  • Define the onboarding passage requirements so it is long enough for a useful voice sample and is safe to display immediately after account creation
  • Add frontend audio recording and upload for the onboarding read-aloud step
  • Add a backend endpoint to receive the recorded onboarding audio and associate it with the authenticated user
  • Integrate pyannote.audio with the pyannote/speaker-diarization-community-1 pipeline to derive an audio embedding from the uploaded sample
  • Persist the resulting voice embedding and onboarding-completion state for the user
  • Add validation and failure handling for invalid credentials, expired sessions, short recordings, missing audio, duplicate submissions, and embedding-generation failures
  • Ensure the onboarding flow can be resumed or retried if the account exists but voice enrollment is incomplete (eg. they entered email + password and didn't have time to onboard audio)
  • Add frontend tests for auth routing, login behavior, and onboarding behavior
  • Add backend tests for session creation/validation, login/logout, onboarding passage generation, audio upload, embedding persistence, and onboarding status

Acceptance Criteria

  • Feature works as described
  • No console errors
  • Tests pass
  • Existing users can log in and establish a valid authenticated session
  • Authenticated sessions persist across page refreshes and are validated by the backend
  • Unauthenticated users cannot access protected app routes
  • Existing users with completed onboarding are routed into the main app after login
  • Newly created users are routed into onboarding after authentication
  • Users in onboarding are shown an LLM-generated passage that takes about one minute to read aloud
  • Users can record and submit the onboarding audio from the frontend
  • The backend generates and stores a voice embedding for that user using pyannote Community-1
  • The user is marked onboarding-complete only after the embedding has been generated successfully
  • Users with incomplete onboarding can resume the flow on their next login
  • Clear error states are shown if login, session validation, recording, upload, or embedding generation fails

Notes

  • This ticket owns entry-state routing:
    • logged out -> login
    • logged in + onboarding incomplete -> onboarding
    • logged in + onboarding complete -> main app
  • This ticket should own the real auth/session mechanics required to support login, not just the login UI
  • Ticket 1 should assume this ticket is complete and that a valid authenticated user context already exists
  • Relevant backend integrations:
    • app.models.user.User will likely need auth/session-related support if it does not already exist
    • app.services.llm_client.LLMClient can be reused for generating the onboarding passage
    • a new auth/onboarding router will likely be needed because the current FastAPI app only mounts an empty users router
  • Suggested initial endpoints:
    • POST /auth/login
    • POST /auth/logout
    • GET /auth/session
    • GET /onboarding/status
    • POST /onboarding/passage
    • POST /onboarding/voice-enrollment
  • pyannote integration details should account for setup requirements from the official model card:
    • pyannote.audio must be installed
    • the Hugging Face model terms must be accepted
    • a Hugging Face access token is required to load pyannote/speaker-diarization-community-1
  • Models + reference code:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions