How trendy-design/llmchat works
Project Type and Purpose
• This is a full-stack, privacy-focused AI-powered chatbot platform built as a Turborepo monorepo.
• The “apps/web” directory holds a Next.js 14 application exposing both UI and serverless API routes.
• Shared libraries under “packages/” implement AI models/workflows, UI components, orchestration logic, local storage, and utility code.
• Primary goal: let users run advanced research and conversational workflows entirely in-browser (using IndexedDB) while orchestrating LLM calls to multiple external AI providers.
File Structure
• apps/web
– Next.js “app/” directory with pages (chat, sign-in/up, feedback, privacy, etc.)
– API routes under app/api (completion, feedback, mcp, messages) that call into shared AI and orchestrator packages.
– Configuration (Tailwind, Drizzle, Sentry) and a local Dexie.js (IndexedDB) setup for chat storage.
• packages/ai
– AI providers, tools, models, workflow definitions, and a web-worker setup for running orchestrated tasks client-side.
• packages/orchestrator
– A generic event-driven workflow engine with builders, context, and task lifecycle.
• packages/common & packages/shared
– React hooks, Zustand stores, types, context providers, utility functions, and environment/config.
• packages/ui
– A library of reusable design system components (buttons, dialogs, inputs, etc.).
• packages/prisma
– Prisma schema and migrations (used by desktop or any potential server component, even though apps/web persists chat locally).
• Other tooling
– Turborepo config, Bun, Husky, ESLint/Prettier, TypeScript configs, Tailwind config.
Key Architecture Insights from README
• Monorepo with clear separation: “apps” vs. “packages.”
• Frontend uses Next.js Server & Client Components, Framer Motion, Shadcn UI, Tiptap editor.
• Data persistence: all chat/history stored locally via Dexie.js (IndexedDB).
• AI integration: modular providers (OpenAI, Anthropic, etc.) behind a unified SDK.
• Workflow orchestration: event-emitter driven tasks (planning → gathering → analysis → reporting).
• No server-side chat storage; serverless functions only relay LLM calls and handle feedback, credit checks, or proxy needs.