# rehmat123/jira-agent architecture

> Architecture diagram of the GitHub repository rehmat123/jira-agent, 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/rehmat123/jira-agent
- Repository: https://github.com/rehmat123/jira-agent

## Overview

##### Project type and purpose
- This is a full-stack “JIRA AI Agent” application.
- Its purpose is to provide an intelligent interface (React frontend) backed by an Express/Node.js API that uses the LangChain framework and OpenAI to automate JIRA ticket creation, updates, time tracking, and sprint management via natural-language commands.

##### File structure
Top-level directories and files:
- backend/ ── Node.js/Express code, LangChain integrations, JIRA tools, schemas, and server entrypoint (server.ts)
- src/     ── React + TypeScript frontend app, UI components, CSS, tests
- public/  ── Static assets (index.html, manifest, robots) served to the browser
- Configuration files: tsconfig.json (root & backend), pnpm-lock.yaml, package.json, .env.example, tailwind.config.js, postcss.config.js
Patterns & architectural choices:
- Separation of concerns between frontend (UI) and backend (API)
- In backend: tools/jira (JIRA API adapter), schemas (validation), templates (LangChain prompt templates)
- No internal database—state is ephemeral or managed externally; relies on external services (JIRA REST API, OpenAI API)

##### Key insights from the README
- Frontend: React + TypeScript + Tailwind CSS
- Backend: Express + LangChain + OpenAI + JIRA REST API
- Features: natural-language ticket management, time tracking, sprint dashboards
- Deployment: frontend serves on :3001, backend on :5001
- No mention of a database—heavy use of external APIs

1. User (Browser)
2. React Frontend (SPA)
- UI Components (src/components)
- Static hosting (public/)
3. API Gateway / Express Backend (backend/src/server.ts)
4. LangChain Orchestrator (backend/src/templates & chain setup)
5. JIRA Adapter (backend/src/tools/jira)
6. OpenAI Integration (LangChain → OpenAI API)
7. External Services:
- JIRA REST API
- OpenAI API
8. Configuration & Environment (.env variables)

b. Relationships & interactions:
- Browser ↔ React Frontend (HTTPS, WebSocket for real-time updates)
- Frontend → Backend API (HTTP REST calls)
- Backend → LangChain engine (in-process orchestration)
- LangChain Node calls:
– JIRA Adapter → JIRA REST API
– OpenAI Client → OpenAI API
- Responses flow back through each layer to the user

c. Architectural patterns & principles:
- Client-Server separation (SPA + API)
- Layered architecture:
– Presentation Layer (React)
– API Layer (Express routes/controllers)
– Business Logic / Orchestration Layer (LangChain chains & templates)
– Integration Layer (JIRA & OpenAI adapters)
- Configuration externalized via .env
- Type safety with TypeScript end-to-end
- Modular design: tools/, schemas/, templates/, components/

d. Technologies & frameworks labeling:
- React, Tailwind CSS
- Express.js, Node.js
- LangChain framework
- OpenAI API, JIRA REST API
- pnpm, Jest, ESLint/Prettier

##### Detailed capture of essential elements
- Static asset hosting (public/) separate from the React build output.
- LangChain “templates/system.ts” and “schemas/jira.schema.ts” as part of the orchestration layer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Configuration
    Config["Env Config (.env.example)"]:::config
    TSRoot["Root tsconfig.json"]:::config
    TSBackend["Backend tsconfig.json"]:::config

    %% Frontend Layer
    subgraph "Frontend (React + Tailwind)"
        direction TB
        Public["Static Assets<br/>public/"]:::frontend
        ReactApp["React SPA<br/>src/index.tsx"]:::frontend
        UIComponents["UI Components<br/>src/components/ui/"]:::frontend
        CSS1["CSS Stylesheet<br/>src/index.css"]:::frontend
        CSS2["Tailwind Config<br/>tailwind.config.js"]:::frontend
        CSS3["PostCSS Config<br/>postcss.config.js"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend"
        direction TB
        Server["Express API Server<br/>backend/src/server.ts"]:::backend
        subgraph "Orchestration Layer (LangChain)"
            direction TB
            Template["Prompt Templates<br/>system.ts"]:::backend
            SchemaVal["JIRA Schema Validation<br/>jira.schema.ts"]:::backend
        end
        subgraph "Integration Layer"
            direction TB
            TicketOp["Ticket Operations<br/>jiraTicket.ts"]:::backend
            JiraTools["JIRA Utilities<br/>tools.ts"]:::backend
            OpenAIClient["OpenAI Client"]:::backend
        end
    end

    %% External Services
    subgraph "External Services"
        direction TB
        JiraAPI["JIRA REST API"]:::external
        OpenAIAPI["OpenAI API"]:::external
    end

    %% User Flow
    Browser["User Browser"]:::external

    Browser -->|"loads"| Public
    Browser -->|"interacts"| ReactApp
    Public --> ReactApp
    UIComponents --> ReactApp
    CSS1 --> ReactApp
    CSS2 --> ReactApp
    CSS3 --> ReactApp

    ReactApp -->|"HTTP REST"| Server
    Config --> ReactApp
    TSRoot --> ReactApp

    Server -->|"invokes"| Template
    Server -->|"invokes"| SchemaVal
    Server -->|"routes to"| TicketOp
    Server -->|"routes to"| OpenAIClient
    Config --> Server
    TSBackend --> Server

    Template -->|"uses"| TicketOp
    Template -->|"uses"| OpenAIClient
    SchemaVal --> Template

    TicketOp -->|"calls"| JiraAPI
    JiraTools --> TicketOp
    OpenAIClient -->|"calls"| OpenAIAPI

    JiraAPI -->|"response"| TicketOp
    OpenAIAPI -->|"response"| OpenAIClient
    TicketOp --> Server
    OpenAIClient --> Server
    Server --> ReactApp
    ReactApp --> Browser

    %% Click Events
    click Public "https://github.com/rehmat123/jira-agent/tree/master/public/"
    click ReactApp "https://github.com/rehmat123/jira-agent/blob/master/src/index.tsx"
    click UIComponents "https://github.com/rehmat123/jira-agent/tree/master/src/components/ui/"
    click CSS1 "https://github.com/rehmat123/jira-agent/blob/master/src/index.css"
    click CSS2 "https://github.com/rehmat123/jira-agent/blob/master/tailwind.config.js"
    click CSS3 "https://github.com/rehmat123/jira-agent/blob/master/postcss.config.js"
    click Server "https://github.com/rehmat123/jira-agent/blob/master/backend/src/server.ts"
    click Template "https://github.com/rehmat123/jira-agent/blob/master/backend/src/templates/system.ts"
    click SchemaVal "https://github.com/rehmat123/jira-agent/blob/master/backend/src/schemas/jira.schema.ts"
    click TicketOp "https://github.com/rehmat123/jira-agent/blob/master/backend/src/tools/jira/jiraTicket.ts"
    click JiraTools "https://github.com/rehmat123/jira-agent/blob/master/backend/src/tools/jira/tools.ts"
    click Config "https://github.com/rehmat123/jira-agent/blob/master/.env.example"
    click TSRoot "https://github.com/rehmat123/jira-agent/blob/master/tsconfig.json"
    click TSBackend "https://github.com/rehmat123/jira-agent/blob/master/backend/tsconfig.json"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,stroke-width:1px;
    classDef backend fill:#D0F0D0,stroke:#28a745,stroke-width:1px;
    classDef external fill:#FFE0B2,stroke:#d97706,stroke-width:1px;
    classDef config fill:#F0F0F0,stroke:#6a737d,stroke-width:1px;
```
