# inteshar/mrxiwlev architecture

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

- Interactive diagram: https://gitdiagram.com/inteshar/mrxiwlev
- Repository: https://github.com/inteshar/mrxiwlev

## Overview

##### Project Type and Purpose
- This is a full-stack “static” portfolio website built as a Single-Page Application (SPA) with React and styled via Tailwind CSS.
- It uses Vite as a build tool, deploys static assets to Vercel, and offloads backend concerns (authentication and data storage) to Firebase (Firestore and Auth).
- There are two logical frontends:
a. Public user-facing portfolio pages under src/components
b. Admin dashboard under src/admin for content management (login, blog management, contact list)

##### Top-Level Components
a. Client Browser
- Public User (navigates portfolio pages)
- Admin User (navigates admin pages via ProtectedRoute)
b. React SPA (served as static assets)
- Main app entry (src/main.jsx → App.jsx)
- Public modules (Hero, About, Blogs, BlogDetail, Projects, Service, Contact, SuccessDialog)
- Admin modules (AdminLogin, Dashboard, Blog editor, DisplayContacts, Profile, ProtectedRoute wrapper)
- Shared components (Navbar, Sidebar)
c. PWA / Static Asset Layer
- Vercel CDN serving built files (dist/)
d. Backend as a Service (Firebase)
- Authentication (firebase/auth) for admin sign-in
- Firestore (firebase/firestore) for storing blogs, contacts, profile data
- Queries encapsulated in src/firebase/firestoreQueries.js
e. Build & Deployment
- Vite config (vite.config.js) for dev server and production bundling
- Tailwind config (tailwind.config.js, postcss.config.js)
- Vercel config (vercel.json)

##### Relationships and Data Flow
- Browser → (HTTP request) → Vercel CDN → serves static JS/CSS/HTML.
- React Router (App.jsx) → renders public or admin routes.
- Public pages → (read-only) → Firestore (fetch list of blogs, project data, JSON assets).
- Admin pages → (Auth) → Firebase Auth → on success access Firestore (read/write blogs & contacts).
- Service Worker intercepts fetch events for caching and offline support.

##### Architectural Patterns & Design Principles
- SPA with code-split routes (public vs. admin)
- BaaS (Firebase) decouples backend infrastructure
- ProtectedRoute HOC guards admin routes
- Component-based UI layer (React + Tailwind)
- PWA principles (offline caching, manifest)

