# ondc-official/ondc-protocol-specs architecture

> Architecture diagram of the GitHub repository ondc-official/ondc-protocol-specs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ondc-official/ondc-protocol-specs
- Repository: https://github.com/ondc-official/ondc-protocol-specs

## Overview

##### Main Components

a) Protocol Layer Components:
- Core Protocol Specifications
- Domain-Specific Specifications (Retail, Logistics)
- Authentication & Security Layer
- API Gateway/Interface

b) Network Participants:
- Buyer Apps
- Seller Apps
- Registry/Discovery Service
- Gateway

##### Key Relationships to Highlight

- How buyer apps communicate with seller apps through the protocol
- Authentication flow
- Demonstrate how the core protocol interfaces with domain-specific implementations
- Payment and settlement flows

##### Additional Elements

Annotations for:
- Version information (1.0.0-draft)
- Protocol compliance with Beckn Core Specification
- Error handling pathways
- Order lifecycle flows

##### Specific Implementation Details

- Authentication flow (based on "Auth Header Signing and Verification.md")
- Order management (based on "Order Cancellation, Returns and Replacements Process Flow.md")
- Payment flows (based on "Payment and Settlement Protocol.md")

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#2374AB,color:white
    classDef buyer fill:#57A773,color:white
    classDef seller fill:#FF8C42,color:white
    classDef security fill:#845EC2,color:white
    classDef api fill:#2C497F,color:white
    classDef docs fill:#4B4237,color:white

    %% Network Participants Layer
    subgraph Network
        BA["Buyer Apps"]:::buyer
        SA["Seller Apps"]:::seller
        Registry["Registry/Discovery Service"]:::core
        Gateway["Gateway"]:::core
    end

    %% Protocol Layer
    subgraph Protocol
        Core["Core Protocol"]:::core
        Retail["Retail Domain"]:::core
        Logistics["Logistics Domain"]:::core
    end

    %% Security Layer
    subgraph Security
        Auth["Authentication & Security"]:::security
        Payment["Payment Protocol"]:::security
        ErrorHandle["Error Handling"]:::security
    end

    %% Documentation Layer
    subgraph Documentation
        NetPolicy["Network Policies"]:::docs
        ImpGuide["Implementation Guide"]:::docs
        SellerGuide["Seller Guidelines"]:::docs
        StatusHarm["Status Harmonization"]:::docs
    end

    %% Relationships
    BA --> Gateway
    SA --> Gateway
    Gateway --> Registry
    Gateway --> Core
    Core --> Auth
    Core --> Payment
    Core --> ErrorHandle
    Core --> Retail
    Core --> Logistics

    %% Click Events
    click Core "https://github.com/ONDC-Official/ONDC-Protocol-Specs/blob/master/protocol-specifications/core/v0/api/core.yaml"
    click Retail "https://github.com/ONDC-Official/ONDC-Protocol-Specs/blob/master/protocol-specifications/core/v0/api/retail-hyperlocal.yaml"
    click Logistics "https://github.com/ONDC-Official/ONDC-Protocol-Specs/blob/master/protocol-specifications/core/v0/api/logistics.yaml"
    click Auth "https://github.com/ONDC-Official/ONDC-Protocol-Specs/blob/master/protocol-specifications/docs/draft/Auth Header Signing and Verification.md"
    click Payment "https://github.com/ONDC-Official/ONDC-Protocol-Specs/blob/master/protocol-specifications/docs/draft/Payment and Settlement Protocol.md"
    click ErrorHandle "https://github.com/ONDC-Official/ONDC-Protocol-Specs/blob/master/protocol-specifications/docs/draft/Error Codes.md"
    click NetPolicy "https://github.com/ONDC-Official/ONDC-Protocol-Specs/blob/master/protocol-specifications/docs/draft/ONDC Network Policy.md"
    click ImpGuide "https://github.com/ONDC-Official/ONDC-Protocol-Specs/blob/master/protocol-specifications/docs/draft/Tech Quickstart Guide.md"
    click SellerGuide "https://github.com/ONDC-Official/ONDC-Protocol-Specs/blob/master/protocol-specifications/docs/draft/Checklist for Sellers.md"
    click StatusHarm "https://github.com/ONDC-Official/ONDC-Protocol-Specs/blob/master/protocol-specifications/docs/draft/Harmonizing statuses in cascaded retail & logistics transaction.md"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Buyer Side"]:::buyer
        L3["Seller Side"]:::seller
        L4["Security Layer"]:::security
        L5["Documentation"]:::docs
    end
```
