# npci/falcon architecture

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

- Interactive diagram: https://gitdiagram.com/npci/falcon
- Repository: https://github.com/npci/falcon

## Overview

##### Main Components Identification

a. Helm Charts Layer (Core Infrastructure)
- fabric-ca: Certificate Authority services
- fabric-peer: Peer node management
- fabric-orderer: Ordering service management
- fabric-ops: Operational management components
- fabric-tools: Utility tools
- filestore: Configuration storage

b. Kubernetes Infrastructure Layer
- Deployments, StatefulSets, and Jobs
- Services and Ingress controllers
- PersistentVolumeClaims
- ConfigMaps and Secrets
- RBAC components (ServiceAccounts)

c. Hyperledger Fabric Network Layer
- Root CA, TLS CA, and Intermediate CAs
- Peer organizations
- Ordering service
- Channels
- Chaincode lifecycle

**┌─────────────────────────────────────────────────────┐**
- Client Interface                   │
- (Helm CLI / Configuration Files / Future GUI)       │
- ┘
- ↓
**┌─────────────────────────────────────────────────────┐**
- Falcon Components                   │
- ┬─────────────┬────────────┬───────────┤
- Fabric CA   │   Fabric    │  Fabric    │  Fabric   │
- Charts     │   Peer      │  Orderer   │   Ops     │
- ┴─────────────┴────────────┴───────────┘
- ↓
**┌─────────────────────────────────────────────────────┐**
- Kubernetes Infrastructure              │
- ┬─────────────┬────────────┬───────────┤
- Deployments │  Services   │  Config    │   RBAC    │
- & Jobs   │  & Ingress │   Maps     │           │
- ┴─────────────┴────────────┴───────────┘
- ↓
**┌─────────────────────────────────────────────────────┐**
- Hyperledger Fabric Network               │
- ┬─────────────┬────────────┬───────────┤
- CAs      │   Peers     │  Orderers  │ Channels  │
- ┴─────────────┴────────────┴───────────┘

##### Component Relationships

- Helm chart dependencies
- Service communications
- Certificate issuance flows
- Channel and chaincode management flows

##### Important Details

a. Security Flow:
- Root CA → Intermediate CAs → TLS CA
- Certificate issuance and renewal paths

b. Operational Flows:
- Channel creation and management
- Chaincode lifecycle (install → approve → commit)
- Orderer management (creation, addition, renewal)

c. Infrastructure Details:
- Multi-zone deployment support
- Ingress routing with SNI
- Persistent storage connections

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Interface"]
        CLI["Helm CLI"]
        Config["Configuration Files"]
        GUI["Future GUI (Planned)"]:::planned
    end

    subgraph Falcon["Falcon Components"]
        subgraph Charts["Helm Charts"]
            CA["Fabric CA"]
            Peer["Fabric Peer"]
            Orderer["Fabric Orderer"]
            Ops["Fabric Ops"]
            Tools["Fabric Tools"]
            FileStore["Filestore"]
        end
    end

    subgraph K8s["Kubernetes Infrastructure"]
        subgraph Deploy["Deployments & Jobs"]
            PeerDeploy["Peer StatefulSet"]
            OrdererDeploy["Orderer Deployment"]
        end

        subgraph Services["Services & Networking"]
            PeerSvc["Peer Services"]
            OrdererSvc["Orderer Services"]
        end

        subgraph Config["Configuration"]
            ConfigMaps["ConfigMaps"]
            Secrets["Secrets"]
        end

        subgraph RBAC["RBAC Components"]
            ServiceAccounts["Service Accounts"]
        end
    end

    subgraph Fabric["Hyperledger Fabric Network"]
        subgraph CAs["Certificate Authorities"]
            RootCA["Root CA"]
            TLSCA["TLS CA"]
            IntermediateCA["Intermediate CAs"]
        end

        subgraph Network["Network Components"]
            PeerOrgs["Peer Organizations"]
            OrderingOrgs["Ordering Organizations"]
            Channels["Channels"]
            Chaincode["Chaincode"]
        end
    end

    %% Relationships
    Client --> Charts
    Charts --> K8s
    K8s --> Fabric

    %% Click events
    click CA "https://github.com/npci/falcon/tree/main/helm-charts/fabric-ca"
    click Peer "https://github.com/npci/falcon/tree/main/helm-charts/fabric-peer"
    click Orderer "https://github.com/npci/falcon/tree/main/helm-charts/fabric-orderer"
    click Ops "https://github.com/npci/falcon/tree/main/helm-charts/fabric-ops"
    click Tools "https://github.com/npci/falcon/tree/main/helm-charts/fabric-tools"
    click FileStore "https://github.com/npci/falcon/tree/main/helm-charts/filestore"
    click PeerDeploy "https://github.com/npci/falcon/blob/main/helm-charts/fabric-peer/templates/statefulset.yaml"
    click OrdererDeploy "https://github.com/npci/falcon/blob/main/helm-charts/fabric-orderer/templates/deployment.yaml"
    click PeerSvc "https://github.com/npci/falcon/blob/main/helm-charts/fabric-peer/templates/service.yaml"
    click OrdererSvc "https://github.com/npci/falcon/blob/main/helm-charts/fabric-orderer/templates/service.yaml"
    click ServiceAccounts "https://github.com/npci/falcon/blob/main/helm-charts/fabric-ops/templates/rbac.yaml"
    click RootCA "https://github.com/npci/falcon/blob/main/examples/fabric-ca/root-ca.yaml"
    click TLSCA "https://github.com/npci/falcon/blob/main/examples/fabric-ca/tls-ca.yaml"

    %% Styles
    classDef planned stroke-dasharray: 5 5
    classDef helm fill:#3498db
    classDef k8s fill:#2ecc71
    classDef fabric fill:#e67e22
    classDef security fill:#9b59b6
    classDef infrastructure fill:#95a5a6

    class Charts,CA,Peer,Orderer,Ops,Tools,FileStore helm
    class Deploy,Services,Config,RBAC,PeerDeploy,OrdererDeploy,PeerSvc,OrdererSvc,ConfigMaps,Secrets,ServiceAccounts k8s
    class Network,PeerOrgs,OrderingOrgs,Channels,Chaincode fabric
    class CAs,RootCA,TLSCA,IntermediateCA security
    class Client infrastructure
```
