How p1manav/figmaguard works
Project Type and Purpose
• This is a full-stack web application (“Automated Testing Platform”) with two distinct user flows:
a. Test an existing Figma design or live URL against an SRS.
b. Generate a website from an SRS via AI, deploy it, then test it.
• Frontend: Next.js + TypeScript + Tailwind.
• Backend: Python Flask + Playwright + Supabase + AI & external services.
Main Architectural Layers and Components
A. Client Layer
• Next.js App Router
• React Components & Pages (under frontend/app, frontend/components, frontend/hooks)
• CSS (Tailwind + global styles)
B. API Layer
• Flask server (backend/server.py) exposing REST endpoints for:
– Authentication callbacks
– SRS upload & parsing
– Test request creation
– Code-generation request
– Fetching test results
C. Test Engine
• backend/scripts/
– test_runner.py orchestrates different testers:
functional, UI/UX, accessibility, compatibility, performance
– Each tester uses Playwright under the hood
D. Data & Storage
• Supabase
– Auth (Google OAuth)
– PostgreSQL (tables: user_profiles, test_requests, test_reports, execution_logs)
– Storage buckets (SRS-docs, test-reports, generated-sites)
• Local temp storage for intermediate PDFs (backend/temp/)
E. AI & Integration Services
• Groq LLM (code generation)
• Gemini LLM (content extraction, analysis)
• GitHub API (repo creation & commit)
• Vercel API (deployment)
F. External Clients & Users
• Browser / End-user
• CI or Dev Tools invoking scripts (if any)
Relationships & Data Flows
1. User → Browser → Next.js UI
2. UI → HTTP → Flask API
3. Flask API ↔ Supabase (Auth, DB, Storage)
4. Flask API → Gemini & Groq LLMs → code or analysis results
5. For “Generate & Test”:
a. Flask → GitHub API → new repo
b. Flask → Vercel API → deploy site
c. After deploy, URL returned to Flask
6. Flask API → invokes test_runner.py → Playwright tests against target URL
7. Test scripts → write results/logs → Supabase Storage & DB
8. UI polls or listens for test-status updates → displays results
Architectural Patterns & Principles
• Layered architecture: clear separation between Presentation (Next.js), API (Flask), Business Logic (scripts/utils), Data (Supabase).
• Modular test engine: each test type is a plug-in under backend/scripts/.
• Single monolith for backend, but integration with external microservices (LLMs, GitHub, Vercel).
• Use of SDKs/clients in backend/utils/ for external services (supabase_client, llm_client, gemini_client).