# randomusr56/ltm-dev-new_task architecture

> Architecture diagram of the GitHub repository randomusr56/ltm-dev-new_task, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/randomusr56/ltm-dev-new_task
- Repository: https://github.com/randomusr56/ltm-dev-new_task

## Overview

##### Project Type & Purpose
- This is a full-stack task-management application with mapping features.
- Frontend: Vue.js single-page-app (SPA) generated by Vite, served via Nginx.
- Backend: Node.js + Express, OpenAPI-driven controllers/services.
- Database: PostgreSQL (with PostGIS, pgcrypto) accessed via Docker.
- Purpose: CRUD on “Feladat” objects, user authentication, image upload, geo-coordinates.

##### File Structure
- Top-level:
– docker-compose.yml orchestrates three containers: `frtend` (client), `bckend` (server), `psqlab` (database).
– openapi.yaml / openapitools.json define the REST API schema.
- client/
– src/: Vue components, views (Home, MapView, Login), Pinia stores, router.
– api-client/: generated TypeScript client code against the OpenAPI spec.
– Dockerfile + nginx.conf to build & serve static SPA.
- server/
– openapi-generator files for scaffolding.
– controllers/ (Controller.js, FeladatController.js, etc.) and services/ layers.
– expressServer.js wires up middleware, openapiRouter, controllers.
– db.js connects to PostgreSQL, logger.js.
– Dockerfile to build the Express API.
- database/
– Dockerfile for PostgreSQL (+ PostGIS extension).
– backnddbcreate.sql to bootstrap schema, triggers, test data.

##### Extract Additional Insights from README
- Dockerization instructions for each tier (psqlab, bckend, frtend).
- Use the OpenAPI YAML to auto-generate both backend scaffold and frontend client.
- SQL script must be extended (triggers, password hashing, 30-day user expiry).
- Features planned: image capture/upload (desktop & mobile), map integration, role-based approval.

