# jaslioin/xbrowser-sync-web architecture

> Architecture diagram of the GitHub repository jaslioin/xbrowser-sync-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaslioin/xbrowser-sync-web
- Repository: https://github.com/jaslioin/xbrowser-sync-web

## Overview

##### Main Components

A. Frontend Layer
- Astro Pages (Entry Points)
- Layouts
- Components (Mixed Astro and Svelte)
- Store Management
- Utils/Helpers

B. Core Features
- Bookmark Management
- Search Functionality
- PWA Capabilities

**[Frontend Architecture]**

- Client Browser                                        |

- ↓

- Astro Runtime                                         |

- Pages Layer  |  |  Layouts Layer |  | Components Layer |  |    Store Layer     |   |
- (index.astro)  |  |  - Dashboard  |  | - BookmarkCard   |  |  - search.ts      |   |
- Layout     |  | - BookmarkForm   |  |                    |   |
- Search         |  +--------------------+   |

- ↕                                        |

- Utils/Helpers      |  |   TypeScript   |    |        PWA Integration        |   |
- decipher.ts        |  |    Types       |    |        (src/pwa.ts)           |   |
- get-scraper-url.ts |  |                |    |                                |   |

##### Important Elements to Highlight

a. Component Architecture:
- Hierarchy between layouts and components
- Which components are Astro (.astro) vs Svelte (.svelte)
- Interaction between components and the store

b. Data Flow:
- How the search functionality interacts with bookmarks
- Bookmark management flow
- Demonstrate PWA integration points

c. Build/Deploy Pipeline:
- Vite/Astro build process
- Static asset handling (public folder)
- PWA capabilities

##### Technical Stack Callouts

- Astro for page routing and SSR/SSG
- Svelte for interactive components
- TypeScript for type safety
- TailwindCSS for styling
- PWA capabilities

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Browser"]
        Browser[Browser Runtime]
    end

    subgraph AstroRuntime["Astro Runtime"]
        subgraph Pages["Pages Layer"]
            Index["index.astro"]
        end

        subgraph Layouts["Layouts Layer"]
            DashLayout["Dashboard Layout"]
            MainLayout["Main Layout"]
        end

        subgraph Components["Components Layer"]
            BCard["Bookmark Card"]
            BForm["Bookmark Form"]
            BList["Bookmark List"]
            BGrid["Bookmark Grid Item"]
            BSearchGrid["Bookmark Search Grid"]
            Search["Search Component"]
            Decipher["Decipher Component"]
        end

        subgraph Store["Store Layer"]
            SearchStore["Search Store"]
        end

        subgraph Utils["Utils/Helpers"]
            DecipherUtil["Decipher Utility"]
            DecipherNode["Decipher Node"]
            ScraperUrl["Get Scraper URL"]
        end

        subgraph Types["TypeScript Types"]
            BookmarkType["Bookmark Types"]
        end

        subgraph PWA["PWA Integration"]
            PWACore["PWA Core"]
        end
    end

    Browser --> Index
    Index --> DashLayout & MainLayout
    DashLayout --> BCard & BForm & BList & Search
    BList --> BGrid
    Search --> BSearchGrid
    Search --> SearchStore
    BCard --> DecipherUtil
    Decipher --> DecipherUtil
    DecipherUtil --> DecipherNode
    BForm --> ScraperUrl

    %% Component Mappings
    click Index "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/pages/index.astro"
    click DashLayout "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/layouts/DashboardLayout.astro"
    click MainLayout "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/layouts/Layout.astro"
    click BCard "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/components/BookmarkCard.svelte"
    click BForm "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/components/BookmarkForm.astro"
    click BList "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/components/BookmarkList.svelte"
    click BGrid "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/components/BookmarkGridItem.svelte"
    click BSearchGrid "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/components/BookmarkSearchGrid.svelte"
    click Search "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/components/Search.svelte"
    click Decipher "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/components/Decipher.svelte"
    click SearchStore "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/store/search.ts"
    click DecipherUtil "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/utils/decipher.ts"
    click DecipherNode "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/utils/decipher-node.ts"
    click ScraperUrl "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/utils/get-scraper-url.ts"
    click BookmarkType "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/types/bookmark.ts"
    click PWACore "https://github.com/jaslioin/xbrowser-sync-web/blob/master/src/pwa.ts"

    %% Styling
    classDef browser fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef astro fill:#4F3BBA,color:white
    classDef svelte fill:#FF3E00,color:white
    classDef store fill:#7C3AED,color:white
    classDef utils fill:#F97316,color:white
    classDef types fill:#3B82F6,color:white
    classDef pwa fill:#10B981,color:white

    class Browser browser
    class Index,DashLayout,MainLayout,BForm astro
    class BCard,BList,BGrid,BSearchGrid,Search,Decipher svelte
    class SearchStore store
    class DecipherUtil,DecipherNode,ScraperUrl utils
    class BookmarkType types
    class PWACore pwa
```
