How nandhuanil/fruitbunch works
This repository is a single-page React application built with Vite, plus a separate serverless backend project under functions/. The overall shape is: browser UI in src/, shared client state and route guards in src/context and src/utils, and a backend function runtime in functions/ for server-side logic.
The frontend entrypoints are src/main.jsx and src/App.jsx. main.jsx bootstraps the React app, while App.jsx is the central composition point for routing and global layout. The app uses a typical SPA structure rather than server-rendered pages.
The UI shell is made of reusable cross-cutting components in src/components: Navbar, Footer, ScrollToTop, and WhatsAppFloat. These are likely mounted globally so navigation, page-reset behavior, and the floating WhatsApp contact action are available across the whole site.
The route map is organized into feature pages in src/pages. The pages fall into a few clear clusters: marketing/content pages (Home, About, Corporate, Subscription, PrivacyPolicy, TermsAndCondition), authentication/account pages (Login, Signup, ForgotPassword, Profile), purchase flow pages (Cart, Checkout, OrderConfirm), and an AdminPanel for privileged management.
Client-side state is centered on src/context/CartContext.jsx. That suggests cart data is held in React context and shared across product/browse, cart, and checkout views without prop drilling. This context is the main in-app state boundary for the commerce flow.
Access control is separated into route-guard utilities in src/utils: PrivateRoute.jsx and AdminRoute.jsx. These imply two authorization tiers in the frontend: authenticated user-only areas and admin-only areas. That makes the routing layer an important architectural boundary, not just a navigation concern.
Authentication and user identity are likely backed by Firebase, as indicated by firebaseConfig.js at the root. The app probably uses Firebase on the client side for auth and possibly user data, while the protected profile/admin routes rely on that identity state.
There is also a distinct backend/serverless subsystem under functions/ with its own package.json, index.js, and Catalyst configuration files (.catalystrc, catalyst.json, app-config.json). This is a separate deployment/runtime boundary from the Vite app, and it likely hosts backend operations that the frontend calls indirectly.
The project appears to mix client-side and backend integrations rather than relying on a single monolith. The front end reads environment-specific settings from .env.development and .env.production, and the backend has its own .env, which suggests environment isolation between browser config and server-side secrets.
Styling and build tooling are standard modern frontend infrastructure: Tailwind CSS (tailwind.config.js), PostCSS (postcss.config.js), ESLint (eslint.config.js), and Vite (vite.config.js). public/site.webmanifest indicates the app includes PWA-style metadata or installable-web-app support.
In architectural terms, the primary data flow is: user interacts with the React SPA, route guards decide access, shared cart state drives checkout, auth state is managed via Firebase-backed identity, and server-side function calls go through the separate functions/ runtime. The admin panel is a distinct privileged surface on top of the same frontend and backend foundations.
Main entry points: App.jsx App Shell · index.js Functions Runtime · firebaseConfig.js Firebase Config · PrivateRoute.jsx Private Route
Components 21
Frontend SPA
Vite-based React single-page application in src/.
- Bootstrap · Mounts the React application into the browser DOM.
src/main.jsx - App Shell · Central composition for routing and global layout.
src/App.jsx - Navbar · Primary navigation component used across the app.
src/components/Navbar.jsx - Footer · Global footer component for site-wide layout.
src/components/Footer.jsx - Scroll Top · Resets scroll position during route changes.
src/components/ScrollToTop.jsx - WhatsApp Float · Floating contact shortcut shown across the site.
src/components/WhatsAppFloat.jsx - Cart State · Shared cart and checkout state boundary for the commerce flow.
src/context/CartContext.jsx - Private Route · Restricts authenticated-user-only areas.
src/utils/PrivateRoute.jsx - Admin Route · Restricts privileged admin-only areas.
src/utils/AdminRoute.jsx - Home · Primary landing and discovery page.
src/pages/Home.jsx - Account Pages · Login, signup, password recovery, and profile surfaces.
src/pages/Login.jsx - Commerce Pages · Cart, checkout, and order confirmation screens.
src/pages/Cart.jsx - Content Pages · About, corporate, subscription, and legal information pages.
src/pages/About.jsx - Admin Panel · Privileged management interface inside the SPA.
src/pages/AdminPanel.jsx
Serverless Backend
Separate runtime and deployment boundary under functions/.
- Functions Runtime · Separate backend runtime for server-side logic and integrations.
functions/index.js - Function Package · Backend dependency and deployment definition for the serverless project.
functions/package.json
Build & Config
Repository-wide tooling, environment, and app configuration.
- Firebase Config · Client-side Firebase initialization and identity wiring.
firebaseConfig.js - Env Config · Environment-specific browser and server configuration files.
.env.development - Vite Config · Frontend build and dev server configuration.
vite.config.js - Tailwind Config · Utility CSS framework configuration for the UI.
tailwind.config.js - Web Manifest · Installable-web-app metadata for the public site.
public/site.webmanifest
Connections 23
- Bootstrap → App Shell: renders · Application bootstrap hands off to the SPA shell.
- App Shell → Navbar: uses · Global layout includes site navigation.
- App Shell → Footer: uses · Global layout includes the footer.
- App Shell → Scroll Top: wraps · Route transitions reset scroll position.
- App Shell → WhatsApp Float: mounts · Floating contact action is available site-wide.
- App Shell → Home: routes to · Landing page is one of the primary SPA destinations.
- App Shell → Content Pages: routes to · Static and informational pages are routed from the shell.
- App Shell → Account Pages: routes to · Auth and profile pages are routed from the shell.
- App Shell → Commerce Pages: routes to · Shopping and order-flow pages are routed from the shell.
- App Shell → Admin Route: protects · Admin surface is gated by privileged routing.
- App Shell → Private Route: protects · Authenticated areas are guarded at the route layer.
- Admin Route → Admin Panel: guards · Admin panel is accessible only through the admin guard.
- Private Route → Account Pages: guards · Protected account and profile areas rely on auth checks.
- Cart State → Commerce Pages: drives · Cart state powers cart and checkout screens.
- Firebase Config → Account Pages: authenticates · Client identity state supports login and profile flows.
- Firebase Config → Private Route: verifies · Frontend access control depends on authenticated identity.
- Functions Runtime → Function Package: defined by · Backend runtime is packaged and deployed separately.
- Functions Runtime → Firebase Config: integrates · Server-side logic complements the client identity/data layer.
- Env Config → Vite Config: configures · Environment settings feed the frontend build and runtime.
- Env Config → Functions Runtime: configures · Backend runtime uses its own isolated environment settings.
- Vite Config → Bootstrap: builds · Vite compiles and serves the React entrypoint.
- Tailwind Config → App Shell: styles · Tailwind provides the UI styling system.
- Web Manifest → App Shell: supports · Manifest supports PWA-style browser installation metadata.