# scalableminds/webknossos architecture

> Architecture diagram of the GitHub repository scalableminds/webknossos, 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/scalableminds/webknossos
- Repository: https://github.com/scalableminds/webknossos

## Overview

##### Main Components Overview

The system consists of three major services:
- Main WEBKNOSSOS Application (Frontend + Backend)
- WEBKNOSSOS Datastore
- WEBKNOSSOS Tracingstore

##### Detailed Component Breakdown

a. Frontend Layer:
- React-based UI components (in frontend/javascripts)
- State management system (Redux/Sagas)
- WebGL-based 3D visualization
- User interface modules (dashboard, annotation tools, admin panels)

b. Backend Layer:
- Play Framework (Scala) application
- Authentication/Authorization system
- REST API endpoints
- Database management (PostgreSQL)
- Task and project management

c. Datastore Service:
- Handles large-scale image data
- Supports multiple formats (WKW, Neuroglancer, Zarr, N5)
- Data streaming and caching
- Image processing capabilities

d. Tracingstore Service:
- Manages annotation data
- Handles skeleton and volume annotations
- Provides versioning and collaboration features

##### Integration Points

- HTTP/REST communication between components
- Data streaming paths
- Authentication flows
- Storage interactions

##### External Dependencies

Include:
- Database systems
- Redis for caching
- Storage systems (S3, file system)
- External authentication providers

##### Specific Implementation Details

- Microservices architecture
- Data streaming capabilities
- Real-time collaboration features
- Scalability points
- Security boundaries

##### Deployment Context

Show:
- Docker container boundaries
- Network segments
- Load balancers
- Service discovery

Remember to:
- Use consistent naming conventions
- A title and version information
- Brief descriptions for complex interactions
- Critical paths and dependencies

This system design should reflect WEBKNOSSOS's sophisticated architecture while making it understandable for technical team members to work with and maintain.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface"
        UI["Main UI Components"]:::frontend
        TV["Tracing View"]:::frontend
        DB["Dashboard"]:::frontend
        ST["Styles"]:::frontend
    end

    subgraph "Application Layer"
        subgraph "Backend Services"
            API["Controllers/API"]:::backend
            AUTH["Authentication System"]:::backend
            MODELS["Database Models"]:::backend
            CONFIG["Configuration"]:::backend
        end

        subgraph "Datastore Service"
            DS_CORE["Core Implementation"]:::datastore
            DS_FORMAT["Data Format Handlers"]:::datastore
            DS_SERVICES["Data Services"]:::datastore
            DS_STORAGE["Storage Management"]:::datastore
        end

        subgraph "Tracingstore Service"
            TS_CORE["Core Implementation"]:::tracingstore
            TS_CTRL["Tracing Controllers"]:::tracingstore
            TS_SKEL["Skeleton Tracing"]:::tracingstore
            TS_VOL["Volume Tracing"]:::tracingstore
        end
    end

    subgraph "Data Layer"
        DM["Data Models"]:::data
        DA["Data Access"]:::data
        DC["Data Controllers"]:::data
        
        subgraph "User Management"
            UM["User Models"]:::user
            UC["User Controller"]:::user
        end

        DB_STORE[(PostgreSQL)]:::database
        REDIS[(Redis Cache)]:::database
        S3[(S3 Storage)]:::storage
    end

    %% Connections
    UI --> API
    TV --> API
    DB --> API
    
    API --> AUTH
    API --> MODELS
    
    DS_CORE --> DS_FORMAT
    DS_CORE --> DS_SERVICES
    DS_SERVICES --> DS_STORAGE
    DS_STORAGE --> S3
    
    TS_CORE --> TS_CTRL
    TS_CTRL --> TS_SKEL
    TS_CTRL --> TS_VOL
    
    MODELS --> DB_STORE
    API --> REDIS
    
    DM --> DB_STORE
    DA --> DB_STORE
    DC --> API
    
    UM --> DB_STORE
    UC --> API

    %% Click Events
    click UI "https://github.com/scalableminds/webknossos/tree/master/frontend/javascripts/"
    click TV "https://github.com/scalableminds/webknossos/tree/master/frontend/javascripts/oxalis/view/"
    click DB "https://github.com/scalableminds/webknossos/tree/master/frontend/javascripts/dashboard/"
    click ST "https://github.com/scalableminds/webknossos/tree/master/frontend/stylesheets/"
    
    click API "https://github.com/scalableminds/webknossos/tree/master/app/controllers/"
    click AUTH "https://github.com/scalableminds/webknossos/tree/master/app/security/"
    click MODELS "https://github.com/scalableminds/webknossos/tree/master/app/models/"
    click CONFIG "https://github.com/scalableminds/webknossos/tree/master/conf/"
    
    click DS_CORE "https://github.com/scalableminds/webknossos/tree/master/webknossos-datastore/app/com/scalableminds/webknossos/datastore/"
    click DS_FORMAT "https://github.com/scalableminds/webknossos/tree/master/webknossos-datastore/app/com/scalableminds/webknossos/datastore/dataformats/"
    click DS_SERVICES "https://github.com/scalableminds/webknossos/tree/master/webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/"
    click DS_STORAGE "https://github.com/scalableminds/webknossos/tree/master/webknossos-datastore/app/com/scalableminds/webknossos/datastore/storage/"
    
    click TS_CORE "https://github.com/scalableminds/webknossos/tree/master/webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/"
    click TS_CTRL "https://github.com/scalableminds/webknossos/tree/master/webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/controllers/"
    click TS_SKEL "https://github.com/scalableminds/webknossos/tree/master/webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/skeleton/"
    click TS_VOL "https://github.com/scalableminds/webknossos/tree/master/webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/volume/"
    
    click DM "https://github.com/scalableminds/webknossos/tree/master/app/models/dataset/"
    click DA "https://github.com/scalableminds/webknossos/tree/master/app/models/annotation/"
    click DC "https://github.com/scalableminds/webknossos/blob/master/app/controllers/DatasetController.scala"
    
    click UM "https://github.com/scalableminds/webknossos/tree/master/app/models/user/"
    click UC "https://github.com/scalableminds/webknossos/blob/master/app/controllers/UserController.scala"

    %% Styles
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef backend fill:#4CAF50,stroke:#2E7D32,color:white
    classDef datastore fill:#FF9800,stroke:#EF6C00,color:white
    classDef tracingstore fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef data fill:#00BCD4,stroke:#00838F,color:white
    classDef user fill:#F44336,stroke:#C62828,color:white
    classDef database fill:#795548,stroke:#4E342E,color:white
    classDef storage fill:#607D8B,stroke:#37474F,color:white
```