- Frontend Container (“frtend”):
– Nginx (serving compiled Vue.js)
– Vue.js SPA (components, router, Pinia stores)
– API-Client module (TypeScript client against OpenAPI)
- Backend Container (“bckend”):
– Express.js server
– OpenAPI Router (middleware for request validation)
– Controllers (FeladatController, etc.)
– Services (business logic, eg. FeladatService)
– Auth Middleware (JWT or session)
- Database Container (“psqlab”):
– PostgreSQL DB + PostGIS, pgcrypto
– Schemas/tables for Users, Tasks, Assignments, Images
– SQL scripts, triggers (audit timestamps, user expiry)
- External Services:
– Map Tile Provider / OSM API
– (Optional) Cloud storage or local file system for images
1. User’s browser ↔ HTTP/HTTPS ↔ Nginx ↔ Vue.js SPA
2. SPA → REST API calls (GET/POST/PUT/DELETE) → Express Controllers
3. Controllers ↔ Services ↔ DB.js → PostgreSQL
4. DB triggers execute on insert/update
5. SPA fetches map tiles from external Map API
c. Architectural Patterns & Design Principles:
- 3-Tier Layering: Presentation (Vue), Application (Express), Data (Postgres)
- OpenAPI-first development (contract-driven)
- MVC-like separation: Controllers vs. Services
- Containerization: Each tier runs in its own Docker container
d. Key Technologies & Frameworks to annotate:
- Vue.js, Vite, Pinia, Vue Router
- OpenAPI Generator (frontend & backend)
- Node.js, Express, JWT/Auth Middleware
- PostgreSQL, PostGIS, pgcrypto
- Docker, docker-compose, Nginx

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Container
    subgraph "Frontend Container (frtend)"
        direction TB
        NGX["Nginx"]:::frontend
        SPA["Vue.js SPA"]:::frontend
        APIClient["OpenAPI TS Client"]:::frontend
        Router["Vue Router"]:::frontend
        Stores["Pinia Stores"]:::frontend
        Entry["main.ts / vite.config.ts"]:::frontend
    end

    %% Backend Container
    subgraph "Backend Container (bckend)"
        direction TB
        Express["Express.js Server"]:::backend
        OpenAPIRouter["OpenAPI Router"]:::backend
        Auth["Auth Middleware"]:::backend
        subgraph "Controllers"
            direction TB
            BaseCtrl["Controller.js"]:::backend
            FController["FeladatController"]:::backend
            UController["FelhasznlController"]:::backend
            KpController["KpController"]:::backend
            MSController["MegoldsController"]:::backend
            SSController["SszerendelsController"]:::backend
        end
        subgraph "Services"
            direction TB
            BaseService["Service.js"]:::backend
            FService["FeladatService"]:::backend
            UService["FelhasznlService"]:::backend
            KpService["KpService"]:::backend
            MSService["MegoldsService"]:::backend
            SSService["SszerendelsService"]:::backend
        end
        DBConn["db.js"]:::backend
        Logger["logger.js"]:::backend
        Config["config.js / .env"]:::backend
    end

    %% Database Container
    subgraph "Database Container (psqlab)"
        direction TB
        PG["PostgreSQL + PostGIS"]:::database
        SQL["backnddbcreate.sql"]:::database
    end

    %% External Services
    subgraph "External Services"
        direction TB
        MapAPI["Map Tile API"]:::external
        ImgStorage["Image Storage*"]:::external
        Browser["User Browser"]:::external
        Compose["docker-compose.yml"]:::external
        OAPI["OpenAPI Spec"]:::api
    end

    %% Connections
    Browser -->|"HTTP/HTTPS"| NGX
    NGX -->|"Serves SPA"| SPA
    SPA -->|"Uses APIClient"| APIClient
    SPA -->|"Routing"| Router
    SPA -->|"State"| Stores
    SPA -->|"Bootstraps"| Entry

    APIClient -->|"HTTPS/JSON"| Express
    OAPI -->|"Codegen"| APIClient
    OAPI -->|"Codegen"| OpenAPIRouter

    Express --> OpenAPIRouter
    OpenAPIRouter --> Auth
    Auth --> BaseCtrl
    BaseCtrl --> FController
    BaseCtrl --> UController
    BaseCtrl --> KpController
    BaseCtrl --> MSController
    BaseCtrl --> SSController

    FController --> FService
    UController --> UService
    KpController --> KpService
    MSController --> MSService
    SSController --> SSService
    BaseService --> DBConn

    DBConn -->|"SQL"| PG
    SQL --> PG

    SPA -->|"Map Tiles"| MapAPI
    SPA -->|"Image upload"| ImgStorage

    Compose --> NGX
    Compose --> Express
    Compose --> PG
    OAPI --> Compose

    %% Click Events Frontend
    click NGX "https://github.com/randomusr56/ltm-dev-new_task/blob/main/client/nginx.conf"
    click SPA "https://github.com/randomusr56/ltm-dev-new_task/tree/main/client/src/"
    click APIClient "https://github.com/randomusr56/ltm-dev-new_task/tree/main/client/src/api-client/"
    click Router "https://github.com/randomusr56/ltm-dev-new_task/blob/main/client/src/router/index.ts"
    click Stores "https://github.com/randomusr56/ltm-dev-new_task/tree/main/client/src/stores/"
    click Entry "https://github.com/randomusr56/ltm-dev-new_task/blob/main/client/src/main.ts"

    %% Click Events Backend
    click Express "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/expressServer.js"
    click OpenAPIRouter "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/utils/openapiRouter.js"
    click Auth "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/utils/authMiddleware.js"
    click BaseCtrl "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/controllers/Controller.js"
    click FController "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/controllers/FeladatController.js"
    click UController "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/controllers/FelhasznlController.js"
    click KpController "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/controllers/KpController.js"
    click MSController "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/controllers/MegoldsController.js"
    click SSController "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/controllers/SszerendelsController.js"
    click BaseService "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/services/Service.js"
    click FService "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/services/FeladatService.js"
    click UService "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/services/FelhasznlService.js"
    click KpService "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/services/KpService.js"
    click MSService "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/services/MegoldsService.js"
    click SSService "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/services/SszerendelsService.js"
    click DBConn "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/db.js"
    click Logger "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/logger.js"
    click Config "https://github.com/randomusr56/ltm-dev-new_task/blob/main/server/config.js"

    %% Click Events Database & Orchestration
    click PG "https://github.com/randomusr56/ltm-dev-new_task/tree/main/database/Dockerfile"
    click SQL "https://github.com/randomusr56/ltm-dev-new_task/blob/main/database/backnddbcreate.sql"
    click Compose "https://github.com/randomusr56/ltm-dev-new_task/blob/main/docker-compose.yml"
    click OAPI "https://github.com/randomusr56/ltm-dev-new_task/blob/main/openapi.yaml"

    %% Styles
    classDef frontend fill:#fff2cc,stroke:#cc9f00,color:#333
    classDef backend fill:#cfe2f3,stroke:#2a5898,color:#333
    classDef database fill:#d9ead3,stroke:#6aa84f,color:#333
    classDef external fill:#f4cccc,stroke:#e06666,color:#333
    classDef api fill:#ffe599,stroke:#b67600,color:#333
```
