How benmed00/lucid-web-craftsman works
Project type and purpose
• This is a full-stack e-commerce web application (“Lovable”) built with a React+TypeScript SPA on Vite, a lightweight Node.js server layer, and Supabase (Postgres + auth) plus Stripe for payments. It offers public pages (products, blog, cart, checkout) and a protected admin dashboard for managing inventory, orders, customers, marketing assets, etc.
File structure
• Top level:
• public/ – static assets served verbatim
• src/ – main app source
• server.js / server.cjs – Node.js server entry points (serves built SPA, handles any SSR, API proxying)
• supabase/ – DB migration configs
• Within src/:
• pages/ – React page components (public and /admin)
• components/ – UI and layout components, including shadcn-ui primitives
• context/ + hooks/ – state management and custom hooks (auth, cart, CSRF, toast)
• services/ + integrations/ – wrappers around HTTP calls to Supabase or 3rd-party APIs (stripe via src/lib/stripe.ts)
• api/mockApiService.ts – mock implementations for local dev/testing
• Configs: Vite, Tailwind, tsconfig, ESLint, Prettier
README for additional insights
• Confirms Vite + TypeScript + React + shadcn-ui + Tailwind CSS
• Deployment via Lovable platform (essentially static hosting + serverless supabase/stripe)
• No separate microservices—everything lives in one repo
a. Main components:
1. User’s Web Browser (client)
2. Frontend SPA (React on Vite)
3. Node.js Server (server.js)
4. Supabase Backend (Postgres DB + Auth)
5. Stripe Payments
6. Static Asset Store (public/assets)
7. Mock API Service (dev/testing only)
b. Relationships & interactions:
• Browser ↔ Frontend SPA: React UI pages call hooks/services → Node.js server or directly to Supabase
• Frontend ↔ Node.js Server: asset requests; optional API proxy (e.g., CSRF tokens, SSR)
• Frontend ↔ Supabase: data read/write (products, cart, orders, user profile) via src/integrations/supabase/client.ts
• Frontend ↔ Stripe: checkout creation through src/lib/stripe.ts or via server endpoint
• Node.js Server ↔ Supabase/Stripe: used for protected operations or securing secret keys
• Node.js Server ↔ Static Asset Store: returns images, robots.txt, index.html
• Dev/Test: SPA ↔ mockApiService (when supabase is unavailable)
c. Architectural patterns & principles:
• SPA separation: pages ↔ shared components ↔ UI primitives
• Context API for global state (CartContext, Auth context)
• Service layer (src/services) for encapsulating API calls
• Integration layer (src/integrations) for 3rd-party clients
• Admin protected routes and RBAC via ProtectedAdminRoute
• Migrations defined under supabase/ for versioned schema
d. Key technologies:
• Vite (dev server & build)
• React + TypeScript + shadcn-ui + Tailwind CSS
• Node.js + Express-style static serving (server.js)
• Supabase (Postgres + Auth + Storage)
• Stripe SDK
• Vitest/Jest for tests (src/tests)