# hsz/intellij-platform-plugin-oauth2-flow architecture

> Architecture diagram of the GitHub repository hsz/intellij-platform-plugin-oauth2-flow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hsz/intellij-platform-plugin-oauth2-flow
- Repository: https://github.com/hsz/intellij-platform-plugin-oauth2-flow

## Overview

##### Project type and purpose
- This is an IntelliJ Platform Plugin (Kotlin/Gradle) template scaffolding an OAuth2 flow integration.
- It consists of IDE extension points, service classes, UI tool-window factories, resources (plugin.xml), and CI/CD workflows for build, test, and release.

##### File structure
Top-level:
- `.github/workflows/` → CI jobs: build, run UI tests, release
- `build.gradle.kts` + `gradle/` → build configuration, dependency versions
- `src/main/kotlin/com/github/hsz/intellijplatformpluginoauth2flow/`
– MyBundle.kt (i18n)
– `services/MyProjectService.kt` (Project-level service)
– `startup/MyProjectActivity.kt` (Project startup hook)
– `toolWindow/MyToolWindowFactory.kt` (Tool window factory/ UI)
- `src/main/resources/META-INF/plugin.xml` → plugin metadata, extension-point declarations
- `src/test/` → unit/integration tests + testData

##### README for additional insights
- Confirms this is a template based on JetBrains’ IntelliJ Platform Plugin Template.

a. Main components
1. IntelliJ IDE Host (Platform)
2. Plugin Module
– plugin.xml (metadata + extension declarations)
– MyProjectActivity (startup extension)
– MyProjectService (service extension)
– MyToolWindowFactory (tool-window UI extension)
– MyBundle (message bundle for i18n)
3. Gradle Build System & CI/CD
– Gradle (build, package, publish)
– GitHub Actions (build, UI tests, release)
b. Relationships & data flow
1. Startup: IntelliJ loads plugin.xml → instantiates MyProjectActivity on project open
2. Service lookup: MyProjectActivity or UI fetches MyProjectService via ServiceManager
3. UI: MyToolWindowFactory registers a tool window; user actions invoke services/activities
4. Build pipeline: developer commit → GitHub Actions → Gradle build → run UI tests → publish artifact
c. Architectural patterns & principles
– Extension-Point Pattern: plugin.xml declares hooks into the host platform
– Factory Pattern: ToolWindowFactory creates UI components on demand
– Service Locator Pattern: ProjectService retrieved via IntelliJ’s ServiceManager
– Separation of Concerns: startup logic vs. service logic vs. UI logic
d. Key technologies & frameworks
– Kotlin & IntelliJ Platform SDK
– Gradle Kotlin DSL & Version Catalog
– GitHub Actions for CI/CD
– Qodana for static code analysis

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entities
    IDE["IntelliJ IDE Host"]:::platform

    %% Plugin Entry
    PluginXML["plugin.xml\n(metadata + extensions)"]:::entry
    IDE -->|"load"| PluginXML

    %% Plugin Module
    subgraph "Plugin Module"
      direction TB
      Activity["MyProjectActivity\n«activity»"]:::startup
      Service["MyProjectService\n«service»"]:::service
      ToolWindow["MyToolWindowFactory\n«factory»"]:::ui
      Bundle["MyBundle\n(i18n)"]:::i18n
      PluginXML -->|"instantiate"| Activity
      PluginXML -->|"declare service"| Service
      PluginXML -->|"declare toolWindow"| ToolWindow
      Activity -->|"fetch via ServiceManager"| Service
      ToolWindow -->|"uses service"| Service
    end

    %% Build & CI/CD Pipeline
    subgraph "Build & CI/CD Pipeline"
      direction TB
      Commit["Developer Commit"]:::dev
      Actions["GitHub Actions"]:::ci
      Gradle["Gradle Build\n(.kts + libs.versions.toml)"]:::build
      Tests["Run UI Tests"]:::ci
      Publish["Publish Artifact\n(plugin.jar)"]:::ci
      Commit --> Actions
      Actions -->|"build"| Gradle
      Gradle --> Actions
      Actions --> Tests
      Actions --> Publish
    end

    %% Resources & Configurations
    subgraph "Resources & Config"
      direction TB
      Messages["MyBundle.properties"]:::i18n
      PluginXML --> Messages
      Qodana["Qodana Analysis\n(qodana.yml)"]:::analysis
      IDE --> Qodana
      RunConfig["Run Configurations"]:::config
    end

    %% Tests
    subgraph "Test Suite"
      direction TB
      UnitTest["MyPluginTest.kt"]:::test
      TestData1["foo.xml"]:::test
      TestData2["foo_after.xml"]:::test
      UnitTest --> TestData1
      UnitTest --> TestData2
      Commit --> UnitTest
    end

    %% Click Events
    click PluginXML "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/src/main/resources/META-INF/plugin.xml"
    click Activity "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/src/main/kotlin/com/github/hsz/intellijplatformpluginoauth2flow/startup/MyProjectActivity.kt"
    click Service "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/src/main/kotlin/com/github/hsz/intellijplatformpluginoauth2flow/services/MyProjectService.kt"
    click ToolWindow "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/src/main/kotlin/com/github/hsz/intellijplatformpluginoauth2flow/toolWindow/MyToolWindowFactory.kt"
    click Bundle "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/src/main/kotlin/com/github/hsz/intellijplatformpluginoauth2flow/MyBundle.kt"
    click Messages "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/src/main/resources/messages/MyBundle.properties"
    click Gradle "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/build.gradle.kts"
    click Gradle "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/settings.gradle.kts"
    click Gradle "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/gradle/libs.versions.toml"
    click Gradle "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/gradle.properties"
    click Actions "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/.github/workflows/build.yml"
    click Actions "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/.github/workflows/run-ui-tests.yml"
    click Actions "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/.github/workflows/release.yml"
    click UnitTest "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/src/test/kotlin/com/github/hsz/intellijplatformpluginoauth2flow/MyPluginTest.kt"
    click TestData1 "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/src/test/testData/rename/foo.xml"
    click TestData2 "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/src/test/testData/rename/foo_after.xml"
    click Qodana "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/qodana.yml"
    click RunConfig "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/.run/Run Plugin.run.xml"
    click RunConfig "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/.run/Run Tests.run.xml"
    click RunConfig "https://github.com/hsz/intellij-platform-plugin-oauth2-flow/blob/main/.run/Run Verifications.run.xml"

    %% Styles
    classDef platform fill:#dddddd,stroke:#333,stroke-width:1px
    classDef entry fill:#f2f2f2,stroke:#666,stroke-width:1px
    classDef startup fill:#cfe2f3,stroke:#2a6592,stroke-width:1px
    classDef service fill:#d9ead3,stroke:#6aa84f,stroke-width:1px
    classDef ui fill:#fce5cd,stroke:#e69138,stroke-width:1px
    classDef i18n fill:#fff2cc,stroke:#bf9000,stroke-width:1px
    classDef build fill:#d9d2e9,stroke:#674ea7,stroke-width:1px
    classDef ci fill:#ead1dc,stroke:#a64d79,stroke-width:1px
    classDef dev fill:#e6e0ec,stroke:#5b4787,stroke-width:1px
    classDef config fill:#f4cccc,stroke:#cc0000,stroke-width:1px
    classDef analysis fill:#d0e0e3,stroke:#3d85c6,stroke-width:1px
    classDef test fill:#ececec,stroke:#666666,stroke-width:1px
```
