# archidevil/trips architecture

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

- Interactive diagram: https://gitdiagram.com/archidevil/trips
- Repository: https://github.com/archidevil/trips

## Overview

##### Main Components

a) Frontend Layer:
- Vue.js application structure
- Key components (Auth, Trips, Meals, Products, Reports)
- Static assets handling
- Vite build system

b) Backend Layer:
- Flask application
- API endpoints structure
- Authentication system
- Database interactions
- Email service

c) Infrastructure:
- Nginx reverse proxy
- Docker containerization
- Database (appears to be using SQLAlchemy with Alembic migrations)

**┌─ Frontend (Vue.js) ─────────────────┐**
- Auth Module                      │
- Trip Management                  │
- Meal Planning                    │
- Product Management              │
- Reporting                        │
- ┘

**┌─ Nginx Reverse Proxy ───────────────┐**

- ┬───────────────────────┘
- ↓
**┌─ Flask Backend ────────────────────┐**
- API Routes                      │
- /api/auth                    │
- /api/trips                   │
- /api/meals                   │
- /api/products                │
- /api/reports                 │

- Authentication Service          │
- Email Service                   │
- Business Logic Layer            │
- ┘

**┌─ Database ──────────────────────────┐**
- Users                            │
- Trips                            │
- Meals                            │
- Products                         │
- ┘

##### Important Elements to Highlight

- Blue for frontend components
- Green for backend services
- Yellow for infrastructure components
- Red for security-related components

- Double lines for data persistence operations

##### Additional Details

- Authentication flow paths
- Database migration handling with Alembic
- Static file serving path through Nginx
- Development vs Production environment differences

##### Specific Implementation Notes

- The separation between the Vue.js frontend and Flask backend
- The role of Nginx as a reverse proxy
- The authentication system's integration points
- The modular structure of both frontend and backend components
- The database schema migrations handling

- Version information for major components (Python, Vue.js, Flask)
- Development workflow with npm and Flask debug mode
- Docker composition structure
- Notes about the static file handling strategy
- Document the authentication flow and security measures

Remember to include both development and production configurations, as they differ significantly according to the README's setup instructions.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        FE[Frontend Vue.js]
        Auth["Auth Module"]:::frontend
        Trips["Trip Management"]:::frontend
        Meals["Meal Planning"]:::frontend
        Products["Product Management"]:::frontend
        Reports["Reports"]:::frontend
        Nav["Navigation Bar"]:::frontend
        Store["State Management"]:::frontend
        
        FE --> Auth
        FE --> Trips
        FE --> Meals
        FE --> Products
        FE --> Reports
        FE --> Nav
        FE --> Store
    end

    subgraph "Infrastructure Layer"
        Nginx["Nginx Reverse Proxy"]:::infra
        Docker["Docker Container"]:::infra
    end

    subgraph "Backend Layer"
        Flask["Flask Backend"]:::backend
        
        subgraph "API Routes"
            AuthAPI["/api/auth"]:::api
            TripsAPI["/api/trips"]:::api
            MealsAPI["/api/meals"]:::api
            ProductsAPI["/api/products"]:::api
            ReportsAPI["/api/reports"]:::api
        end
        
        subgraph "Core Services"
            AuthService["Authentication Service"]:::service
            EmailService["Email Service"]:::service
            DBHandler["Database Handler"]:::service
            Schema["Schema Definitions"]:::service
        end
    end

    subgraph "Data Layer"
        DB[(Database)]:::database
        Migrations["Database Migrations"]:::database
    end

    subgraph "Testing"
        APITests["API Tests"]:::test
        AuthTests["Auth Tests"]:::test
        TripTests["Trip Tests"]:::test
    end

    Nginx --> Flask
    Auth --> AuthAPI
    Trips --> TripsAPI
    Meals --> MealsAPI
    Products --> ProductsAPI
    Reports --> ReportsAPI

    AuthAPI --> AuthService
    AuthService --> DBHandler
    EmailService --> DBHandler
    DBHandler --> DB
    Schema --> DB
    DB --> Migrations

    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef api fill:#e74c3c,stroke:#c0392b,color:white
    classDef service fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef infra fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef test fill:#1abc9c,stroke:#16a085,color:white

    click Auth "https://github.com/ArchiDevil/trips/blob/master/web/src/apps/AuthApp.vue"
    click Trips "https://github.com/ArchiDevil/trips/blob/master/web/src/apps/TripsApp.vue"
    click Meals "https://github.com/ArchiDevil/trips/blob/master/web/src/apps/MealsApp.vue"
    click Products "https://github.com/ArchiDevil/trips/blob/master/web/src/apps/ProductsApp.vue"
    click Reports "https://github.com/ArchiDevil/trips/blob/master/web/src/apps/ReportsApp.vue"
    click AuthAPI "https://github.com/ArchiDevil/trips/blob/master/app/organizer/api/auth.py"
    click TripsAPI "https://github.com/ArchiDevil/trips/blob/master/app/organizer/api/trips.py"
    click MealsAPI "https://github.com/ArchiDevil/trips/blob/master/app/organizer/api/meals.py"
    click ProductsAPI "https://github.com/ArchiDevil/trips/blob/master/app/organizer/api/products.py"
    click ReportsAPI "https://github.com/ArchiDevil/trips/blob/master/app/organizer/api/reports.py"
    click DBHandler "https://github.com/ArchiDevil/trips/blob/master/app/organizer/db.py"
    click AuthService "https://github.com/ArchiDevil/trips/blob/master/app/organizer/auth.py"
    click EmailService "https://github.com/ArchiDevil/trips/blob/master/app/organizer/utils/email.py"
    click Schema "https://github.com/ArchiDevil/trips/blob/master/app/organizer/schema.py"
    click Nginx "https://github.com/ArchiDevil/trips/blob/master/nginx/conf.d/hikehub.ru.conf"
    click Docker "https://github.com/ArchiDevil/trips/blob/master/docker-compose.yml"
    click Migrations "https://github.com/ArchiDevil/trips/tree/master/app/alembic/versions/"
    click Nav "https://github.com/ArchiDevil/trips/blob/master/web/src/components/NavigationBar.vue"
    click Store "https://github.com/ArchiDevil/trips/tree/master/web/src/stores/"
    click APITests "https://github.com/ArchiDevil/trips/tree/master/app/tests/tests_api/"
    click AuthTests "https://github.com/ArchiDevil/trips/blob/master/app/tests/test_auth.py"
    click TripTests "https://github.com/ArchiDevil/trips/blob/master/app/tests/test_trips.py"
```
