# payara/ecosystem-starter architecture

> Architecture diagram of the GitHub repository payara/ecosystem-starter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/payara/ecosystem-starter
- Repository: https://github.com/payara/ecosystem-starter

## Overview

#### Purpose and Shape
Payara Starter is a Maven multi-module project that provides: (1) a browser-based application starter and generator, and (2) a Maven archetype for creating deployable Payara applications. The root build coordinates `starter-ui`, `starter-generator`, and `starter-archetype` via `pom.xml`.

#### Primary Entry Points
The deployed starter is a Jakarta EE/Payara web application. Its HTTP/API boundary is centered on `starter-ui/src/main/java/fish/payara/starter/ERDiagramResource.java` and application-generation endpoints under `starter-ui/src/main/java/fish/payara/starter/resources/ApplicationResource.java`. The browser shell is `starter-ui/src/main/webapp/index.html`.

The distributable project-template entry point is the Maven archetype descriptor at `starter-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml`.

#### UI and ER-Diagram Intake
`starter-ui` hosts the static ER designer and predefined Mermaid ER examples under `starter-ui/src/main/webapp/erDiagram` and client assets such as `starter-ui/src/main/webapp/assets/main.js`. Submitted diagrams reach resource endpoints, where they can be parsed directly or enhanced through chat-oriented flows:
- `starter-ui/src/main/java/fish/payara/starter/ERDiagramPlainChat.java`
- `starter-ui/src/main/java/fish/payara/starter/ERDiagramEnhanceChat.java`
- `starter-ui/src/main/java/fish/payara/starter/ERDiagramResource.java`

#### AI, Rate Limiting, and External Boundaries
AI integration is isolated in `starter-ui/src/main/java/fish/payara/starter/LangChainChatService.java`, with client construction in `starter-ui/src/main/java/fish/payara/starter/OpenAIFactory.java`. This is the external OpenAI/LangChain boundary and should be governed by MicroProfile configuration in `starter-ui/src/main/resources/META-INF/microprofile-config.properties`.

Request protection is separated into `starter-ui/src/main/java/fish/payara/starter/IpRateLimitFilter.java` and `starter-ui/src/main/java/fish/payara/starter/RateLimited.java`, placing rate control before expensive AI-backed operations.

#### Generation Pipeline
`starter-generator` converts Mermaid-derived ER input into a domain model and generated application source. `starter-generator/src/main/java/fish/payara/starter/application/generator/ERDiagramParser.java` parses the diagram into `ERModel`, `Entity`, `Attribute`, and `Relationship` objects under `starter-generator/src/main/java/fish/payara/starter/application/domain`.

`starter-generator/src/main/java/fish/payara/starter/application/generator/CRUDAppGenerator.java` renders that model into a CRUD application using FreeMarker templates. Output layers include JPA descriptors, repositories, REST controllers, JSF backing beans/views, and HTML:
- `starter-generator/src/main/resources/template/descriptor`
- `starter-generator/src/main/resources/template/repository`
- `starter-generator/src/main/resources/template/rest`

#### UI-to-Artifact Orchestration
The UI module owns request-level generation options and artifact delivery. `starter-ui/src/main/java/fish/payara/starter/resources/ApplicationGenerator.java` bridges UI requests to generator behavior; `starter-ui/src/main/java/fish/payara/starter/resources/ApplicationConfiguration.java` represents/configures requested application variants. `DockerImageTagService.java` provides a boundary for Docker image tag resolution, likely used when assembling deployment-oriented output.

#### Generated Starter Archetype
The archetype packages a baseline Payara app rather than using the ER generator. Its template includes REST resources, optional security/bootstrap material, web pages, Maven and Gradle builds, and Docker support:
- `starter-archetype/src/main/resources/archetype-resources/pom.xml`
- `starter-archetype/src/main/resources/archetype-resources/src/main/java/resource/HelloWorldResource.java`
- `starter-archetype/src/main/resources/archetype-resources/Dockerfile`

