How gautamkmahato/match-fox-v3 works
Project type and purpose
• This is a full-stack Next.js application for conducting and managing technical interviews, job postings, resume generation, payments, and related user flows. The app/ directory contains both React frontend pages and API routes (app/api/...). Utility libraries, services, and external integrations are organized under lib/ and app/service/.
File structure
• Top-level app/ contains:
• (auth), (legal), home, dashboard, payment, privacy, settings, success – React pages and nested UI components.
• app/api/… – Next.js API route handlers for features: checkout (Razorpay), PayPal, interviews, jobs, resume, reports, user management, webhooks.
• app/context/ and app/hooks/ – React Contexts & custom hooks for state management and data fetching on the frontend.
• app/service/… – Client-side service modules that call the API routes or external services.
• lib/ folder provides shared utilities and integrations (payment SDK clients, ratelimiter, queue, Supabase client, prompts, helpers).
• Root config files: next.config.mjs, middleware.js, jsconfig.json, postcss.config.mjs etc.
README
a. Main components
• Client (Browser/SPA) – Next.js front-end pages, React components, Context/hooks.
• Next.js Server – handles SSR, SSG, and API routes under app/api/….
• Database – Supabase (via lib/supabase/client.js).
• External Services – Payment Gateways (Stripe, Razorpay, PayPal), Authentication (Clerk webhooks), LLM/chat agent (OpenAI or Gemini via lib/queue/geminiQueue.js), file storage (resume uploads).
• Background/Queue – geminiQueue for async LLM tasks.
b. Relationships & interactions
1. Client issues HTTP requests to Next.js Server:
– Page navigations & data fetching (React → Next.js server → Supabase).
– API calls (e.g., checkout, create-interview, generate-questions).
2. Next.js API routes orchestrate logic:
– Invoke service modules in app/service/….
– Service modules call external SDKs (lib/paypal, lib/razorpay), Supabase, LLM queue.
3. Webhooks from Payment Gateways & Clerk feed into /api/webhooks/....
4. Background queue processes heavy tasks (chat agent, report generation).
5. Data persisted in Supabase; client subscribes or polls for updates.
c. Architectural patterns & design principles
• App Router (Next.js) – Co-located UI and backend code.
• Layered separation: Presentation (React + Context + Hooks), API layer (Next.js routes), Service/Domain logic (app/service), Infrastructure/Integration (lib/*).
• Single codebase hosting static assets (public/) and serverless functions.
• Event-driven (webhooks, queues) for async tasks.
d. Key technologies & frameworks
• Next.js (App Router, serverless API routes)
• React + Context + Custom Hooks
• Supabase (database + auth? via lib/supabase)
• Payment SDKs: PayPal, Stripe, Razorpay
• Background queue (GeminiQueue)
• Clerk (authentication webhook)
• AI LLM prompts & chat integration