# nathanvogel/relations-watch architecture

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

- Interactive diagram: https://gitdiagram.com/nathanvogel/relations-watch
- Repository: https://github.com/nathanvogel/relations-watch

## Overview

##### Main System Components

a) Frontend Layer:
- React/TypeScript Single Page Application
- Key modules:
- Graph Visualization (D3.js)
- Entity Management
- Relationship Management
- User Interface Components
- State Management (Redux)

b) Backend Layer:
- ArangoDB with Foxx Services
- Graph API Service
- Reverse Proxy (Nginx)

c) External Services:
- Wikidata Integration
- Firebase (for hosting)

##### Component Relationships

**[Frontend (React/TS)] ←→ [Nginx Reverse Proxy] ←→ [ArangoDB Foxx Services] ←→ [ArangoDB Graph Database]**
- ↕                                                    ↕
**[Firebase Hosting]                                    [Wikidata API]**

##### Detailed Component Breakdown

- Blue rectangles for frontend components
- Green rectangles for backend services
- Yellow diamonds for databases
- Grey rectangles for external services

Frontend (React/TypeScript):
**[Components] → [Features/Redux] → [API Layer]**
- ↑              ↕              ↕
**[D3 Graph] ← [State Management] → [Utils]**

Backend (ArangoDB/Foxx):
**[Nginx Reverse Proxy]**
- ↓
**[Graph API Service]**
- ↙          ↘
**[Entities]  [Relations]**
- ↓
- [ArangoDB Store]

##### Important Details

a) Frontend Architecture:
- Redux store structure
- Component hierarchy
- Routing system
- Internationalization (i18n)
- Styled-components theming

b) Backend Architecture:
- API endpoints
- Data models
- Graph structure
- Migration system

##### Technical Stack Callouts

- TypeScript/JavaScript
- React
- Redux
- D3.js
- ArangoDB
- Foxx Services
- Nginx
- Styled-components

##### Development Environment

A separate section showing:
- Local development setup
- Production deployment
- API configuration options
- Database setup

This system design should reflect the collaborative nature of the platform while emphasizing the technical architecture that enables efficient relationship visualization and management.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        ReactApp["React/TypeScript SPA"]:::frontend
        D3["Graph Visualization (D3.js)"]:::frontend
        EntityMgmt["Entity Management"]:::frontend
        RelMgmt["Relationship Management"]:::frontend
        UIComp["UI Components"]:::frontend
        Redux["State Management (Redux)"]:::frontend
        I18n["Internationalization"]:::frontend
        
        ReactApp --> D3
        ReactApp --> EntityMgmt
        ReactApp --> RelMgmt
        ReactApp --> UIComp
        ReactApp --> Redux
        ReactApp --> I18n
    end

    subgraph Backend
        Nginx["Nginx Reverse Proxy"]:::backend
        GraphAPI["Graph API Service"]:::backend
        EntityAPI["Entity API"]:::backend
        RelationsAPI["Relations API"]:::backend
        
        Nginx --> GraphAPI
        GraphAPI --> EntityAPI
        GraphAPI --> RelationsAPI
    end

    subgraph Database
        ArangoDB["ArangoDB Graph Database"]:::database
        ArangoFoxx["Foxx Services"]:::database
        
        ArangoFoxx --> ArangoDB
        EntityAPI --> ArangoFoxx
        RelationsAPI --> ArangoFoxx
    end

    subgraph "External Services"
        Firebase["Firebase Hosting"]:::external
        Wikidata["Wikidata API"]:::external
    end

    ReactApp --> Nginx
    Firebase --> ReactApp
    GraphAPI --> Wikidata

    %% Click Events
    click ReactApp "https://github.com/nathanvogel/relations-watch/tree/master/frontend/src"
    click D3 "https://github.com/nathanvogel/relations-watch/tree/master/frontend/src/utils/d3"
    click EntityMgmt "https://github.com/nathanvogel/relations-watch/tree/master/frontend/src/components/entity"
    click Redux "https://github.com/nathanvogel/relations-watch/tree/master/frontend/src/features"
    click UIComp "https://github.com/nathanvogel/relations-watch/tree/master/frontend/src/components"
    click GraphAPI "https://github.com/nathanvogel/relations-watch/tree/master/backend/service-graph-api"
    click Nginx "https://github.com/nathanvogel/relations-watch/blob/master/backend/reverse-proxy/nginx.conf"
    click ArangoDB "https://github.com/nathanvogel/relations-watch/blob/master/backend/arango-conf/arangod-custom.conf"
    click Wikidata "https://github.com/nathanvogel/relations-watch/blob/master/frontend/src/utils/api-wd.ts"
    click Firebase "https://github.com/nathanvogel/relations-watch/blob/master/frontend/firebase.json"
    click RelMgmt "https://github.com/nathanvogel/relations-watch/tree/master/frontend/src/components/edgeEditor"
    click EntityAPI "https://github.com/nathanvogel/relations-watch/tree/master/backend/service-graph-api/entities"
    click RelationsAPI "https://github.com/nathanvogel/relations-watch/tree/master/backend/service-graph-api/relations"
    click I18n "https://github.com/nathanvogel/relations-watch/tree/master/frontend/src/i18n"

    %% Styling
    classDef frontend fill:#2196F3,color:white
    classDef backend fill:#4CAF50,color:white
    classDef database fill:#FFC107,color:black
    classDef external fill:#9E9E9E,color:white

    %% Legend
    subgraph Legend
        Frontend_L["Frontend"]:::frontend
        Backend_L["Backend"]:::backend
        Database_L["Database"]:::database
        External_L["External Services"]:::external
    end
```
