# ecotrust/marco-portal2 architecture

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

- Interactive diagram: https://gitdiagram.com/ecotrust/marco-portal2
- Repository: https://github.com/ecotrust/marco-portal2

## Overview

##### Main Components

a) Frontend Layer:
- Static Assets (CSS, JavaScript, Images)
- Bootstrap-based UI components
- jQuery and other frontend libraries
- Ocean Story visualization components

b) Backend Layer:
- Django Web Framework
- Wagtail CMS
- Multiple Django Apps (portal, data_catalog, ocean_stories, etc.)
- Celery Task Queue

c) Data Storage:
- PostgreSQL Database
- Redis (for Celery and caching)
- Media Storage (for uploaded files)

d) External Services:
- Services
- Data Manager
- Authentication System

**[Client Layer]**
- ↑↓
**[Web Server (Apache)]**
- ↑↓
**[Application Layer]**
- Django/Wagtail
- Portal Apps
- Asset Pipeline
- ↑↓
**[Service Layer]**
- Celery Workers
- Redis
- PostgreSQL

##### Key Relationships

- Request flow from client through web server to application
- Data flow between Django apps and database
- Asset compilation and serving pipeline
- Task queue workflow with Celery and Redis
- Media file handling
- Data processing flow

##### Specific Implementation Details

- Home
- Ocean Stories
- Data Catalog
- Calendar
- News
- Pages
- Base

Connections between:
- Wagtail CMS and content management
- Static/Media file serving
- Database interactions
- Cache layer
- Task processing

##### Additional Elements

Annotations for:
- Development vs Production environments
- Security layers
- Backup systems
- Asset compilation pipeline
- Docker/Vagrant development setup

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph WebServer["Web Server Layer"]
        Apache["Apache HTTPD"]
    end

    subgraph FrontendLayer["Frontend Layer"]
        StaticAssets["Static Assets"]:::frontend
        BootstrapUI["Bootstrap UI"]:::frontend
        FrontendJS["Frontend JavaScript"]:::frontend
        OceanViz["Ocean Story Visualization"]:::frontend
    end

    subgraph BackendLayer["Application Layer"]
        DjangoCore["Django Core"]:::backend
        WagtailCMS["Wagtail CMS"]:::backend
        CeleryQueue["Celery Task Queue"]:::backend
        WSGI["WSGI Configuration"]:::backend

        subgraph DjangoApps["Django Applications"]
            HomeApp["Home App"]:::app
            OceanStories["Ocean Stories App"]:::app
            DataCatalog["Data Catalog App"]:::app
            Calendar["Calendar App"]:::app
            NewsApp["News App"]:::app
            PagesApp["Pages App"]:::app
            BaseApp["Base App"]:::app
        end

        subgraph Templates["Template Layer"]
            BaseTemplates["Base Templates"]:::template
            AppTemplates["App Templates"]:::template
        end
    end

    subgraph Storage["Data Storage Layer"]
        PostgreSQL[(PostgreSQL)]:::database
        Redis[(Redis Cache)]:::database
        MediaStorage["Media Storage"]:::storage
    end

    subgraph DevOps["Development & Deployment"]
        Docker["Docker Config"]:::devops
        DeployScripts["Deployment Scripts"]:::devops
        AssetCompilation["Asset Compilation"]:::devops
        Backups["Database Backups"]:::devops
    end

    Browser --> Apache
    Apache --> DjangoCore
    DjangoCore --> WagtailCMS
    DjangoCore --> DjangoApps
    DjangoApps --> Templates
    DjangoCore --> CeleryQueue
    CeleryQueue --> Redis
    DjangoCore --> PostgreSQL
    WagtailCMS --> PostgreSQL
    DjangoCore --> MediaStorage
    DjangoCore --> StaticAssets

    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef app fill:#e74c3c,stroke:#c0392b,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef template fill:#9b59b6,stroke:#8e44ad,color:white
    classDef devops fill:#34495e,stroke:#2c3e50,color:white

    click StaticAssets "https://github.com/Ecotrust/marco-portal2/tree/main/marco/marco_site/static/"
    click BootstrapUI "https://github.com/Ecotrust/marco-portal2/tree/main/assets/bootstrap/"
    click FrontendJS "https://github.com/Ecotrust/marco-portal2/tree/main/assets/javascript/"
    click OceanViz "https://github.com/Ecotrust/marco-portal2/tree/main/marco/portal/ocean_stories/static/portal/ocean_story/"
    click DjangoCore "https://github.com/Ecotrust/marco-portal2/blob/main/marco/marco/settings.py"
    click CeleryQueue "https://github.com/Ecotrust/marco-portal2/blob/main/marco/marco/celery.py"
    click WSGI "https://github.com/Ecotrust/marco-portal2/blob/main/marco/marco/wsgi.py"
    click HomeApp "https://github.com/Ecotrust/marco-portal2/tree/main/marco/portal/home/"
    click OceanStories "https://github.com/Ecotrust/marco-portal2/tree/main/marco/portal/ocean_stories/"
    click DataCatalog "https://github.com/Ecotrust/marco-portal2/tree/main/marco/portal/data_catalog/"
    click Calendar "https://github.com/Ecotrust/marco-portal2/tree/main/marco/portal/calendar/"
    click NewsApp "https://github.com/Ecotrust/marco-portal2/tree/main/marco/portal/news/"
    click PagesApp "https://github.com/Ecotrust/marco-portal2/tree/main/marco/portal/pages/"
    click BaseApp "https://github.com/Ecotrust/marco-portal2/tree/main/marco/portal/base/"
    click BaseTemplates "https://github.com/Ecotrust/marco-portal2/tree/main/marco/marco_site/templates/"
    click Backups "https://github.com/Ecotrust/marco-portal2/blob/main/backups/db_dump.sh"
    click Docker "https://github.com/Ecotrust/marco-portal2/tree/main/docker/"
    click DeployScripts "https://github.com/Ecotrust/marco-portal2/tree/main/scripts/"
    click AssetCompilation "https://github.com/Ecotrust/marco-portal2/blob/main/scripts/compile_assets.sh"
```
