How senbo1/chat0 works
Project type and purpose
• Chat0 is a full-stack, privacy-first AI chat application built with Next.js (App Router) and React.
• It provides a local browser database (Dexie/IndexedDB) for chat history, and exposes lightweight API routes (/api/chat, /api/completion) that forward user queries to external AI services (OpenAI, Google Gemini, etc.) using the user’s own API key.
File structure
Top-level directories and files:
• app/ – Next.js “App Router” folder containing server-side pages, layouts, global styles, and the two API endpoints.
• frontend/ – Client-side React component library broken down into UI, hooks, routes, and Dexie wrappers.
• lib/ – Shared utility functions and type definitions used both on server and client.
• hooks/ – Miscellaneous React hooks used across the client.
• next.config.ts & tsconfig.json – Next.js and TypeScript configuration.
• public/ – Static assets.
• package.json & pnpm-lock.yaml – Dependency management.
Architectural hints:
• Separation of concerns:
– Server layer: Next.js API routes (in app/api) handle HTTP requests, interact with external AI services.
– Client layer: React UI components (frontend/components), state stores (frontend/stores), local database (frontend/dexie).
• Persistance: Dexie (IndexedDB) for offline chat storage.
• State management: simple stores (APIKeyStore, ModelStore), React context & hooks.
README for additional insights
• Privacy-first: all data stays in browser, no server-side database.
• BYO API keys: user provides and stores keys locally.
• Multi-model support & optimized React performance.