# iron-io/functions-ui architecture

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

- Interactive diagram: https://gitdiagram.com/iron-io/functions-ui
- Repository: https://github.com/iron-io/functions-ui

## Overview

##### Project type and purpose
- This is a full-stack web application that provides a Vue.js single-page UI for managing functions on an external IronFunctions API.
- The front end is built with Vue components and bundled by Webpack. The back end is a Node/Express server that serves static assets and proxies API calls.

##### File structure
- Top-level files:
- Dockerfile, build.sh/release.sh → containerization and release scripts
- webpack.config.js, .babelrc, stylelint.config.js → build and lint configuration
- server.js + /server folder → Express server entrypoint, routing, controllers, helpers
- /client folder → Vue.js source (components, pages, styles, helper libraries)
- /public → static index.html, fonts, images, manifest for PWA behavior
- CI/CD: .circleci/config.yml defines continuous integration and possibly image builds.

##### README insights
- The UI runs in a Docker container and is configured by two environment variables: PORT and API_URL.
- The server proxies all calls with API_URL env var to the external IronFunctions API running in a separate container.
- Development workflow uses npm, webpack --watch, and Docker for the API.

##### Main components
a. Front end (Browser)
- Vue SPA (client/client.js, client/components, client/pages)
- Static assets (CSS, fonts, images under /public)
b. Back end (Node/Express server)
- Static file server (serves bundled SPA)
- API router (server/router.js)
- Controllers (apps.js, routes.js, info.js)
- Helpers (app-helpers.js)
c. External service
- IronFunctions API (deployed in its own container, URL passed via API_URL)
d. Build & deploy pipeline (optional)
- Webpack bundling step
- Docker build (Dockerfile, build.sh, release.sh)
- CI (CircleCI)

##### Relationships and data flow
- User in Browser → HTTP GET/POST → Node/Express server
- Static asset requests → served directly from server → Browser renders SPA
- API calls (e.g., /api/apps) → routed by server/router.js → appropriate controller → HTTP call to IronFunctions API → controller returns JSON → Browser updates UI
- Build pipeline: source code → Webpack → bundle → Docker image → registry → deployment

##### Architectural patterns and design principles
- Single-Page Application (MVVM) on front end using Vue components
- API-gateway/proxy pattern on back end to avoid CORS and centralize authentication or request shaping
- Clear separation of concerns: presentation (client) vs. integration (server) vs. external API

##### Details
- router.js
- controllers/ (apps, routes, info)
- helpers/ (app-helpers)
- client.js (entry)
- components/ & pages/ directories
- CSS and font assets

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Browser / Client"
        direction TB
        FEEntry["client/client.js"]:::frontend
        Components["client/components"]:::frontend
        Pages["client/pages"]:::frontend
        Styles["client/css"]:::frontend
        Fonts["client/fonts"]:::frontend
        HelpersLib["client/lib/helpers.js"]:::frontend
        UICmp["client/lib/VueBootstrapModal.vue"]:::frontend
        AssetsHTML["public/index.html"]:::frontend
        AssetsFonts["public/fonts"]:::frontend
        AssetsImages["public/images"]:::frontend
        Manifest["public/manifest.json"]:::frontend
    end

    subgraph "Server (Express API Proxy)"
        direction TB
        ServerEntry["server.js / server/server.js"]:::backend
        Router["server/router.js"]:::backend
        CtrlApps["server/controllers/apps.js"]:::backend
        CtrlRoutes["server/controllers/routes.js"]:::backend
        CtrlInfo["server/controllers/info.js"]:::backend
        Helpers["server/helpers/app-helpers.js"]:::backend
    end

    External["IronFunctions API"]:::external

    subgraph "Config & Scripts"
        direction TB
        Webpack["webpack.config.js / .babelrc"]:::pipeline
        Lint["stylelint.config.js"]:::pipeline
        Docker["Dockerfile / build.sh / release.sh"]:::pipeline
        CICD[".circleci/config.yml"]:::pipeline
    end

    FEEntry -->|"bootstrap SPA"| Pages
    Pages --> Components
    Components --> UICmp
    FEEntry --> Styles
    FEEntry --> Fonts
    FEEntry --> HelpersLib

    BrowserClient(["Browser"]):::frontend
    BrowserClient -->|"GET /index.html, bundle.js"| ServerEntry
    BrowserClient -->|"GET /api/apps"| Router

    ServerEntry --> Router
    Router --> CtrlApps
    Router --> CtrlRoutes
    Router --> CtrlInfo
    CtrlApps -->|"HTTP Calls"| External
    CtrlRoutes -->|"HTTP Calls"| External
    CtrlInfo -->|"HTTP Calls"| External
    Helpers --> CtrlApps
    Helpers --> CtrlRoutes
    Helpers --> CtrlInfo

    Webpack -->|"bundles assets"| ServerEntry
    Webpack --> Docker
    Docker --> CICD

    classDef frontend fill:#D0E8F2,stroke:#064273
    classDef backend fill:#D6EAD8,stroke:#1D572C
    classDef external fill:#FDEBD0,stroke:#B9770E
    classDef pipeline fill:#E8E8E8,stroke:#333

    click FEEntry "https://github.com/iron-io/functions-ui/blob/master/client/client.js"
    click Components "https://github.com/iron-io/functions-ui/tree/master/client/components/"
    click Pages "https://github.com/iron-io/functions-ui/tree/master/client/pages/"
    click Styles "https://github.com/iron-io/functions-ui/tree/master/client/css/"
    click Fonts "https://github.com/iron-io/functions-ui/tree/master/client/fonts/"
    click HelpersLib "https://github.com/iron-io/functions-ui/blob/master/client/lib/helpers.js"
    click UICmp "https://github.com/iron-io/functions-ui/blob/master/client/lib/VueBootstrapModal.vue"
    click AssetsHTML "https://github.com/iron-io/functions-ui/blob/master/public/index.html"
    click AssetsFonts "https://github.com/iron-io/functions-ui/tree/master/public/fonts/"
    click AssetsImages "https://github.com/iron-io/functions-ui/tree/master/public/images/"
    click Manifest "https://github.com/iron-io/functions-ui/blob/master/public/manifest.json"
    click ServerEntry "https://github.com/iron-io/functions-ui/blob/master/server.js"
    click ServerEntry "https://github.com/iron-io/functions-ui/blob/master/server/server.js"
    click Router "https://github.com/iron-io/functions-ui/blob/master/server/router.js"
    click CtrlApps "https://github.com/iron-io/functions-ui/blob/master/server/controllers/apps.js"
    click CtrlRoutes "https://github.com/iron-io/functions-ui/blob/master/server/controllers/routes.js"
    click CtrlInfo "https://github.com/iron-io/functions-ui/blob/master/server/controllers/info.js"
    click Helpers "https://github.com/iron-io/functions-ui/blob/master/server/helpers/app-helpers.js"
    click Webpack "https://github.com/iron-io/functions-ui/blob/master/webpack.config.js"
    click Webpack "https://github.com/iron-io/functions-ui/blob/master/.babelrc"
    click Lint "https://github.com/iron-io/functions-ui/blob/master/stylelint.config.js"
    click Docker "https://github.com/iron-io/functions-ui/tree/master/Dockerfile"
    click Docker "https://github.com/iron-io/functions-ui/blob/master/build.sh"
    click Docker "https://github.com/iron-io/functions-ui/blob/master/release.sh"
    click CICD "https://github.com/iron-io/functions-ui/blob/master/.circleci/config.yml"
```
