# beckn/beckn-onix architecture

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

- Interactive diagram: https://gitdiagram.com/beckn/beckn-onix
- Repository: https://github.com/beckn/beckn-onix

## Overview

Based on our analysis of the file tree and README, Beckn-ONIX is a reference implementation for setting up and maintaining a Beckn network. It offers both CLI and GUI installation methods and uses a range of modern deployment technologies such as AWS CDK (with stacks for EKS, DocumentDB, RDS, Redis, VPC, RabbitMQ, etc.), Helm charts for containerized deployments (covering services like the BAP, BPP, Gateway, and Registry), and Docker Compose scripts. The project is organized into distinct layers and components—from infrastructure provisioning and orchestration to deployment templates and user-facing installers.

##### Main Components
- Infrastructure Provisioning: Represent the AWS CDK module as one core component. This includes stacks for different services (eks-stack, documentdb-stack, rds-stack, redis-stack, rabbitmq-stack, vpc-stack) that build and orchestrate the underlying cloud infrastructure.
- Deployment Templates: Separate Helm charts for each core service – BAP (Beckn Application Provider), BPP (Beckn Service Provider), Gateway, and Registry. These Helm charts define the containerized deployment of the services.
- Installers:
- CLI Installer: Shown by the “install” directory containing various Docker Compose files and related scripts.
- GUI Installer: Represented by the “onix-gui” folder (and its nested “GUI” application) which provides a browser-based installation experience.
- Layer2 Configuration: As indicated by the “layer2” directory, this covers additional configuration and sample YAML files for extended or specialized setups.
- Documentation and Specifications: Include a component for supporting documentation (docs, specification, and swagger) that outlines the Beckn protocol specifications and usage instructions.

##### Relationships and Interactions
- Directional flows from the installer components (CLI and GUI) to the deployment system. For example, user actions via the GUI call API routes (found within onix-gui’s API endpoints) that trigger automated deployment processes.
- Connection between Helm chart deployments and the running services in the Kubernetes cluster (e.g., how the helm chart for “gateway” deploys the networking component and interacts with other services like BAP and Registry).
- Layers for configuration (Layer2) and how they feed into installing and configuring the overall Beckn network.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Demonstrate distinct layers (infrastructure provisioning, deployment orchestration, application execution, and configuration).
- Modularity: Show individual services (BAP, BPP, Gateway, Registry) as self-contained modules that integrate via clearly defined interfaces and configuration files.
- Infrastructure-as-Code: Emphasize the use of AWS CDK to provision and manage cloud resources.
- Containerization & Orchestration: Illustrate the deployment of services via Helm and Docker Compose, suggesting a microservices-oriented architecture.

##### Technologies and Tools
- AWS CDK for infrastructure (with specific stacks for various services)
- Helm for deploying Kubernetes applications
- Docker Compose for local or non-Kubernetes setups
- Next.js/React environment for the GUI installer (as seen in “onix-gui/GUI”)
- Node.js/TypeScript support for several scripts and server-side API components

- That you include a section for configuration management (Layer2 and additional YAML configuration files).

## Diagram (Mermaid)

```mermaid
flowchart TD
    U["User"]:::user

    subgraph "Installation Layer"
        CLI["CLI Installer"]:::installer
        GUI["GUI Installer"]:::installer
    end

    subgraph "Deployment Templates"
        BAP["BAP Service"]:::helm
        BPP["BPP Service"]:::helm
        Gateway["Gateway Service"]:::helm
        Registry["Registry Service"]:::helm
    end

    L2["Layer2 Configuration"]:::config
    AWS["AWS CDK Provisioning (VPC, EKS, RDS, DocumentDB, Redis, RabbitMQ)"]:::infrastructure
    Docs["Documentation & Specs"]:::docs

    U --> CLI
    U --> GUI
    CLI --> BAP
    GUI --> BAP
    L2 --> BAP
    BAP --> BPP
    BPP --> Gateway
    Gateway --> Registry
    Registry --> AWS
    Docs -.-> CLI
    Docs -.-> AWS

    classDef installer fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef helm fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef infrastructure fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef config fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef docs fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef user fill:#FFB6C1,stroke:#000,stroke-width:2px;

    click CLI "https://github.com/beckn/beckn-onix/tree/main/install"
    click GUI "https://github.com/beckn/beckn-onix/tree/main/onix-gui/GUI"
    click BAP "https://github.com/beckn/beckn-onix/tree/main/aws-cdk/helm/beckn-onix-bap"
    click BPP "https://github.com/beckn/beckn-onix/tree/main/aws-cdk/helm/beckn-onix-bpp"
    click Gateway "https://github.com/beckn/beckn-onix/tree/main/aws-cdk/helm/gateway"
    click Registry "https://github.com/beckn/beckn-onix/tree/main/aws-cdk/helm/registry"
    click AWS "https://github.com/beckn/beckn-onix/tree/main/aws-cdk/beckn-cdk/lib"
    click L2 "https://github.com/beckn/beckn-onix/tree/main/layer2"
    click Docs "https://github.com/beckn/beckn-onix/tree/main/docs"
```
