# vibhoursharma/pixabay architecture

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

- Interactive diagram: https://gitdiagram.com/vibhoursharma/pixabay
- Repository: https://github.com/vibhoursharma/pixabay

## Overview

##### Project type and purpose
- This is a Single-Page Application (SPA) built with ReactJS and Tailwind CSS, hosted on Vercel, that clones Pixabay’s image/video search UI and integrates Firebase for authentication and per-user data (favorites, downloads).
- Core features: OAuth/email login, dynamic search (images/videos) via Pixabay API, skeleton loading animations, user-specific favorites and download tracking.

##### File structure
- Top-level files:
- index.html, package.json/lock.json, vite.config.js, tailwind.config.js, postcss.config.js (build & styling configs)
- vercel.json (deployment)
- src/
- main.jsx → application entry point (boots React app)
- context/Firebase.jsx → React Context provider for Firebase Auth & Firestore SDK
- components/ → reusable UI modules, organized by feature (Dashboard, Modal, Search)
- pages/ → route-level components (HomePage, SearchResult, Downloads, Favourites, LoginPage, SignupPage)
- assets/ → static assets (background images)
- App.css → global styling overrides
- No separate “backend” directory: all data and auth happen via client SDKs to Firebase and direct REST calls to Pixabay API.

##### Extract insights from the README
- Technology stack: ReactJS (frontend framework), Tailwind CSS (utility CSS), Firebase (authentication & data), Vite (dev/build tool), Vercel (hosting)
- Features explicitly mentioned: Firebase Authentication, dynamic dashboard, search UI, skeleton loader, responsive design, and multi-page routing.

a. Main components
- User’s Browser (Client)
- Static Hosting (Vercel CDN serving index.html + JS/CSS bundle)
- React SPA
– React Router (manages pages)
– Context Layer (Firebase context provider)
– Pages (HomePage, SearchResult, Downloads, Favourites, LoginPage, SignupPage)
– UI Components (Dashboard components, Search components, Modal components)
– Styling Engine (Tailwind CSS + PostCSS)
- External Services
– Pixabay REST API (image/video search endpoints)
– Firebase Auth (email/password & Google OAuth)
– Firebase Firestore (stores user’s favorites and download counts)
b. Relationships & data flow
1. User navigates to the app URL → DNS → Vercel CDN → serves static assets → boots React SPA in browser.
2. React App initializes Firebase context → checks user session with Firebase Auth.
3. User enters search term → React component sends HTTP request to Pixabay API → receives JSON results → components render cards.
4. User favorites or downloads an item → SPA calls Firestore via Firebase SDK to persist or update user data.
5. Firestore streams updates back to the UI context → Favourites/Downloads pages render current data.
c. Architectural patterns & design principles
- Component-based UI decomposition (feature folders under components/ and pages/).
- Unidirectional data flow via React state & Context.
- Client-side routing (React Router implied by pages folder).
- Serverless/backend-as-a-service model: Firebase manages authentication & data storage; Pixabay provides external API.
- Utility-first styling (Tailwind CSS) integrated through PostCSS in Vite.
d. Key technologies & libraries
- ReactJS (core framework)
- Vite (dev server & bundler)
- Tailwind CSS + PostCSS (styling)
- Firebase SDK (Auth + Firestore)
- Pixabay REST API
- Vercel (static hosting)

