# supremainc/g-sdk architecture

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

- Interactive diagram: https://gitdiagram.com/supremainc/g-sdk
- Repository: https://github.com/supremainc/g-sdk

## Overview

##### Project type and purpose
- G-SDK is an open-source, cross-platform gRPC-based SDK for communicating with BioStar devices.
- It provides a single set of protobuf definitions and generated client libraries in C#, Go, Java, Node.js, and Python, plus usage examples and documentation.

##### High-level component breakdown
- External BioStar Server/Devices
– The actual BioStar hardware or server exposing gRPC endpoints.
- Protobuf Definition Layer
– `*.proto` files under each `client/<lang>/biostar/proto` and `client/java/src/main/proto`.
– Defines messages and services (access, auth, device, event, etc.).
- Code-Generation Pipeline
– Protoc + language-specific plugins (`protoc-gen-go`, `grpc-java`, `grpc-node`, `grpc-python`, etc.).
– Generates stubs under `client/<lang>/biostar/service` (e.g., `*.pb.go`, `*_grpc_pb.js`, `*_pb2.py`, etc.).
- Client SDK Modules
– Language folders (`client/csharp`, `client/go`, `client/java`, `client/node`, `client/python`).
– Each contains generated service code plus packaging/build files (Gradle, .NET csproj, package.json).
- Example Applications
– Under each language folder in `.../example`.
– Demonstrate CRUD calls, connect patterns, CLI menus.
- Documentation Site
– Jekyll-based site under `docs/` with API reference, tutorials, release notes.

##### Relationships and data flow
A. Protobuf definitions → Code-generation → Language SDK stubs
B. SDK stubs + client application code → gRPC calls → BioStar Server
C. Documentation is generated from markdown in `docs/` but separate from runtime.

##### Key architectural patterns
- Client–Server (gRPC)
- Code-generation pipeline for multi-language support
- Modular examples to validate each service
- Static site generator (Jekyll) for docs

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Protobuf Definition Layer"
        protoCS["C# Protos"]:::definition
        protoGo["Go Protos"]:::definition
        protoJava["Java Protos"]:::definition
        protoNode["Node.js Protos"]:::definition
        protoPy["Python Protos"]:::definition
    end

    codeGen["Code-Generation Pipeline"]:::process

    subgraph "Generated SDK Stubs"
        stubGo["Go Stubs"]:::generated
        stubNode["Node.js Stubs"]:::generated
        stubPy["Python Stubs"]:::generated
    end

    subgraph "Client SDK Modules"
        sdkCS["C# SDK Module"]:::sdk
        sdkGo["Go SDK Module"]:::sdk
        sdkJava["Java SDK Module"]:::sdk
        sdkNode["Node.js SDK Module"]:::sdk
        sdkPy["Python SDK Module"]:::sdk
    end

    subgraph "Example Applications"
        exCS["C# Examples"]:::example
        exGo["Go Examples"]:::example
        exJava["Java Examples"]:::example
        exNode["Node.js Examples"]:::example
        exPy["Python Examples"]:::example
    end

    srv["BioStar gRPC Server/Devices"]:::external
    docs["Documentation Site"]:::docs

    protoCS --> codeGen
    protoGo --> codeGen
    protoJava --> codeGen
    protoNode --> codeGen
    protoPy --> codeGen

    codeGen --> stubGo
    codeGen --> stubNode
    codeGen --> stubPy

    stubGo --> sdkGo
    stubNode --> sdkNode
    stubPy --> sdkPy

    protoCS --> sdkCS
    protoJava --> sdkJava

    sdkCS --> srv
    sdkGo --> srv
    sdkJava --> srv
    sdkNode --> srv
    sdkPy --> srv

    exCS --> srv
    exGo --> srv
    exJava --> srv
    exNode --> srv
    exPy --> srv

    docs -->|"developers/readers"| sdkCS
    docs --> sdkGo
    docs --> sdkJava
    docs --> sdkNode
    docs --> sdkPy

    click protoCS "https://github.com/supremainc/g-sdk/tree/master/client/csharp/biostar/proto"
    click protoGo "https://github.com/supremainc/g-sdk/tree/master/client/go/src/biostar/proto"
    click protoJava "https://github.com/supremainc/g-sdk/tree/master/client/java/src/main/proto"
    click protoNode "https://github.com/supremainc/g-sdk/tree/master/client/node/biostar/proto"
    click protoPy "https://github.com/supremainc/g-sdk/tree/master/client/python/biostar/proto"
    click stubGo "https://github.com/supremainc/g-sdk/tree/master/client/go/src/biostar/service"
    click stubNode "https://github.com/supremainc/g-sdk/tree/master/client/node/biostar/service"
    click stubPy "https://github.com/supremainc/g-sdk/tree/master/client/python/biostar/service"
    click sdkCS "https://github.com/supremainc/g-sdk/tree/master/client/csharp"
    click sdkGo "https://github.com/supremainc/g-sdk/tree/master/client/go"
    click sdkJava "https://github.com/supremainc/g-sdk/tree/master/client/java"
    click sdkNode "https://github.com/supremainc/g-sdk/tree/master/client/node"
    click sdkPy "https://github.com/supremainc/g-sdk/tree/master/client/python"
    click exCS "https://github.com/supremainc/g-sdk/tree/master/client/csharp/example"
    click exGo "https://github.com/supremainc/g-sdk/tree/master/client/go/src/example"
    click exJava "https://github.com/supremainc/g-sdk/tree/master/client/java/src/main/java/com/supremainc/sdk/example"
    click exNode "https://github.com/supremainc/g-sdk/tree/master/client/node/example"
    click exPy "https://github.com/supremainc/g-sdk/tree/master/client/python/example"
    click docs "https://github.com/supremainc/g-sdk/tree/master/docs"

    classDef definition fill:#D0E8FF,stroke:#326295,color:#000
    classDef process fill:#E1BEE7,stroke:#8E24AA,color:#000
    classDef generated fill:#DFFFD0,stroke:#558B2F,color:#000
    classDef sdk fill:#C8E6C9,stroke:#2E7D32,color:#000
    classDef example fill:#FFE0B2,stroke:#EF6C00,color:#000
    classDef external fill:#E0E0E0,stroke:#757575,color:#000
    classDef docs fill:#FFF9C4,stroke:#F9A825,color:#000
```
