How klaritylab/klarity works
Project type and purpose
• This is a single‑page web application built with Vite, TypeScript, and React, styled with Tailwind CSS and shadcn‑ui components.
• It leverages Firebase (authentication, Firestore, storage) and several AI/external services (Gemini, custom chat APIs) to provide features like PDF upload & search, AI chat, journaling, task management, courses, and user profiles.
File structure
• Top level
– index.html → the SPA entry point
– public/ → static assets & uploads
– src/ → all application code
– firebase-key.json → BaaS credentials
– configuration files (tsconfig, vite.config.ts, tailwind.config.ts)
• Inside src/
– components/ → reusable UI pieces & layout (e.g. Navbar.tsx, ChatRoom.tsx)
– pages/ → route‑level components (Home, ChatPage, UploadPDFsPage, etc.)
– context/ → React Context (PDFContext) for global state
– hooks/ → custom hooks (use‑mobile, use‑toast)
– services/ → abstractions for external interactions (ai‑service.ts, firestoreServices.ts, chat‑service.ts)
– firebase/ → initialization & helper functions
– lib/ → utility libraries (journalGemini.ts)
– models/ → TypeScript interfaces (chat messages)
– styles/ → global CSS
• Architectural patterns
– Component‑based UI (Atomic and composite components in src/components/ui/)
– SPA routing (pages/ + main.tsx)
– Service layer abstraction in src/services/
– Context API for state management
Extract insights from the README
• Confirms tech stack: Vite, React, TypeScript, Tailwind CSS, shadcn‑ui