##### Detail is key
- Related components (pages vs. feature widgets).
- Context provider boundary (all Firebase calls go through it).
- Explicitly call out API endpoints (e.g., GET https://pixabay.com/api) and Firestore collections (e.g., /users/{uid}/favorites).
- Don’t over-abstract—capture every major directory or service as its own node.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Hosting & Build
    subgraph "Hosting & Build"
        Vercel["Vercel CDN"]:::infra
        indexhtml["index.html"]:::infra
        vitecfg["vite.config.js"]:::infra
        tailwindcfg["tailwind.config.js"]:::infra
        postcsscfg["postcss.config.js"]:::infra
        pkg["package.json & lock.json"]:::infra
        vercelcfg["vercel.json"]:::infra
    end

    %% Client: React SPA
    subgraph "Client: React SPA"
        main["main.jsx (Entry Point)"]:::client
        appcss["App.css"]:::client
        Router["React Router"]:::client
        Context["Firebase Context"]:::client

        subgraph "Pages"
            Home["HomePage.jsx"]:::client
            SearchPage["SearchResult.jsx"]:::client
            DownloadsPage["Downloads.jsx"]:::client
            FavouritesPage["Favourites.jsx"]:::client
            LoginPage["LoginPage.jsx"]:::client
            SignupPage["SignupPage.jsx"]:::client
        end

        subgraph "Dashboard Components"
            Navbar["Navbar.jsx"]:::client
            Hero["Hero.jsx"]:::client
            CategorySearch["CategorySearch.jsx"]:::client
            ImageType["ImageType.jsx"]:::client
            SearchInput["Search.jsx"]:::client
            Footer["Footer.jsx"]:::client
        end

        subgraph "Search Components"
            CardLayout["CardLayout.jsx"]:::client
            CardSection["CardSection.jsx"]:::client
            SearchName["SearchName.jsx"]:::client
            SimilarTags["SimilarTags.jsx"]:::client
        end

        subgraph "Modal Components"
            ImageDetail["ImageDetail.jsx"]:::client
            SkeletonLoader["SkeletonLoader.jsx"]:::client
        end

        Assets["bgImage.js"]:::client
        App["React SPA"]:::client
    end

    %% External Services
    subgraph "External Services"
        Pixabay["Pixabay REST API"]:::service
        Auth["Firebase Auth"]:::service
        Firestore["Firebase Firestore"]:::service
    end

    %% Connections
    Vercel -->|serves| indexhtml
    indexhtml -->|loads| main
    main -->|boots| App
    App -->|uses| Router
    App -->|wraps| Context
    App -->|imports| appcss
    Router -->|routes to| Home
    Router -->|routes to| SearchPage
    Router -->|routes to| DownloadsPage
    Router -->|routes to| FavouritesPage
    Router -->|routes to| LoginPage
    Router -->|routes to| SignupPage

    Home --> Navbar
    Home --> Hero
    Home --> CategorySearch
    Home --> ImageType
    Home --> SearchInput
    Home --> Footer

    SearchPage --> CardLayout
    SearchPage --> CardSection
    SearchPage --> SearchName
    SearchPage --> SimilarTags
    SearchPage -->|GET /api| Pixabay
    CardLayout --> Pixabay

    SearchPage --> ImageDetail
    Home --> SkeletonLoader

    FavouritesPage -->|reads/writes| Firestore
    DownloadsPage -->|reads/writes| Firestore
    LoginPage -->|auth| Auth
    SignupPage -->|auth| Auth
    Context -->|auth calls| Auth
    Context -->|db calls| Firestore

    Assets --> Home

    %% Click Events
    click main "https://github.com/vibhoursharma/pixabay/blob/main/src/main.jsx"
    click appcss "https://github.com/vibhoursharma/pixabay/blob/main/src/App.css"
    click Context "https://github.com/vibhoursharma/pixabay/blob/main/src/context/Firebase.jsx"
    click Home "https://github.com/vibhoursharma/pixabay/blob/main/src/pages/HomePage.jsx"
    click SearchPage "https://github.com/vibhoursharma/pixabay/blob/main/src/pages/SearchResult.jsx"
    click DownloadsPage "https://github.com/vibhoursharma/pixabay/blob/main/src/pages/Downloads.jsx"
    click FavouritesPage "https://github.com/vibhoursharma/pixabay/blob/main/src/pages/Favourites.jsx"
    click LoginPage "https://github.com/vibhoursharma/pixabay/blob/main/src/pages/LoginPage.jsx"
    click SignupPage "https://github.com/vibhoursharma/pixabay/blob/main/src/pages/SignupPage.jsx"
    click Navbar "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Dashboard/Navbar.jsx"
    click Hero "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Dashboard/Hero.jsx"
    click CategorySearch "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Dashboard/CategorySearch.jsx"
    click ImageType "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Dashboard/ImageType.jsx"
    click SearchInput "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Dashboard/Search.jsx"
    click Footer "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Dashboard/Footer.jsx"
    click CardLayout "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Search/CardLayout.jsx"
    click CardSection "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Search/CardSection.jsx"
    click SearchName "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Search/SearchName.jsx"
    click SimilarTags "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Search/SimilarTags.jsx"
    click ImageDetail "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Modal/ImageDetail.jsx"
    click SkeletonLoader "https://github.com/vibhoursharma/pixabay/blob/main/src/components/Modal/SkeletonLoader.jsx"
    click Assets "https://github.com/vibhoursharma/pixabay/blob/main/src/assets/bgImages/bgImage.js"
    click indexhtml "https://github.com/vibhoursharma/pixabay/blob/main/index.html"
    click vitecfg "https://github.com/vibhoursharma/pixabay/blob/main/vite.config.js"
    click tailwindcfg "https://github.com/vibhoursharma/pixabay/blob/main/tailwind.config.js"
    click postcsscfg "https://github.com/vibhoursharma/pixabay/blob/main/postcss.config.js"
    click pkg "https://github.com/vibhoursharma/pixabay/blob/main/package.json"
    click vercelcfg "https://github.com/vibhoursharma/pixabay/blob/main/vercel.json"

    %% Styles
    classDef client fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef service fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef infra fill:#eeeeee,stroke:#333,stroke-width:1px
```
