# md-iftikher/wereisit-client architecture

> Architecture diagram of the GitHub repository md-iftikher/wereisit-client, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/md-iftikher/wereisit-client
- Repository: https://github.com/md-iftikher/wereisit-client

## Overview

##### 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.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Build & Hosting"
        VITE["vite.config.js"]:::infra
        PUBLIC["public/, index.html, firebase.json, .firebaserc"]:::infra
        click VITE "https://github.com/md-iftikher/wereisit-client/blob/main/vite.config.js"
        click PUBLIC "https://github.com/md-iftikher/wereisit-client/tree/main/public/"
    end

    Browser["User Browser"]:::infra
    PUBLIC -->|serves assets| Browser

    Browser -->|loads SPA| SPA["React SPA"]:::frontend

    subgraph "React SPA"
        direction TB
        Main["main.jsx"]:::frontend
        click Main "https://github.com/md-iftikher/wereisit-client/blob/main/src/main.jsx"
        AppRoot["App.jsx"]:::frontend
        click AppRoot "https://github.com/md-iftikher/wereisit-client/blob/main/src/App.jsx"

        subgraph "Routing Layer"
            AR["AppRouter.jsx"]:::frontend
            PR["PrivateRoutes.jsx"]:::frontend
            click AR "https://github.com/md-iftikher/wereisit-client/blob/main/src/Router/AppRouter.jsx"
            click PR "https://github.com/md-iftikher/wereisit-client/blob/main/src/Router/PrivateRoutes.jsx"
        end

        AuthProv["AuthProvider.jsx"]:::frontend
        click AuthProv "https://github.com/md-iftikher/wereisit-client/blob/main/src/Provider/AuthProvider.jsx"
        Config["firebase.config.js"]:::infra
        click Config "https://github.com/md-iftikher/wereisit-client/blob/main/src/Firebase/firebase.config.js"

        subgraph "Pages"
            HP["HomePage.jsx"]:::frontend
            LG["Login.jsx"]:::frontend
            RG["Register.jsx"]:::frontend
            AL["AddLostItem.jsx"]:::frontend
            AI["AllItems.jsx"]:::frontend
            MI["MyItems.jsx"]:::frontend
            ID["ItemsDetails.jsx"]:::frontend
            ER["ErrorPage.jsx"]:::frontend
            click HP "https://github.com/md-iftikher/wereisit-client/blob/main/src/Pages/HomePage.jsx"
            click LG "https://github.com/md-iftikher/wereisit-client/blob/main/src/Pages/Login.jsx"
            click RG "https://github.com/md-iftikher/wereisit-client/blob/main/src/Pages/Register.jsx"
            click AL "https://github.com/md-iftikher/wereisit-client/blob/main/src/Pages/AddLostItem.jsx"
            click AI "https://github.com/md-iftikher/wereisit-client/blob/main/src/Pages/AllItems.jsx"
            click MI "https://github.com/md-iftikher/wereisit-client/blob/main/src/Pages/MyItems.jsx"
            click ID "https://github.com/md-iftikher/wereisit-client/blob/main/src/Pages/ItemsDetails.jsx"
            click ER "https://github.com/md-iftikher/wereisit-client/blob/main/src/Pages/ErrorPage.jsx"
        end

        subgraph "Reusable UI Components"
            NB["Navbar.jsx"]:::frontend
            FT["Footer.jsx"]:::frontend
            FAQ["FAQAccordion.jsx"]:::frontend
            TV["TableView.jsx"]:::frontend
            CV["CardView.jsx"]:::frontend
            LS["LoadingSpinner.jsx"]:::frontend
            HIW["HowItWorks.jsx"]:::frontend
            click NB "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/Navbar.jsx"
            click FT "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/Footer.jsx"
            click FAQ "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/FAQAccordion.jsx"
            click TV "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/TableView.jsx"
            click CV "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/CardView.jsx"
            click LS "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/LoadingSpinner.jsx"
            click HIW "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/HowItWorks.jsx"
        end

        subgraph "Home Widgets"
            BN["Banner.jsx"]:::frontend
            BS["Bannerslides.js"]:::frontend
            CI["CommunityImact.jsx"]:::frontend
            LI["LatestItems.jsx"]:::frontend
            TS["TestimonialsSection.jsx"]:::frontend
            click BN "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/HomeComponent/Banner.jsx"
            click BS "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/HomeComponent/Bannerslides.js"
            click CI "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/HomeComponent/CommunityImact.jsx"
            click LI "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/HomeComponent/LatestItems.jsx"
            click TS "https://github.com/md-iftikher/wereisit-client/blob/main/src/Components/HomeComponent/TestimonialsSection.jsx"
        end

        Axios["Axios HTTP Client"]:::frontend

        Main --> AppRoot
        AppRoot --> AR
        AR --> PR
        AR --> HP & AI & MI & AL & ID & ER
        AR --> NB & FT & FAQ & TV & CV & LS & HIW
        AR --> BN & BS & CI & LI & TS
        AppRoot --> AuthProv
        AuthProv --> Config
        AppRoot --> Axios
    end

    SPA -->|mounts| Main
    SPA -->|bundled by| VITE
    SPA -->|depends on| PUBLIC

    Axios -->|requests| API["External REST API"]:::api
    API --> DB["Items Database"]:::api

    AuthProv -->|authenticates| FirebaseAuth["Firebase Auth"]:::auth

    Browser -->|stores JWT| Storage["LocalStorage"]:::infra
    Storage -->|sends JWT| API

    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef auth fill:#D2FADE,stroke:#059669,color:#059669;
    classDef api fill:#FFE0B2,stroke:#D97706,color:#D97706;
    classDef infra fill:#EEEEEE,stroke:#6B7280,color:#6B7280;
```