Security-oriented template content is isolated under `starter-archetype/src/main/resources/archetype-resources/src/main/java/secured`, with LDAP seed data at `starter-archetype/src/main/resources/archetype-resources/src/main/resources/ldap-test.ldif`.

#### Runtime and Delivery
The principal runtime is Payara/Jakarta EE, using REST, CDI, JPA, JSF, and MicroProfile configuration. The UI is packaged as a web application with Payara deployment metadata in `starter-ui/src/main/webapp/WEB-INF/payara-web.xml`. Maven is the repository build system; generated applications additionally support Gradle and Docker. CI is defined by `Jenkinsfile`.

Main entry points: [`starter-ui/src/main/webapp/index.html`](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/webapp/index.html) (Browser shell), [`pom.xml`](https://github.com/payara/ecosystem-starter/blob/master/pom.xml) (Maven reactor), [`starter-ui/src/main/java/fish/payara/starter/resources/ApplicationGenerator.java`](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/resources/ApplicationGenerator.java) (Application generator bridge), [`starter-ui/src/main/java/fish/payara/starter/ERDiagramResource.java`](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/ERDiagramResource.java) (ER and application API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Starter UI"]
  node_browser["Browser shell<br/>web client<br/>[index.html]"]
  node_er_assets["ER designer assets<br/>static assets"]
  node_api["ER and application API<br/>JAX-RS resources"]
  node_app_resource["Application endpoints<br/>JAX-RS resources"]
  node_rate_limit["IP rate limiting<br/>request filter"]
  node_chat_flows["Diagram chat flows<br/>chat handlers"]
  node_ai_service["LangChain chat service<br/>AI integration"]
  node_mp_config["MicroProfile config<br/>configuration"]
  node_generation_orchestrator["Application generator bridge<br/>orchestrator"]
  node_docker_tags["Docker tag resolver<br/>external integration"]
  node_payara_deployment["Payara web deployment<br/>runtime descriptor<br/>[payara-web.xml]"]
end

subgraph group_generator["ER Generator"]
  node_er_parser["ER diagram parser"]
  node_er_domain["ER domain model"]
  node_crud_renderer["CRUD app generator<br/>source generator"]
  node_crud_templates["CRUD templates<br/>FreeMarker templates"]
end

subgraph group_archetype["Maven Archetype"]
  node_archetype_descriptor["Archetype descriptor<br/>Maven archetype"]
  node_archetype_template["Baseline app template<br/>application template"]
end

node_root_build{{"Maven reactor<br/>build<br/>[pom.xml]"}}
node_ci{{"Jenkins CI<br/>CI pipeline"}}
node_openai(("OpenAI / LangChain<br/>external AI API"))
node_generated_app["Generated Payara app<br/>generated artifact"]

node_root_build -->|"builds"| node_browser
node_root_build -->|"builds"| node_er_parser
node_root_build -->|"builds"| node_archetype_descriptor
node_browser -->|"loads"| node_er_assets
node_browser -->|"submits diagrams"| node_api
node_browser -->|"requests generation"| node_app_resource
node_rate_limit -->|"guards"| node_api
node_api -->|"uses"| node_chat_flows
node_chat_flows -->|"enhances diagrams"| node_ai_service
node_mp_config -.->|"configures"| node_ai_service
node_ai_service -->|"calls"| node_openai
node_app_resource -->|"delegates"| node_generation_orchestrator
node_generation_orchestrator -.->|"resolves tags"| node_docker_tags
node_generation_orchestrator -->|"parses ER input"| node_er_parser
node_er_parser -->|"creates"| node_er_domain
node_er_domain -->|"drives rendering"| node_crud_renderer
node_crud_templates -->|"rendered by"| node_crud_renderer
node_crud_renderer -->|"emits source"| node_generated_app
node_payara_deployment -.->|"deploys UI"| node_browser
node_archetype_descriptor -->|"packages"| node_archetype_template
node_archetype_template -->|"creates baseline app"| node_generated_app
node_ci -->|"builds"| node_root_build

click node_root_build "https://github.com/payara/ecosystem-starter/blob/master/pom.xml"
click node_browser "https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/webapp/index.html"
click node_er_assets "https://github.com/payara/ecosystem-starter/tree/master/starter-ui/src/main/webapp/erDiagram"
click node_api "https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/ERDiagramResource.java"
click node_app_resource "https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/resources/ApplicationResource.java"
click node_rate_limit "https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/IpRateLimitFilter.java"
click node_chat_flows "https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/ERDiagramPlainChat.java"
click node_ai_service "https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/LangChainChatService.java"
click node_mp_config "https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/resources/META-INF/microprofile-config.properties"
click node_generation_orchestrator "https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/resources/ApplicationGenerator.java"
click node_docker_tags "https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/resources/DockerImageTagService.java"
click node_payara_deployment "https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/webapp/WEB-INF/payara-web.xml"
click node_er_parser "https://github.com/payara/ecosystem-starter/blob/master/starter-generator/src/main/java/fish/payara/starter/application/generator/ERDiagramParser.java"
click node_er_domain "https://github.com/payara/ecosystem-starter/tree/master/starter-generator/src/main/java/fish/payara/starter/application/domain"
click node_crud_renderer "https://github.com/payara/ecosystem-starter/blob/master/starter-generator/src/main/java/fish/payara/starter/application/generator/CRUDAppGenerator.java"
click node_crud_templates "https://github.com/payara/ecosystem-starter/tree/master/starter-generator/src/main/resources/template"
click node_archetype_descriptor "https://github.com/payara/ecosystem-starter/blob/master/starter-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml"
click node_archetype_template "https://github.com/payara/ecosystem-starter/tree/master/starter-archetype/src/main/resources/archetype-resources"
click node_ci "https://github.com/payara/ecosystem-starter/blob/master/Jenkinsfile"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_er_assets,node_api,node_app_resource,node_rate_limit,node_chat_flows,node_ai_service,node_mp_config,node_generation_orchestrator,node_docker_tags,node_payara_deployment toneBlue
class node_er_parser,node_er_domain,node_crud_renderer,node_crud_templates toneAmber
class node_archetype_descriptor,node_archetype_template toneMint
class node_root_build,node_ci,node_openai,node_generated_app toneNeutral
```

## Components

### Starter UI

Deployed Payara web application.

- [Browser shell](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/webapp/index.html): web client · Hosts the ER designer and generation UI. · `starter-ui/src/main/webapp/index.html`
- [ER designer assets](https://github.com/payara/ecosystem-starter/tree/master/starter-ui/src/main/webapp/erDiagram): static assets · Includes Mermaid ER examples and client behavior. · `starter-ui/src/main/webapp/erDiagram`
- [ER and application API](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/ERDiagramResource.java): JAX-RS resources · Accepts diagrams and application-generation requests. · `starter-ui/src/main/java/fish/payara/starter/ERDiagramResource.java`
- [Application endpoints](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/resources/ApplicationResource.java): JAX-RS resources · Exposes application-generation operations. · `starter-ui/src/main/java/fish/payara/starter/resources/ApplicationResource.java`
- [IP rate limiting](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/IpRateLimitFilter.java): request filter · Protects costly AI-backed requests. · `starter-ui/src/main/java/fish/payara/starter/IpRateLimitFilter.java`
- [Diagram chat flows](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/ERDiagramPlainChat.java): chat handlers · Plain and enhancement flows process submitted diagrams. · `starter-ui/src/main/java/fish/payara/starter/ERDiagramPlainChat.java`
- [LangChain chat service](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/LangChainChatService.java): AI integration · Isolates the OpenAI/LangChain boundary. · `starter-ui/src/main/java/fish/payara/starter/LangChainChatService.java`
- [MicroProfile config](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/resources/META-INF/microprofile-config.properties): configuration · Supplies AI integration settings. · `starter-ui/src/main/resources/META-INF/microprofile-config.properties`
- [Application generator bridge](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/resources/ApplicationGenerator.java): orchestrator · Applies requested variants and delivers generated artifacts. · `starter-ui/src/main/java/fish/payara/starter/resources/ApplicationGenerator.java`
- [Docker tag resolver](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/java/fish/payara/starter/resources/DockerImageTagService.java): external integration · Resolves image tags for deployment-oriented output. · `starter-ui/src/main/java/fish/payara/starter/resources/DockerImageTagService.java`
- [Payara web deployment](https://github.com/payara/ecosystem-starter/blob/master/starter-ui/src/main/webapp/WEB-INF/payara-web.xml): runtime descriptor · Packages the UI for Payara. · `starter-ui/src/main/webapp/WEB-INF/payara-web.xml`

### ER Generator

Transforms Mermaid ER diagrams into CRUD source.

- [ER diagram parser](https://github.com/payara/ecosystem-starter/blob/master/starter-generator/src/main/java/fish/payara/starter/application/generator/ERDiagramParser.java): parser · Converts Mermaid ER input into the domain model. · `starter-generator/src/main/java/fish/payara/starter/application/generator/ERDiagramParser.java`
- [ER domain model](https://github.com/payara/ecosystem-starter/tree/master/starter-generator/src/main/java/fish/payara/starter/application/domain): domain model · ERModel, entities, attributes, and relationships. · `starter-generator/src/main/java/fish/payara/starter/application/domain`
- [CRUD app generator](https://github.com/payara/ecosystem-starter/blob/master/starter-generator/src/main/java/fish/payara/starter/application/generator/CRUDAppGenerator.java): source generator · Renders a complete CRUD application from the ER model. · `starter-generator/src/main/java/fish/payara/starter/application/generator/CRUDAppGenerator.java`
- [CRUD templates](https://github.com/payara/ecosystem-starter/tree/master/starter-generator/src/main/resources/template): FreeMarker templates · Produces descriptors, repositories, REST, JSF, and HTML. · `starter-generator/src/main/resources/template`

### Maven Archetype

Packages a baseline Payara application template.

- [Archetype descriptor](https://github.com/payara/ecosystem-starter/blob/master/starter-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml): Maven archetype · Defines the distributable baseline application template. · `starter-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml`
- [Baseline app template](https://github.com/payara/ecosystem-starter/tree/master/starter-archetype/src/main/resources/archetype-resources): application template · Includes REST, pages, builds, Docker, and optional security material. · `starter-archetype/src/main/resources/archetype-resources`

### Other components

- [Maven reactor](https://github.com/payara/ecosystem-starter/blob/master/pom.xml): build · Coordinates the three project modules. · `pom.xml`
- [Jenkins CI](https://github.com/payara/ecosystem-starter/blob/master/Jenkinsfile): CI pipeline · `Jenkinsfile`
- **OpenAI / LangChain**: external AI API
- **Generated Payara app**: generated artifact · Deployable application with Maven/Gradle and Docker support.

## Connections

- Maven reactor → Browser shell: builds
- Maven reactor → ER diagram parser: builds
- Maven reactor → Archetype descriptor: builds
- Browser shell → ER designer assets: loads
- Browser shell → ER and application API: submits diagrams
- Browser shell → Application endpoints: requests generation
- IP rate limiting → ER and application API: guards
- ER and application API → Diagram chat flows: uses
- Diagram chat flows → LangChain chat service: enhances diagrams
- MicroProfile config → LangChain chat service: configures
- LangChain chat service → OpenAI / LangChain: calls
- Application endpoints → Application generator bridge: delegates
- Application generator bridge → Docker tag resolver: resolves tags
- Application generator bridge → ER diagram parser: parses ER input
- ER diagram parser → ER domain model: creates
- ER domain model → CRUD app generator: drives rendering
- CRUD templates → CRUD app generator: rendered by
- CRUD app generator → Generated Payara app: emits source
- Payara web deployment → Browser shell: deploys UI
- Archetype descriptor → Baseline app template: packages
- Baseline app template → Generated Payara app: creates baseline app
- Jenkins CI → Maven reactor: builds
