How sslithercode/laundryprogress works
Project type and purpose
• Project Type: Full-stack, serverless web application with an AI/ML integration.
• Purpose: Allow users to capture images of laundry machines, detect machine availability via an AI vision model, and display live status updates.
File structure
• app/ – Next.js “app router” frontend pages and API route endpoints (route.ts, route.tsx).
• components/ui/ – Reusable UI components (button, dropdown, navbar, webcam_stream, etc.).
• lib/utils.ts – Shared helper functions.
• Configuration files – next.config.mjs, tailwind.config.ts, tsconfig.json, postcss.config.mjs, .eslintrc.json.
• package.json – Defines React/Next.js, Tailwind, and any API-client dependencies.
README for additional insights
• Backend: A separate FastAPI Python service (laundry_api) providing machine data and AI processing with llama3-11b-vision.
• Database: Supabase for storing machine statuses or user data.
• Deployment: Frontend and API routes hosted on Vercel; Python FastAPI hosted separately (own deployment or localhost).
• External integrations: WASH_API_URL endpoints for fetching/pushing machine data.
Main components
a. Users (Web browser with webcam)
b. Next.js Frontend (React components under app/ and components/ui/)
c. Next.js API Routes (app/api/*) hosted as Vercel Serverless Functions
d. External FastAPI Service (laundry_api)
e. AI Model (llama3-11b-vision via Groq)
f. Supabase Database
g. Optional External Laundry Management API (WASH_API_URL)
Relationships and data flow
1. User opens browser → loads Next.js frontend (layout.tsx, page.tsx).
2. User triggers WebcamStream component → captures frame(s).
3. Frontend calls Next.js API route (get_machines, change_machine_status, update_machine_status).
4. API route forwards request to FastAPI service or directly calls external laundry API (process.env.WASH_API_URL).
5. FastAPI service invokes llama3-11b-vision to process the image → returns machine availability predictions.
6. FastAPI writes or reads from Supabase to persist status.
7. API route returns JSON response to frontend.
8. Frontend updates UI components (table, badges, progress) in real time.
Architectural patterns and design principles
• Serverless functions pattern for API endpoints (Next.js app/api folder = micro-endpoints).
• Component-based UI architecture (React + Tailwind CSS).
• Clear separation of concerns: UI vs. API vs. data vs. AI processing.
• Externalization of heavy ML workloads to a specialized service.
• Stateless frontend; all persistent state lives in Supabase or external APIs.