Design speaking scenarios and auth/profile API
System Design Task: Speaking-Scenario Practice Feature + MVP Auth API
You are designing a new speaking-scenario practice capability for a language-learning app. Users select real-life scenarios (e.g., ordering coffee, job interview), practice by speaking, and receive real-time feedback and scores. You will also design a small MVP authentication/profile API to support this feature.
Part A — Speaking-Scenario Practice Feature
-
Functional Scope:
- Allow users to browse, search, and select scenarios.
- Present prompts to the user.
- Record user responses (speech).
- Provide real-time feedback and a score on the user's response.
- Track user progress through scenarios.
- Enable pausing and resuming practice sessions.
-
Architecture:
- Propose necessary services/components (e.g., content service, session orchestration, speech-to-text (ASR), LLM for feedback, scoring, personalization, analytics).
- Define APIs for these services and the data flow between the client, services, and data stores.
-
Data Model:
- Define schemas for
Scenario,Turn/Prompt,UserSession,Attempt, andUserProgress. - Describe indexing strategies for efficient scenario discovery and session retrieval.
- Define schemas for
-
LLM/ASR Integration:
- Select appropriate ASR and feedback-generation models.
- Describe the prompt strategy for the LLM.
- Define guardrails, latency targets, token/cost budgets, and fallback mechanisms for model failures or rate limiting.
-
Personalization:
- Explain how to adapt scenario difficulty, vocabulary, or pace based on user proficiency.
- Identify key signals and features to log for personalization.
-
Scale and Reliability:
- Estimate QPS, concurrency, and storage growth.
- Propose strategies for caching, streaming, and backpressure.
- Address handling of timeouts, retries, idempotency, and partial failures.
-
Safety and Compliance:
- Consider content moderation, PII handling, data retention policies, privacy controls, and localization.
- Address offline or poor-network connectivity scenarios.
-
Experimentation and Metrics:
- Define success metrics (e.g., learning outcomes, engagement).
- Establish guardrail metrics.
- Describe how to A/B test different prompt variations or feedback mechanisms.
Part B — MVP API: User Authentication and Profile Management
-
Endpoints:
Register(email + password)Authenticate(login)Retrieve ProfileUpdate ProfileDelete Account- Specify request/response shapes and appropriate HTTP status codes for each endpoint.
-
Authentication & Authorization (AuthN/Z):
- Choose between session-based authentication and JWT.
- Define token Time-To-Live (TTL) and refresh mechanisms.
- Discuss secure cookie vs. header usage for token transmission.
- Describe password hashing strategy (can be mocked) and account lifecycle management.
-
Storage:
- Use in-memory data structures for users, sessions/tokens, and profiles.
- Define primary keys and concurrency handling for these in-memory stores.
-
Non-Functionals:
- Implement rate limiting.
- Specify input validation rules.
- Outline error handling strategies.
- Ensure idempotency for
RegisterandDelete Accountoperations. - Describe logging and minimal observability requirements.
-
Constraints:
- Focus on MVP first, deferring complex edge cases.
- AI tools are permitted.
- Optimize for development velocity while maintaining clear, usable APIs.
-
Evaluation:
- Explain the trade-offs made in your design decisions.
- Justify your data modeling choices.
- Discuss how this MVP API could evolve into a production-ready service.
AI interview prep
Core dilemma
Balancing real-time, high-quality AI-driven feedback for spoken language against strict latency, cost, and accuracy requirements, while also designing a robust and scalable MVP authentication system.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Design speaking scenarios and auth/profile API
System Design Task: Speaking-Scenario Practice Feature + MVP Auth API
You are designing a new speaking-scenario practice capability for a language-learning app. Users select real-life scenarios (e.g., ordering coffee, job interview), practice by speaking, and receive real-time feedback and scores. You will also design a small MVP authentication/profile API to support this feature.
Part A — Speaking-Scenario Practice Feature
-
Functional Scope:
- Allow users to browse, search, and select scenarios.
- Present prompts to the user.
- Record user responses (speech).
- Provide real-time feedback and a score on the user's response.
- Track user progress through scenarios.
- Enable pausing and resuming practice sessions.
-
Architecture:
- Propose necessary services/components (e.g., content service, session orchestration, speech-to-text (ASR), LLM for feedback, scoring, personalization, analytics).
- Define APIs for these services and the data flow between the client, services, and data stores.
-
Data Model:
- Define schemas for
Scenario,Turn/Prompt,UserSession,Attempt, andUserProgress. - Describe indexing strategies for efficient scenario discovery and session retrieval.
- Define schemas for
-
LLM/ASR Integration:
- Select appropriate ASR and feedback-generation models.
- Describe the prompt strategy for the LLM.
- Define guardrails, latency targets, token/cost budgets, and fallback mechanisms for model failures or rate limiting.
-
Personalization:
- Explain how to adapt scenario difficulty, vocabulary, or pace based on user proficiency.
- Identify key signals and features to log for personalization.
-
Scale and Reliability:
- Estimate QPS, concurrency, and storage growth.
- Propose strategies for caching, streaming, and backpressure.
- Address handling of timeouts, retries, idempotency, and partial failures.
-
Safety and Compliance:
- Consider content moderation, PII handling, data retention policies, privacy controls, and localization.
- Address offline or poor-network connectivity scenarios.
-
Experimentation and Metrics:
- Define success metrics (e.g., learning outcomes, engagement).
- Establish guardrail metrics.
- Describe how to A/B test different prompt variations or feedback mechanisms.
Part B — MVP API: User Authentication and Profile Management
-
Endpoints:
Register(email + password)Authenticate(login)Retrieve ProfileUpdate ProfileDelete Account- Specify request/response shapes and appropriate HTTP status codes for each endpoint.
-
Authentication & Authorization (AuthN/Z):
- Choose between session-based authentication and JWT.
- Define token Time-To-Live (TTL) and refresh mechanisms.
- Discuss secure cookie vs. header usage for token transmission.
- Describe password hashing strategy (can be mocked) and account lifecycle management.
-
Storage:
- Use in-memory data structures for users, sessions/tokens, and profiles.
- Define primary keys and concurrency handling for these in-memory stores.
-
Non-Functionals:
- Implement rate limiting.
- Specify input validation rules.
- Outline error handling strategies.
- Ensure idempotency for
RegisterandDelete Accountoperations. - Describe logging and minimal observability requirements.
-
Constraints:
- Focus on MVP first, deferring complex edge cases.
- AI tools are permitted.
- Optimize for development velocity while maintaining clear, usable APIs.
-
Evaluation:
- Explain the trade-offs made in your design decisions.
- Justify your data modeling choices.
- Discuss how this MVP API could evolve into a production-ready service.