# apideck-libraries/portman architecture

> Architecture diagram of the GitHub repository apideck-libraries/portman, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apideck-libraries/portman
- Repository: https://github.com/apideck-libraries/portman

## Overview

##### Main Components Overview
The system architecture should be divided into these primary components:

**[OpenAPI Input] --> [Portman Core] --> [Postman Output]**

- [Services]

- [Testing & Validation]

##### Detailed Component Breakdown

a) Input Processing Layer:
- OpenAPI Parser (src/oas/*)
- File/URL Input Handlers
- Configuration Readers (src/lib/getConfig.ts)

b) Core Processing Layer (src/application/):
- Test Suite Generator
- Collection Writer
- Variable Manager
- Request Modifier
- Fuzzing Engine

c) Service Layer (src/services/):
- OpenAPI to Postman Conversion Service
- Postman API Service
- Dynamic Variable Generator
- Repository Service

d) Output Processing Layer:
- Collection Writer
- Newman Runner
- Postman Sync Service

##### Key Interactions to Highlight

**[Configuration]**
- ↓
**[Input Handler] → [OpenAPI Parser]**
- ↓
**[Core Processing] → [Test Generation]**
- ↓
**[Variable Management] → [Request Modification]**
- ↓
**[Collection Writer] → [Postman/Newman Output]**

##### Specific elements

a) Input Sources:
- OpenAPI Specification (local/remote)
- Configuration Files
- Environment Variables

b) Processing Components:
- Contract Test Generator
- Variation Test Generator
- Fuzzing Engine
- Variable Assignment System
- Request Modifier

c) Output Destinations:
- Postman Collection
- Newman Test Runner
- Postman Cloud Sync

##### Flow Control

Main processing flow:
**[Input] → [Parsing] → [Processing] → [Test Generation] → [Output]**
- ↑          ↑            ↑              ↑               ↑
- [Configuration Management]──────┘               |
- ↑                               |
- [External Services]←──────────────────┘

##### Integration Points

Integration with:
- Postman API
- Newman Test Runner
- CI/CD Systems
- Environment Variables
- File System

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        OAS[OpenAPI Specification]
        Config[Configuration Files]
        EnvVars[Environment Variables]
    end

    subgraph Core
        Parser["OpenAPI Parser"]:::core
        ConfigMgr["Configuration Management"]:::core
        TestGen["Test Suite Generator"]:::core
        CollWriter["Collection Writer"]:::core
        VarMgr["Variable Manager"]:::core
        ReqMod["Request Modifier"]:::core
        FuzzEng["Fuzzing Engine"]:::core
        IntTest["Integration Test Writer"]:::core
        VarTest["Variation Test Writer"]:::core
    end

    subgraph Services
        OAS2PM["OpenAPI to Postman Converter"]:::service
        PMApi["Postman API Service"]:::service
        DynVar["Dynamic Variable Generator"]:::service
        RepoSvc["Repository Service"]:::service
        SyncSvc["Postman Sync Service"]:::service
    end

    subgraph Output
        PMColl[Postman Collection]
        Newman["Newman Runner"]:::output
        PMCloud[Postman Cloud]
    end

    OAS --> Parser
    Config --> ConfigMgr
    EnvVars --> ConfigMgr

    Parser --> TestGen
    ConfigMgr --> TestGen
    ConfigMgr --> ReqMod
    ConfigMgr --> VarMgr

    TestGen --> IntTest
    TestGen --> VarTest
    TestGen --> FuzzEng

    IntTest --> CollWriter
    VarTest --> CollWriter
    FuzzEng --> CollWriter
    ReqMod --> CollWriter
    VarMgr --> CollWriter

    CollWriter --> Newman
    CollWriter --> PMCloud

    OAS2PM --> CollWriter
    PMApi --> SyncSvc
    DynVar --> VarMgr
    RepoSvc --> PMApi
    SyncSvc --> PMCloud

    classDef core fill:#2374ab
    classDef service fill:#ff7f50
    classDef output fill:#4caf50

    click Parser "https://github.com/apideck-libraries/portman/blob/main/src/oas/OpenApiParser.ts"
    click ConfigMgr "https://github.com/apideck-libraries/portman/blob/main/src/lib/getConfig.ts"
    click TestGen "https://github.com/apideck-libraries/portman/blob/main/src/application/TestSuite.ts"
    click CollWriter "https://github.com/apideck-libraries/portman/blob/main/src/application/CollectionWriter.ts"
    click FuzzEng "https://github.com/apideck-libraries/portman/blob/main/src/application/Fuzzer.ts"
    click VarMgr "https://github.com/apideck-libraries/portman/tree/main/src/application/variables"
    click ReqMod "https://github.com/apideck-libraries/portman/tree/main/src/application/overwrites"
    click IntTest "https://github.com/apideck-libraries/portman/blob/main/src/application/IntegrationTestWriter.ts"
    click VarTest "https://github.com/apideck-libraries/portman/blob/main/src/application/VariationWriter.ts"
    click Newman "https://github.com/apideck-libraries/portman/tree/main/src/application/newman"
    click PMApi "https://github.com/apideck-libraries/portman/blob/main/src/services/PostmanApiService.ts"
    click OAS2PM "https://github.com/apideck-libraries/portman/blob/main/src/services/OpenApiToPostmanService.ts"
    click DynVar "https://github.com/apideck-libraries/portman/blob/main/src/services/PostmanDynamicVarGenerator.ts"
    click RepoSvc "https://github.com/apideck-libraries/portman/blob/main/src/services/PostmanRepo.ts"
    click SyncSvc "https://github.com/apideck-libraries/portman/blob/main/src/services/PostmanSyncService.ts"
```
