# parttio/theme-addons architecture

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

- Interactive diagram: https://gitdiagram.com/parttio/theme-addons
- Repository: https://github.com/parttio/theme-addons

## Overview

##### Project type and purpose
- This is a multi-module Maven project combining a Vaadin 24 frontend with a Spring Boot backend, plus a reusable “theme” module packaging CSS into a JAR.
- The “theme” module provides styling resources, while the “demo” module is the runnable Vaadin application showcasing components and hot-deployable theme changes.

##### File structure
- Root:
- pom.xml: parent POM defining modules “theme” and “demo”
- theme module:
- pom.xml: builds a JAR containing CSS under META-INF/resources/themes/themestarter
- src/main/resources/META-INF/resources/themes/themestarter/... (component-level CSS, theme.json, typography.css)
- demo module:
- pom.xml, mvnw wrappers, package.json/tsconfig.json/vite.config.ts: config for frontend tooling
- src/main/java/com/example/application: Spring Boot Application.java, data/entities, views (Vaadin Flow Java code)
- src/main/resources: Spring properties, feature flags, banner
- src/main/dev-bundle/webapp/VAADIN/build: prebuilt Vaadin Flow client bundles for development
- demo/frontend: a minimal index.html and theme-editor assets for theming UI

##### Extract insights from README
- Two modules: theme (CSS JAR) and demo (runnable app)
- Build sequence: `mvn install` builds the theme JAR; `mvn spring-boot:run -pl demo` starts the server
- Hot-deploy of CSS changes via `vaadin.frontend.hotdeploy=true`

a. Main components
- Maven Parent (root POM)
- Theme Module (CSS JAR)
- Demo Module
- Spring Boot Application (Java server)
- Vaadin Flow Engine (server-side UI component framework)
- Dev-bundle / Frontend build (JavaScript/CSS resources)
- Browser (end user)
- External services (none in this starter; could add DB or REST if extended)
b. Relationships and interactions
- Maven Parent orchestrates builds for Theme and Demo
- Theme module → produces JAR → injected onto classpath of Demo
- Demo Spring Boot startup → Vaadin Flow compiles Java views to HTML/JS → serves through embedded web server
- Browser requests → Spring Boot serves HTML + JS bundles + theme CSS (from JAR’s META-INF/resources)
- Hot-deploy watches theme sources and updates served CSS without restart
c. Architectural patterns / design principles
- Multi-module Maven architecture for clear separation of styling vs application logic
- Server-side UI (Vaadin Flow) with client resource bundling
- Hot-deploy for rapid iteration
d. Relevant technologies
- Maven, Java 17, Spring Boot, Vaadin 24, Node/Vite (frontend tooling), CSS theme packaging

##### Be detailed and exhaustive
- Break out sub-components (e.g., CSS packaging in theme, Java packages in demo)
- Hot-deploy watcher on theme CSS feeding into Dev-bundle at runtime
- Configuration files (application.properties, vaadin-featureflags) as part of the Spring Boot node

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build orchestration
    MavenParent["Maven Parent (pom.xml)"]:::module
    MavenParent -->|builds| ThemeModule
    MavenParent -->|builds| DemoModule

    subgraph "Theme Module"
        ThemeModulePom["pom.xml"]:::module
        ThemeResources["META-INF/resources/themes/themestarter"]:::resources
        ThemeModulePom --> ThemeResources
        ThemeResources --> ThemeJAR["Theme Module CSS JAR"]:::artifact
    end

    subgraph "Demo Module"
        DemoPom["pom.xml"]:::module
        DemoPom --> DemoApp
        ThemeJAR -.->|classpath inject| DemoApp
    end

    subgraph "Demo Application"
        SpringBoot["Spring Boot Application"]:::server
        VaadinFlow["Vaadin Flow Engine"]:::server
        DevBundle["Dev-bundle (VAADIN build)"]:::resources
        FrontendIndex["index.html"]:::client
        FrontendThemeSample["theme-editor assets"]:::client

        subgraph "Config Files"
            ApplicationProperties["application.properties"]:::config
            FeatureFlags["vaadin-featureflags.properties"]:::config
            Banner["banner.txt"]:::config
        end

        DemoApp --> SpringBoot
        SpringBoot --> VaadinFlow
        SpringBoot --> DevBundle
        SpringBoot --> FrontendIndex
        SpringBoot --> FrontendThemeSample
        SpringBoot --> ApplicationProperties
        SpringBoot --> FeatureFlags
        SpringBoot --> Banner
        VaadinFlow --> FrontendIndex
        VaadinFlow --> ThemeJAR
    end

    %% Runtime flow
    Browser["Browser (End User)"]:::client
    Browser -->|HTTP requests| SpringBoot
    SpringBoot -->|serves HTML/JS/CSS| Browser

    %% Hot-deploy watcher
    subgraph "Hot-Deploy"
        ThemeResources -->|watch CSS changes| DevBundle
    end

    %% Click Events
    click MavenParent "https://github.com/parttio/theme-addons/blob/main/pom.xml"
    click ThemeModulePom "https://github.com/parttio/theme-addons/blob/main/theme/pom.xml"
    click ThemeResources "https://github.com/parttio/theme-addons/tree/main/theme/src/main/resources/META-INF/resources/themes/themestarter"
    click DemoPom "https://github.com/parttio/theme-addons/blob/main/demo/pom.xml"
    click SpringBoot "https://github.com/parttio/theme-addons/blob/main/demo/src/main/java/com/example/application/Application.java"
    click VaadinFlow "https://github.com/parttio/theme-addons/tree/main/demo/src/main/java/com/example/application/views"
    click DevBundle "https://github.com/parttio/theme-addons/tree/main/demo/src/main/dev-bundle/webapp/VAADIN/build"
    click FrontendIndex "https://github.com/parttio/theme-addons/blob/main/demo/frontend/index.html"
    click FrontendThemeSample "https://github.com/parttio/theme-addons/tree/main/demo/frontend/themes/componentsample"
    click ApplicationProperties "https://github.com/parttio/theme-addons/blob/main/demo/src/main/resources/application.properties"
    click FeatureFlags "https://github.com/parttio/theme-addons/blob/main/demo/src/main/resources/vaadin-featureflags.properties"
    click Banner "https://github.com/parttio/theme-addons/blob/main/demo/src/main/resources/banner.txt"

    %% Styles
    classDef module fill:#D0E4F5,stroke:#0366d6,stroke-width:1px
    classDef artifact fill:#E2F0C2,stroke:#6B8E23,stroke-width:1px
    classDef server fill:#FFE4B5,stroke:#FF8C00,stroke-width:1px
    classDef client fill:#FFF4C1,stroke:#DAA520,stroke-width:1px
    classDef resources fill:#F0F8FF,stroke:#4682B4,stroke-width:1px
    classDef config fill:#F5E6E8,stroke:#C71585,stroke-width:1px
```
