# nd9600/spiderweb architecture

> Architecture diagram of the GitHub repository nd9600/spiderweb, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nd9600/spiderweb
- Repository: https://github.com/nd9600/spiderweb

## Overview

##### Main Components

a) Frontend Layer:
- Vue.js Components Structure
- Core Components (Posts, Graphs, Links)
- Viewer Components
- Settings & Configuration
- BlogPost Exporter

b) State Management:
- Vuex Store Modules
- Posts Module
- Graphs Module
- Links Module
- Settings Module
- Firebase Module (Optional Backup)

c) Backend Layer (Laravel):
- Authentication System
- API Controllers
- Database Models
- Service Providers

d) Storage:
- Local Browser Storage
- Optional Firebase Integration
- MySQL Database (for online version)

**┌─ Client Side ─────────────────────┐**
- ┌─ Vue.js Components ───────────┐ │

- ┘ │
- ┌─ State Management ────────────┐ │

- ┘ │
- ┘

**┌─ Server Side ────────────────────┐**
- ┌─ Laravel Backend ────────────┐ │

- ┘ │
- ┘

**┌─ Storage Layer ──────────────────┐**
- ┌─ Local ─┐ ┌─ Remote ────────┐ │

- ┘ └──────────────────┘ │
- ┘

##### Key Relationships

a) Data Flow:
- User interactions → Vue components
- Components → Vuex store
- Store → Local storage/Firebase
- API requests → Laravel backend
- Database interactions

b) Component Dependencies:
- Post → Graph relationships
- Link → Post relationships
- Authentication flow
- Backup synchronization

##### Implementation Details

Use these symbols and conventions:
- Double lines for data synchronization
- Diamonds for decision points
- Rectangles for components
- Clouds for external services

##### Additional Elements

Annotations for:
- Authentication flows
- Data backup paths
- Offline/online mode switching
- Post management operations
- Graph visualization system

##### The visualization system's architecture

Remember to maintain a balance between showing enough detail to understand the system's architecture while keeping it clear and readable. Focus on the unique aspects of Spiderweb, particularly its offline-first approach and graph-based post management system.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef communication stroke-dasharray: 5 5

    subgraph ClientSide["Client Side"]
        subgraph VueComponents["Vue.js Components"]
            Posts["Posts Components"]:::frontend
            Graphs["Graphs Components"]:::frontend
            Links["Links Components"]:::frontend
            Viewer["Viewer Components"]:::frontend
            Settings["Settings Components"]:::frontend
            BlogExporter["BlogPost Exporter"]:::frontend
            OfflineApp["Offline App"]:::frontend
            OfflineRoot["Offline Root"]:::frontend
            OfflineGraph["Offline Graph"]:::frontend
        end

        subgraph StateManagement["State Management (Vuex)"]
            PostsModule["Posts Module"]:::frontend
            GraphsModule["Graphs Module"]:::frontend
            LinksModule["Links Module"]:::frontend
            SettingsModule["Settings Module"]:::frontend
            FirebaseModule["Firebase Module"]:::frontend
        end

        subgraph CoreClasses["Core Classes"]
            PostClass["Post Class"]:::frontend
            GraphClass["Graph Class"]:::frontend
            LinkClass["Link Class"]:::frontend
            SubgraphClass["Subgraph Class"]:::frontend
        end
    end

    subgraph ServerSide["Server Side"]
        subgraph LaravelBackend["Laravel Backend"]
            AuthControllers["Authentication Controllers"]:::backend
            APIControllers["API Controllers"]:::backend
            DBModels["Database Models"]:::backend
            ServiceProviders["Service Providers"]:::backend
        end
    end

    subgraph StorageLayer["Storage Layer"]
        LocalStorage[(Local Storage)]:::storage
        MySQL[(MySQL Database)]:::storage
        Firebase[("Firebase (Optional)")]:::external
        Migrations["Database Migrations"]:::backend
    end

    %% Relationships
    Posts --> PostsModule
    Graphs --> GraphsModule
    Links --> LinksModule
    Settings --> SettingsModule
    
    PostsModule --> PostClass
    GraphsModule --> GraphClass
    LinksModule --> LinkClass
    
    FirebaseModule --> Firebase
    
    APIControllers --> MySQL
    DBModels --> MySQL
    Migrations --> MySQL
    
    PostsModule --> LocalStorage
    GraphsModule --> LocalStorage
    LinksModule --> LocalStorage
    
    OfflineApp --> LocalStorage
    OfflineRoot --> LocalStorage
    OfflineGraph --> LocalStorage

    %% Click events
    click Posts "https://github.com/nd9600/spiderweb/tree/master/resources/assets/js/src/commonComponents/Posts/"
    click Graphs "https://github.com/nd9600/spiderweb/tree/master/resources/assets/js/src/commonComponents/Graphs/"
    click Links "https://github.com/nd9600/spiderweb/tree/master/resources/assets/js/src/commonComponents/Links/"
    click Viewer "https://github.com/nd9600/spiderweb/tree/master/resources/assets/js/src/commonComponents/Viewer/"
    click Settings "https://github.com/nd9600/spiderweb/tree/master/resources/assets/js/src/commonComponents/Settings/"
    click BlogExporter "https://github.com/nd9600/spiderweb/tree/master/resources/assets/js/src/commonComponents/BlogpostExporter/"
    click PostsModule "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/offline/store/modules/dataModules/posts.ts"
    click GraphsModule "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/offline/store/modules/dataModules/graphs.ts"
    click LinksModule "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/offline/store/modules/dataModules/links.ts"
    click SettingsModule "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/offline/store/modules/settingsModule.js"
    click FirebaseModule "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/offline/store/modules/firebaseModule.js"
    click AuthControllers "https://github.com/nd9600/spiderweb/tree/master/app/Http/Controllers/Auth/"
    click APIControllers "https://github.com/nd9600/spiderweb/blob/master/app/Http/Controllers/PostController.php"
    click DBModels "https://github.com/nd9600/spiderweb/blob/master/app/Post.php"
    click ServiceProviders "https://github.com/nd9600/spiderweb/tree/master/app/Providers/"
    click Migrations "https://github.com/nd9600/spiderweb/tree/master/database/migrations/"
    click PostClass "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/offline/store/classes/Post.ts"
    click GraphClass "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/offline/store/classes/Graph.ts"
    click LinkClass "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/offline/store/classes/Link.ts"
    click SubgraphClass "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/offline/store/classes/Subgraph.ts"
    click OfflineApp "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/commonComponents/OfflineApp.vue"
    click OfflineRoot "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/offline/OfflineRoot.vue"
    click OfflineGraph "https://github.com/nd9600/spiderweb/blob/master/resources/assets/js/src/commonComponents/Viewer/OfflineGraph.vue"
```
