Project 1 — Basic LLM chatbot
Practice this question- Build in this order.
- Each project extends a capability, not necessarily a separate repository.
- These are future learning projects; the notes remain in this one file.
- Move forward when you can explain the trade-offs and demonstrate the acceptance criteria, rather than after an arbitrary number of days.
Requirements
An authenticated user submits bounded text and receives an answer. Handle provider refusal, timeout, empty output, and missing configuration clearly.
Architecture
React → Node API → approved LLM → validated answer → React. React collects input, Node owns credentials and policy, and the model performs the language task.
Technologies
Existing MERN/Next.js stack, one provider SDK, Zod, normal backend logs. No agent framework is required.
Database design
- Conversation and message records with tenant/user ownership, roles, timestamps, prompt/model version, and completion status.
- Store only required content under a retention policy.
API design
POST /chat accepts a message and authorized conversation ID. Reject oversized input and return structured failure codes.
AI design
Clear system task and unknown behavior; bounded recent history; one model call. Begin with supplied-text explanation so no private facts need retrieval.
Security
Server-side credentials, session checks, scoped conversation reads, escaping in React, quotas, and redacted logs.
Evaluation
Test ordinary input, empty/large input, injected request, refusal, timeout, and invented account facts. Check usefulness and safe failure, not exact wording.
Observability
Request/model spans, latency, tokens, error category, task outcome, and safe run ID.
Deployment
Existing Node/container/serverless hosting with request limits verified and secrets configured. Separate development and production credentials.
Interview questions
- “Why no agent?” Answer: one language task needs one call.
- “How do you prevent client key leakage?” Answer: the browser calls authenticated backend routes and never receives the provider secret.
Acceptance: No key in the client bundle; unauthorized conversations fail; provider failure never produces a fabricated successful answer.