How sarankumar1325/tasklyai works
Project Type and Purpose
• TaskFlowAI is a full-stack, serverless, single-page application (SPA) for AI-powered task management.
• Frontend: React + Vite + TypeScript + Tailwind + shadcn/ui
• Backend-as-a-Service: Supabase (PostgreSQL, real-time, RLS, Edge Functions)
• Authentication: Clerk
• AI Services: Groq Llama 3.3 70B via a Supabase Edge Function
File Structure
Top-level layout:
• public/ – static assets and manifest
• src/ – React app
– components/ (ai, auth, layout, tasks, ui, providers)
– pages/ (dashboard, AI chat, task views, settings)
– hooks/ (Supabase tasks, theme, debouncing)
– integrations/supabase (client, types)
– services/groqService.ts (edge function client stub)
– lib/ utilities (performance, Supabase-Clerk glue)
• supabase/ – database migrations, row-level security, Edge Functions (chat-with-tasks)
• config files: vite.config.ts, tailwind.config.ts, vercel.json, tsconfig, etc.
README for Architectural Insights
• Frontend communicates directly with:
• Clerk for auth (publishable key, session tokens)
• Supabase client (data CRUD and real-time subscriptions)
• Supabase Edge Function (/api/chat-with-tasks) for AI chat
• Edge Function calls Groq AI API using the user’s tasks payload
• Supabase holds the tasks table with RLS policies per user
• Vercel hosts the frontend SPA and rewrites all routes to index.html
a. Main Components
1. Client (Browser SPA)
• React components (pages, UI library)
• State & data layer: TanStack Query, React Hook Form, Zod
2. Authentication Service
• Clerk (hosted, issues JWT/session)
3. BaaS & Database
• Supabase client → PostgreSQL
• Row-Level Security (per-user data isolation)
• Real-time subscriptions
4. Serverless Functions
• Supabase Edge Function: chat-with-tasks
5. External AI Service
• Groq AI API (Llama inference)
6. Hosting & Deployment
• Vercel (frontend, environment config)
b. Relationships and Data Flows
• SPA → Clerk: user login/SSO, token exchange
• SPA → Supabase DB: fetch/create/update/delete tasks
• SPA ← real-time updates (task events)
• SPA → Edge Function: POST user message + tasks → returns AI response + stats
• Edge Function → Groq AI API: forward prompt, receive inference
• Groq AI → Edge Function → SPA
• Vercel serves SPA and proxies API requests
c. Architectural Patterns
• Client-Server (SPA + BaaS)
• Serverless (Edge Functions for AI)
• Micro-frontend-style componentization (shadcn/ui + custom modules)
• Real-time pub/sub (Supabase subscriptions)
• CQRS-style separation:
• Queries (TanStack Query fetch)
• Commands (Supabase mutations)
d. Key Technologies & Frameworks
• Frontend: React 18, Vite, TypeScript, Tailwind CSS, shadcn/ui, React Router, TanStack Query, Zod, React Hook Form
• Auth: Clerk
• BaaS/DB: Supabase (PostgreSQL, RLS, real-time)
• Serverless: Supabase Edge Functions (TypeScript)
• AI: Groq Llama 3.3 via HTTP API
• Charts & UI: Recharts, Radix UI primitives, Lucide React, Sonner
• Hosting: Vercel
Detail and Coverage
• Include:
• Clerk auth flow before Supabase requests
• Vercel hosting layer wrapping the SPA and environment variables