How wolefabikun/green-thumb-drive works
Project type and purpose
• This is a full-stack web application (“Green Thumb Guide”) that provides personalized plant care advice and retrieves video content via a Retrieval-Augmented Generation (RAG) pipeline.
• Frontend: Next.js + TypeScript (“client” folder)
• Backend: Flask API (“server/app.py”)
• Data/Services: VideoDB (vector store), VideoDBRetriever, LlamaIndex, OpenAI API
File structure
• Top-level:
• client/ – Next.js app
– src/app – Next.js App Router (layout.tsx, page.tsx)
– src/components – React UI components (AvatarPlant, Chat, Loader, etc.)
– src/lib/utils.ts – helper functions
– public/ – static assets
– next.config.mjs, tsconfig.json, bun.lockb, package.json, tailwind.config.ts
• server/ – Flask backend
– app.py – main Flask routes and RAG pipeline orchestration
– requirements.txt – Python dependencies (Flask, LlamaIndex, VideoDBRetriever)
• No separate infra as Terraform; environment configured via .env
Key insights from README
• Uses a RAG pipeline: user query → backend invokes VideoDBRetriever + LlamaIndex → optionally calls OpenAI to generate or refine answers
• VideoDB is both the primary database (vector store) and content source
• The frontend communicates with the Flask backend over HTTP
Main components & relationships
a. Frontend (Next.js)
• UI: React components render chat, video cards, plant advice
• Fetch layer: calls Flask backend endpoints (e.g., POST /api/query)
b. Backend API (Flask)
• Receives queries, maintains session state if needed
• Instantiates RAG pipeline:
• VideoDBRetriever – semantic video search
• LlamaIndex – organizes retrieved chunks + query understanding
• OpenAI API – optional generation/refinement
• Returns JSON payload with text answer + video recommendations
c. VideoDB (Vector Store)
• Stores video embeddings and metadata
• Queried by VideoDBRetriever using user query embeddings
d. External Services
• OpenAI API – text generation/completion
• VideoDB API – initial indexing and embedding creation
Architectural patterns & design principles
• Separation of concerns: frontend-only UI/rendering vs. backend orchestration
• RAG pipeline pattern: retrieval (VideoDBRetriever) → augmentation (LlamaIndex) → generation (OpenAI)
• Modular code organization: React UI in reusable components, backend logic in a single Flask app (could evolve into microservices)
• Environment-based configuration via .env for API keys