# a596116/qrcode architecture

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

- Interactive diagram: https://gitdiagram.com/a596116/qrcode
- Repository: https://github.com/a596116/qrcode

## Overview

##### Project type and purpose
- This is a full-stack web application for uploading images or videos and generating QR-code links.
- The “web/” directory hosts a Nuxt.js frontend, and “express-upload-service/” contains an Express.js backend API that handles file uploads and QR-code creation.

##### File structure
- Top-level
- Dockerfile, docker-compose.yml, start.sh, web-start.sh – orchestration & container definitions
- express-upload-service/ – backend service
- web/ – frontend service
- express-upload-service/
- index.js – main Express app
- public/ – static assets (e.g., generated QR codes)
- ecosystem.config.cjs – PM2 config for production
- web/
- nuxt.config.ts – Nuxt configuration
- pages/, layouts/, assets/, utils/api.ts – Vue pages, layout, styles, and API wrapper
- .env.* – environment variables for API_SERVER_URL, SITE_URL
- Dockerfile & ecosystem.config.cjs – container & process management

##### README for additional insights
- dev commands: “npm run dev” spins up both services on ports 4088 (frontend) and 3000 (backend)
- production: “npm run build” + “npm run start” or docker-compose up

##### Detail
- Config files (nuxt.config.ts, ecosystem.config.cjs) near their services
- Mount paths: ./express-upload-service/uploads → /app/uploads

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Orchestration Layer
    subgraph "Orchestration & Scripts"
        direction TB
        ComposeFile["docker-compose.yml"]:::orchestrationFile
        RootDockerfile["Dockerfile"]:::containerFile
        startSh["start.sh"]:::script
        webStartSh["web-start.sh"]:::script
    end

    %% Docker Compose Network
    DockerCompose("Docker Compose Network"):::orchestration

    ComposeFile --> DockerCompose
    RootDockerfile --> DockerCompose
    startSh --> DockerCompose
    webStartSh --> DockerCompose

    %% Frontend Service
    subgraph "Nuxt.js Frontend Service" 
        direction TB
        Frontend["Nuxt.js Frontend\nPort 4088"]:::frontend
        nuxtConfig["nuxt.config.ts"]:::config
        pagesIndex["pages/index.vue"]:::file
        pagesManage["pages/manage.vue"]:::file
        pagesPreview["pages/preview.vue"]:::file
        layoutsDefault["layouts/default.vue"]:::file
        apiWrapper["utils/api.ts"]:::file
        webDockerfile["Dockerfile"]:::containerFile
        webEcosystem["ecosystem.config.cjs"]:::config
        envDev[".env.development"]:::config
        envProd[".env.production"]:::config
    end

    %% Backend Service
    subgraph "Express API Service" 
        direction TB
        Backend["Express API\nPort 3000"]:::backend
        expressIndex["index.js"]:::file
        backDockerfile["Dockerfile"]:::containerFile
        backEcosystem["ecosystem.config.cjs"]:::config
        packageJson["package.json"]:::file
        dockerignore[".dockerignore"]:::file
        publicIndex["public/index.html"]:::file
    end

    %% Storage
    Storage[(Local File Storage\nuploads & QR codes)]:::storage

    %% Client
    Browser["Browser"]:::client

    %% Connections
    Browser -->|"HTTP GET/POST"| Frontend
    Frontend -->|"API calls (axios)"| Backend
    Backend -->|"read/write files"| Storage
    Backend -->|"serve QR image URLs"| Browser

    DockerCompose --> Frontend
    DockerCompose --> Backend

    %% Click Events
    click ComposeFile "https://github.com/a596116/qrcode/blob/master/docker-compose.yml"
    click RootDockerfile "https://github.com/a596116/qrcode/tree/master/Dockerfile"
    click startSh "https://github.com/a596116/qrcode/blob/master/start.sh"
    click webStartSh "https://github.com/a596116/qrcode/blob/master/web-start.sh"

    click nuxtConfig "https://github.com/a596116/qrcode/blob/master/web/nuxt.config.ts"
    click pagesIndex "https://github.com/a596116/qrcode/blob/master/web/pages/index.vue"
    click pagesManage "https://github.com/a596116/qrcode/blob/master/web/pages/manage.vue"
    click pagesPreview "https://github.com/a596116/qrcode/blob/master/web/pages/preview.vue"
    click layoutsDefault "https://github.com/a596116/qrcode/blob/master/web/layouts/default.vue"
    click apiWrapper "https://github.com/a596116/qrcode/blob/master/web/utils/api.ts"
    click webDockerfile "https://github.com/a596116/qrcode/tree/master/web/Dockerfile"
    click webEcosystem "https://github.com/a596116/qrcode/blob/master/web/ecosystem.config.cjs"
    click envDev "https://github.com/a596116/qrcode/blob/master/web/.env.development"
    click envProd "https://github.com/a596116/qrcode/blob/master/web/.env.production"

    click expressIndex "https://github.com/a596116/qrcode/blob/master/express-upload-service/index.js"
    click backDockerfile "https://github.com/a596116/qrcode/tree/master/express-upload-service/Dockerfile"
    click backEcosystem "https://github.com/a596116/qrcode/blob/master/express-upload-service/ecosystem.config.cjs"
    click packageJson "https://github.com/a596116/qrcode/blob/master/express-upload-service/package.json"
    click dockerignore "https://github.com/a596116/qrcode/blob/master/express-upload-service/.dockerignore"
    click publicIndex "https://github.com/a596116/qrcode/blob/master/express-upload-service/public/index.html"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef frontend fill:#B0C4DE,stroke:#333,stroke-width:1px
    classDef backend fill:#98FB98,stroke:#333,stroke-width:1px
    classDef storage fill:#E0FFFF,stroke:#333,stroke-width:1px
    classDef orchestration fill:#FFD700,stroke:#333,stroke-width:1px
    classDef orchestrationFile fill:#FFE4B5,stroke:#333,stroke-width:1px
    classDef containerFile fill:#FAFAD2,stroke:#333,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef file fill:#F5F5F5,stroke:#333,stroke-width:1px
    classDef script fill:#FFEFD5,stroke:#333,stroke-width:1px
```
