How certifiedcodeboy/myvet works
Project type and purpose
• This is a purely front‑end, single‑page application (SPA) built with React and Vite.
• It implements an e‑commerce/marketplace‑style interface (buyer profile, cart, seller profile, product pages, chat, etc.) using Tailwind CSS for styling.
• The app ships as static assets (HTML/CSS/JS) and loads data from local JSON files under src/dbs.
File structure
• Top level:
– index.html: application shell served to browser
– src/main.jsx: React entry point, mounts <App> into the DOM
– src/App.jsx: top‑level component, configures Router and global Context providers
– Vite/Tailwind config files (vite.config.js, tailwind.config.js, postcss.config.js)
• src/components: all UI components (pages, widgets, navbars, forms)
• src/contexts: React Context providers (CartContext, UserContext, ProductsContext, etc.) that manage app state
• src/Assets and src/dbs: static images and JSON data
Key architectural observations
• Presentation layer: React components
• State management layer: Context API
• Data layer: local JSON “db” files, later replaceable by API calls without changing UI logic
• Build/deploy pipeline: Vite dev server for development, Vite build produces static files to be hosted on any CDN or static host
Main components
• Browser / Client
• Static content host (CDN or web server)
• Vite (Dev‑Server & Build Tool)
• React Application
– App component (Router + Context providers)
– Context providers (UserContext, CartContext, etc.)
– UI Components (Navbar, Home, ProductPage, Cart, Chat, etc.)
• Asset store (src/Assets images)
• Local data store (src/dbs JSON)
• External services (future APIs in place of JSON files, authentication, payment)
Relationships and interactions
• User interacts with UI components in the browser
• UI components request data from Context providers
• Context providers read/parse JSON files (or fetch from external API)
• Context updates propagate to subscribing components via React Context
• Vite dev server serves the files during development; Vite build bundles everything for production
Important architectural patterns
• Single‑Page Application with client‑side routing (React Router)
• Unidirectional data flow: Components → Context APIs → Data sources → Context → Components
• Modular component design: each page or UI widget in a separate file
• Separation of concerns: styling (Tailwind) vs. logic (JSX) vs. configuration (Vite/Tailwind configs)