How asiertxo09/mvp-ai works
A. Project Type and Purpose
This is a full-stack, serverless application (“EduPlay”) combining
• A static, single-page frontend served via Cloudflare Pages
• Cloudflare Workers functions as the API layer (D1/SQLite backing store)
• A dedicated Node.js “ai-backend-groq” service for AI‐powered text, image, and audio processing
• Optional Python microservices (SDXL image and ASR/TTS audio) for local inference
B. Key File-Structure Insights
Top-level folders
• frontend/ – static HTML/CSS/JS, Cloudflare Workers in functions/, DB migrations in migrations/
• ai-backend-groq/ – Node.js server exposing AI endpoints (generate, transcribe, image)
• docs/ – developer guides
Configuration and deployment files
• frontend/wrangler.toml – Cloudflare Pages + Functions config
• ai-backend-groq/.env.example – environment variables for Groq and Hugging Face
• render.yaml – render.com deployment hints
3. Absence of ai-services-local in the file tree suggests it may be maintained separately but is described in README as optional Python microservices.
C. Architecture Overview (per README)
Browser → Cloudflare Pages (frontend + Workers) → D1 (SQLite)
│
└──▶ ai-backend-groq (Node.js)
└──▶ External Groq API / Hugging Face
└──▶ ai-services-local Python services (SDXL & Audio)
Cloudflare Pages CDN – Hosts static assets (HTML, CSS, JS, images).
3. Cloudflare Workers Functions – API gateway for /api/* routes, session middleware, D1 binding.
Node.js Backend (ai-backend-groq) – Express/Fastify-style server for
• /api/generate → Groq text generation
• /api/transcribe → ASR via Python or Hugging Face
• /api/image → SDXL via local service or Hugging Face
Python Microservices (optional) – FastAPI services
• SDXL image service (port 5005)
• Audio service with ASR and TTS (port 5006)
External AI APIs – Groq API, Hugging Face inference endpoints.
E. Relationships & Interactions
Node.js Backend → Local Python services (HTTP) if LOCAL_* URLs configured.
F. Architectural Patterns & Principles
Clear separation of concerns
• Presentation layer (static site + client-side logic)
• API layer (Workers)
• Business logic (Node.js AI backend)
• Specialized inference microservices (Python)
3. API Gateway pattern: Workers route and authenticate requests before passing to Node backend or DB.
4. Microservices for AI workloads, pluggable via environment variables (LOCAL_SDXL_URL, LOCAL_ASR_URL).
Frontend Focus
• D1 under Workers for database interactions.
Backend Focus
• Inside it, list sub-components: Groq client, Hugging Face client, asset generation scripts.
Microservices & External
• SDXL and Audio services under “Python Microservices” with ports 5005/5006.
Browser at the left, pointing to CDN.
5. In the backend block, show three internal API endpoints (/generate, /transcribe, /image) and their downstream calls to Python services or external APIs.