How md-iftikher/wereisit-client works
Project type and purpose
• This is a full-stack, client-heavy React single-page application (SPA) built with Vite.
• Purpose: a Lost & Found items platform (“WhereIsIt”) that uses Firebase for authentication and an external API for storing/retrieving item posts.
File structure
• Top-level:
• public/, index.html — static assets served by Vite/Firebase Hosting
• firebase.json, .firebaserc — deployment & hosting config
• vite.config.js — build tool config
• src/:
• Components/ — reusable UI pieces (Navbar, Footer, Accordion, TableView/CardView)
• Components/HomeComponent/ — homepage-specific widgets (Banner, LatestItems, FAQ, Testimonials)
• Firebase/firebase.config.js — initializes Firebase SDK
• Provider/AuthProvider.jsx — React Context for auth state & token management
• Router/AppRouter.jsx & PrivateRoutes.jsx — client-side routing & route protection
• Pages/ — route-level views (HomePage, Login, Register, AddLostItem, AllItems, MyItems, ItemDetails, ErrorPage)
• main.jsx — mounts React App to the DOM
README insights
• React 18 + Vite, React Router DOM, Tailwind CSS
• Firebase Authentication (email/password & Google)
• External REST API for items (GET /getAllitems, POST /Additems)
• Environment variable VITE_API_LINK holds backend URL
a. Main components
1. Client Browser (React SPA)
2. Firebase Authentication Service
3. External REST API & Data Store (Lost & Found items)
4. Firebase Hosting / CDN
5. Optional: LocalStorage (JWT/session)
b. Relationships & interactions
• User → Browser UI (React components & pages)
• UI ↔ AuthProvider → Firebase Auth (sign-in/up, token issuance)
• UI ↔ Axios → External API (fetch/post items)
• Main.jsx/AppRouter orchestrate page loads & protected routes via PrivateRoutes
• Firebase Hosting serves static bundle; Firebase CDN caches assets
• Browser stores JWT in localStorage and sends it on API requests
c. Architectural patterns & principles
• SPA with component-based architecture (separation of concerns)
• Context Provider for cross‐cutting auth state
• Route-based code organization (Page vs. Component)
• Protected routes guard sensitive operations
• Environment-driven configuration for API endpoint
d. Key technologies
• Vite (dev server, hot reload, bundling)
• React 18 (functional components, hooks)
• React Router DOM (client routing)
• Firebase Auth SDK
• Axios (HTTP client)
• Tailwind CSS (utility-first styling)
Detail
• Break out the SPA into layers: Presentation (Components), Routing (AppRouter/PrivateRoutes), State/Auth (AuthProvider), Networking (Axios calls).
• Config files (firebase.config.js, vite.config.js, .env variables) as annotations.