React + TypeScript + Tailwind web app scaffolded with Vite.
npm run devstarts the local Vite server.npm run buildtype-checks and builds for production.npm run lintruns ESLint.npm run previewserves the production build locally.
MailBuddy uses an LLM to plan tool calls and write the final natural-language answer, while deterministic app code still retrieves facts and performs all calculations. Deploy the serverless routes with:
OPENAI_API_KEYOPENAI_MODELoptional, defaults togpt-4.1-mini
The browser never receives the OpenAI key.
/api/assistant/planreceives the user question, selected date range, current session chat history, temporal context, and a compact tool schema. It rewrites follow-up questions into standalone questions, then returns a validated tool-call plan.- The frontend executes approved deterministic MailBuddy tools locally.
/api/assistant/classify-spendcan classify compact order summaries into allowed spend categories such asgroceries. The frontend validates returned order IDs/categories/confidence and still performs all totals locally./api/assistant/finalizereceives the original question, standalone question, current session chat history, and compact tool results. It formats the final answer without doing retrieval or math.
If either route or OpenAI call fails, MailBuddy keeps the deterministic template response.
npm run dev serves these API routes through a Vite dev middleware so local
testing uses the same /api/assistant/* paths. Set OPENAI_API_KEY in your
local shell before starting the dev server.
Do not commit .env files.
src/componentsreusable UI components.src/layoutsapp-level layout components.src/pagesroute-level screens.src/hooksReact hooks.src/servicesdata access and API clients.src/typesshared TypeScript types.src/utilsshared utility functions.src/stylesapp-level style modules.
- Vite
- React
- TypeScript
- Tailwind CSS