##### Essential Architectural Elements
- Clear separation between public portfolio and admin dashboard
- PWA assets and caching layer
- BaaS services (Auth, Firestore) as external dependencies
- Deployment pipeline (Vite build → Vercel)

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Client Browser\n(Public/Admin)"]:::client
    Vercel["Vercel CDN\n(static hosting)"]:::hosting
    Browser -->|"GET assets"| Vercel
    Vercel -->|"serves HTML/CSS/JS"| SPA

    subgraph "React SPA" 
        direction TB
        Main["main.jsx"]:::frontend
        App["App.jsx"]:::frontend
        Main --> App

        subgraph "Public Pages" 
            direction TB
            Hero["Hero"]:::frontend
            About["About"]:::frontend
            Blogs["Blogs"]:::frontend
            BlogDetail["BlogDetail"]:::frontend
            Projects["Projects"]:::frontend
            Service["Service"]:::frontend
            Contact["Contact"]:::frontend
            SuccessDialog["SuccessDialog"]:::frontend
        end

        subgraph "Admin Dashboard" 
            direction TB
            ProtectedRoute["ProtectedRoute"]:::frontend
            AdminLogin["AdminLogin"]:::frontend
            Dashboard["Dashboard"]:::frontend
            BlogEditor["Blog"]:::frontend
            DisplayContacts["DisplayContacts"]:::frontend
            Profile["Profile"]:::frontend
            NavbarADM["Navbar"]:::frontend
            Sidebar["Sidebar"]:::frontend
        end
    end

    SPA["React SPA"]:::frontend
    SPA --> App

    SPA -->|reads| Firestore["Firestore DB"]:::baas
    SPA -->|auth POST /login| Auth["Firebase Auth"]:::baas
    SPA -->|"SW fetch"| SW["Service Worker & Manifest"]:::pwa

    subgraph "Build & Deployment"
        direction TB
        Vite["vite.config.js"]:::build
        Tailwind["tailwind.config.js & postcss.config.js"]:::build
        VercelCfg["vercel.json"]:::build
    end

    Vercel --> Vite
    Vercel --> Tailwind
    Vercel --> VercelCfg

    classDef client fill:#cce5ff,stroke:#004085,color:#004085;
    classDef hosting fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
    classDef frontend fill:#d1ecf1,stroke:#0c5460,color:#0c5460;
    classDef baas fill:#d4edda,stroke:#155724,color:#155724;
    classDef pwa fill:#fff3cd,stroke:#856404,color:#856404;
    classDef build fill:#f8d7da,stroke:#721c24,color:#721c24;

    click Main "https://github.com/inteshar/mrxiwlev/blob/main/src/main.jsx"
    click App "https://github.com/inteshar/mrxiwlev/blob/main/src/App.jsx"
    click Hero "https://github.com/inteshar/mrxiwlev/blob/main/src/components/Hero.jsx"
    click About "https://github.com/inteshar/mrxiwlev/blob/main/src/components/About.jsx"
    click Blogs "https://github.com/inteshar/mrxiwlev/blob/main/src/components/Blogs.jsx"
    click BlogDetail "https://github.com/inteshar/mrxiwlev/blob/main/src/components/BlogDetail.jsx"
    click Projects "https://github.com/inteshar/mrxiwlev/blob/main/src/components/Projects.jsx"
    click Service "https://github.com/inteshar/mrxiwlev/blob/main/src/components/Service.jsx"
    click Contact "https://github.com/inteshar/mrxiwlev/blob/main/src/components/Contact.jsx"
    click SuccessDialog "https://github.com/inteshar/mrxiwlev/blob/main/src/components/SuccessDialog.jsx"
    click AdminLogin "https://github.com/inteshar/mrxiwlev/blob/main/src/admin/AdminLogin.jsx"
    click Dashboard "https://github.com/inteshar/mrxiwlev/blob/main/src/admin/Dashboard.jsx"
    click BlogEditor "https://github.com/inteshar/mrxiwlev/blob/main/src/admin/Blog.jsx"
    click DisplayContacts "https://github.com/inteshar/mrxiwlev/blob/main/src/admin/DisplayContacts.jsx"
    click Profile "https://github.com/inteshar/mrxiwlev/blob/main/src/admin/Profile.jsx"
    click ProtectedRoute "https://github.com/inteshar/mrxiwlev/blob/main/src/admin/ProtectedRoute.jsx"
    click Sidebar "https://github.com/inteshar/mrxiwlev/blob/main/src/components/Sidebar.jsx"
    click NavbarADM "https://github.com/inteshar/mrxiwlev/blob/main/src/admin/components/Navbar.jsx"
    click Firestore "https://github.com/inteshar/mrxiwlev/blob/main/src/firebase/firestoreQueries.js"
    click Auth "https://github.com/inteshar/mrxiwlev/blob/main/src/firebase/firebase.js"
    click SW "https://github.com/inteshar/mrxiwlev/blob/main/public/service-worker.js"
    click SW "https://github.com/inteshar/mrxiwlev/blob/main/public/manifest.json"
    click Vite "https://github.com/inteshar/mrxiwlev/blob/main/vite.config.js"
    click Tailwind "https://github.com/inteshar/mrxiwlev/blob/main/tailwind.config.js"
    click Tailwind "https://github.com/inteshar/mrxiwlev/blob/main/postcss.config.js"
    click VercelCfg "https://github.com/inteshar/mrxiwlev/blob/main/vercel.json"
```
