How hac1es/friendwithbooks-frontend works
Project Type and Purpose
• This is a single-page application (SPA) front-end built with Vue 3 and Vite.
• It provides both customer and admin views (e.g., product listings, cart, checkout, admin dashboard and CRUD interfaces).
• It relies on Supabase for authentication and database, uses Axios for any custom API calls, and is deployed as a static site (Netlify).
File Structure Analysis
• Top-level config & metadata:
• package.json / lockfile, vite.config.js, tailwind.config.js, postcss.config.js, jsconfig.json, netlify.toml
• Public assets:
• public/ (favicon, static files)
• index.html
• Source code (src/):
• main.js – entry point, mounts Vue app
• App.vue – root component, hosts <router-view/>
• router/index.js – Vue Router setup with route definitions
• store/index.js – state management (Vuex or Pinia)
• assets/ – global CSS and images
• components/ – reusable UI primitives (cards, buttons, headers, filters, chat popups)
• pages/ – route-level components (LandingPage, Products, CartView, AdminDashboard, Login, etc.)
• composables/ – reusable logic (useFilter, useCountdown)
• utils/ – wrappers around Axios, Supabase client, URL helpers
• Build & deployment:
• Vite handles bundling; Netlify config for CI/CD.
Key Architectural Patterns
• Component-based UI: small, focused components compose pages.
• Router-driven navigation: each .vue in pages/ maps to a route.
• Centralized store: shared state (e.g., cart, user session).
• Composables for encapsulating reactive logic.
• Utility layer abstracts external service calls (Axios, Supabase).
Main Components & Their Relationships
• Browser / Client
↳ Serves index.html → loads bundled Vue app
• Vue Application
• Root (App.vue)
• Router → delegates to Page components
• Store → global state accessible by pages/components
• Composables & Utils → data-fetching, business logic
• Page Components
• Customer-facing: LandingPage, Products, ProductDetail, CartView, Checkout, Login/Signup, UserProfile
• Admin-facing: AdminDashboard, AdminProducts, OrderCRUDAdmin, StatAdmin
• Reusable Components
• UI elements (cards, headers, breadcrumb, filter panels)
• External Services
• Supabase (authentication, database)
• Any REST APIs via Axios (payment gateway, third-party integrations)
• Deployment
• Vite build → static assets → Netlify CDN