
Overview
A full-stack AI customer support chat agent built for the Spur take-home assignment. Users can chat with an AI agent that answers questions about store policies using Google Gemini as the LLM backend.
(Preview)
Screens


Features
- (001)Channel-agnostic LLM servicegenerateReply(history, message) takes plain arrays, so a WhatsApp or Instagram handler can reuse it
- (002)Policies in the database, cached in RedisLoaded on first request and cached for 1 hour — update policies without redeploying
- (003)Escalation handled in code“Talk to a human” is caught by a keyword check and answered without calling Gemini
- (004)GuardrailsOut-of-scope questions get a polite refusal; unknown questions are directed to support email
- (005)Separation of concernsRoutes handle HTTP, services handle business logic
Tech stack
- React
- TypeScript
- Express
- Gemini
- FrontendReact, TypeScript, Tailwind CSS, Vite
- BackendNode.js, Express, TypeScript
- DatabasePostgreSQL
- CacheRedis (Upstash)
- LLMGoogle Gemini (gemini-2.5-flash)
Architecture
- POST /chat/message
- Input validation (empty, too long)
- Escalation check in code
- Policies — Redis, then DB on miss
- Gemini reply with last 10 messages
- Stored in PostgreSQL conversations
LLM notes
- ProviderGoogle Gemini (gemini-2.5-flash)
- HistoryLast 10 messages sent for context
- InputCapped at 2000 characters server-side
- Policy cacheKey spur:policies, 1-hour TTL