# pohi-protocol/pohi architecture

> Architecture diagram of the GitHub repository pohi-protocol/pohi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pohi-protocol/pohi
- Repository: https://github.com/pohi-protocol/pohi

## Overview

#### Purpose and Package Topology
PoHI is a TypeScript/Solidity monorepo for binding proof-of-personhood (PoP) evidence to a specific software action—principally a repository commit—and independently verifying that approval. It provides reusable protocol libraries, CI integrations, optional EVM recording, and a live demonstration. Root package orchestration is in `package.json`; protocol behavior is specified in `SPEC.md` and `docs/architecture.md`.

#### Core Attestation Model
The chain-neutral core creates, hashes, and validates attestations containing the approved subject and human-verification evidence. It is the primary trust boundary: provider-specific evidence enters here, while consumers receive normalized types and validation results.
- `packages/core/src/attestation.ts`
- `packages/core/src/types.ts`
- `packages/core/src/index.ts`

The core binds proofs to repository/commit signals to resist replay. It intentionally has zero dependencies, enabling use in local tools and ephemeral CI runners.

#### Proof-of-Personhood Provider Layer
Provider adapters verify or normalize evidence from distinct identity systems behind a shared verification interface. World ID-style ZK proofs, Gitcoin Passport, BrightID, Civic, Proof of Humanity, Holonym, Idena, Coinbase attestations, and Humanity Protocol are integration boundaries with external identity networks.
- `packages/core/src/providers.ts`
- `packages/core/src/verification/index.ts`
- `packages/core/src/verification/gitcoin-passport.ts`

#### Developer and CI Entry Points
The CLI exposes attestation, verification, status, and configuration workflows for operators. Hosted-CI adapters invoke equivalent protocol checks inside GitHub Actions, GitLab pipelines, and Bitbucket Pipe containers, then report approval status to their respective source-control platform.
- `packages/cli/src/index.ts`
- `packages/action/src/index.ts`
- `packages/gitlab-ci/src/index.ts`
- `packages/bitbucket-pipe/src/index.ts`

GitHub-specific API interaction is isolated in `packages/action/src/github.ts`; Bitbucket uses its own Dockerized Pipe definition at `packages/bitbucket-pipe/pipe/Dockerfile`.

#### EVM and On-Chain Transparency
Optional EVM support separates chain encoding/hashing utilities, client-side contract access, and the on-chain registry. This layer can add immutable attestation recording but is not required for off-chain validation.
- `packages/evm/src/index.ts`
- `packages/sdk/src/client.ts`
- `packages/contracts/src/PoHIRegistry.sol`

The SDK targets World Chain configuration and ABI interaction through `packages/sdk/src/chains.ts` and `packages/sdk/src/abi.ts`. Solidity deployment and testing use Foundry, centered on `packages/contracts/foundry.toml` and `packages/contracts/script/Deploy.s.sol`.

#### Demo Application and Human Interaction
The deployable demo is a Next.js application, with browser UI for provider selection and approval plus server routes for verification/status. It is the main interactive reference implementation, deployed through Vercel configuration.
- `packages/demo/src/app/page.tsx`
- `packages/demo/src/app/api/verify/route.ts`
- `packages/demo/src/components/ProviderSelector.tsx`
- `vercel.json`

The UI/provider boundary is represented by provider-specific verification components, while server-side integrations such as GitHub/webhooks and rate limiting remain under `packages/demo/src/lib/`.

#### Runtime and Infrastructure
Node.js 18+ runs the workspace packages; the development container supplies Node.js 20, Foundry, and Playwright via `.devcontainer/Dockerfile`. Runtime targets include npm-distributed libraries/CLI, GitHub Actions, GitLab CI, Bitbucket Pipelines Docker containers, Next.js/Vercel, World ID and other PoP services, source-control APIs, and optionally World Chain/EVM RPC infrastructure. CI and release-facing validation are defined in `.github/workflows/ci.yml`.

Main entry points: [`packages/core/src/index.ts`](https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/index.ts) (Core public API), [`packages/core/src/providers.ts`](https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/providers.ts) (Provider verification adapters), [`packages/core/src/attestation.ts`](https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/attestation.ts) (Attestation hashing & validation), [`packages/action/src/index.ts`](https://github.com/pohi-protocol/pohi/blob/main/packages/action/src/index.ts) (GitHub Action)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Protocol core"]
  node_core_types["Normalized attestation types<br/>TypeScript module<br/>[types.ts]"]
  node_attestation["Attestation hashing &amp; validation<br/>TypeScript module<br/>[attestation.ts]"]
  node_provider_layer["Provider verification adapters<br/>TypeScript module<br/>[providers.ts]"]
  node_verification["Verification implementations<br/>TypeScript module<br/>[index.ts]"]
  node_core_api["Core public API<br/>package entry point<br/>[index.ts]"]
end

subgraph group_integrations["Developer integrations"]
  node_cli["Operator CLI<br/>Node.js CLI<br/>[index.ts]"]
  node_github_action["GitHub Action<br/>CI adapter<br/>[index.ts]"]
  node_gitlab_ci["GitLab CI adapter<br/>[index.ts]"]
  node_bitbucket_pipe["Bitbucket Pipe<br/>Docker CI adapter<br/>[index.ts]"]
end

subgraph group_evm["Optional EVM"]
  node_evm_utils["EVM encoding &amp; hashing<br/>package entry point<br/>[index.ts]"]
  node_sdk_client["World Chain SDK client<br/>TypeScript client<br/>[client.ts]"]
  node_registry[("PoHI Registry<br/>Solidity contract<br/>[PoHIRegistry.sol]")]
end

subgraph group_demo["Demo application"]
  node_demo_ui["Demo approval UI<br/>Next.js page<br/>[page.tsx]"]
  node_provider_selector["Provider selector<br/>React component"]
  node_demo_verify["Demo verification API<br/>Next.js route<br/>[route.ts]"]
  node_vercel{{"Vercel deployment<br/>hosting platform<br/>[vercel.json]"}}
end

node_pop_networks{{"PoP identity networks<br/>external services"}}
node_source_control{{"Source-control platforms<br/>external APIs"}}
node_world_chain{{"World Chain / EVM RPC<br/>blockchain network"}}

node_pop_networks -->|"proof evidence"| node_provider_layer
node_provider_layer -->|"delegates checks"| node_verification
node_verification -->|"validated evidence"| node_attestation
node_core_types -->|"attestation model"| node_attestation
node_attestation -->|"exports protocol operations"| node_core_api
node_provider_layer -->|"exports provider interface"| node_core_api
node_cli -->|"attest and verify"| node_core_api
node_github_action -->|"CI protocol checks"| node_core_api
node_gitlab_ci -->|"CI protocol checks"| node_core_api
node_bitbucket_pipe -->|"containerized checks"| node_core_api
node_github_action -->|"commit status"| node_source_control
node_gitlab_ci -->|"pipeline status"| node_source_control
node_bitbucket_pipe -->|"pipe status"| node_source_control
node_core_api -.->|"optional recording payload"| node_evm_utils
node_evm_utils -->|"encoded attestation"| node_sdk_client
node_sdk_client -->|"contract calls"| node_registry
node_registry -->|"deployed on"| node_world_chain
node_demo_ui -->|"renders"| node_provider_selector
node_provider_selector -->|"submits proof"| node_demo_verify
node_demo_verify -->|"verifies attestation"| node_core_api
node_vercel -->|"hosts"| node_demo_ui

click node_core_types "https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/types.ts"
click node_attestation "https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/attestation.ts"
click node_provider_layer "https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/providers.ts"
click node_verification "https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/verification/index.ts"
click node_core_api "https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/index.ts"
click node_cli "https://github.com/pohi-protocol/pohi/blob/main/packages/cli/src/index.ts"
click node_github_action "https://github.com/pohi-protocol/pohi/blob/main/packages/action/src/index.ts"
click node_gitlab_ci "https://github.com/pohi-protocol/pohi/blob/main/packages/gitlab-ci/src/index.ts"
click node_bitbucket_pipe "https://github.com/pohi-protocol/pohi/blob/main/packages/bitbucket-pipe/src/index.ts"
click node_evm_utils "https://github.com/pohi-protocol/pohi/blob/main/packages/evm/src/index.ts"
click node_sdk_client "https://github.com/pohi-protocol/pohi/blob/main/packages/sdk/src/client.ts"
click node_registry "https://github.com/pohi-protocol/pohi/blob/main/packages/contracts/src/PoHIRegistry.sol"
click node_demo_ui "https://github.com/pohi-protocol/pohi/blob/main/packages/demo/src/app/page.tsx"
click node_provider_selector "https://github.com/pohi-protocol/pohi/blob/main/packages/demo/src/components/ProviderSelector.tsx"
click node_demo_verify "https://github.com/pohi-protocol/pohi/blob/main/packages/demo/src/app/api/verify/route.ts"
click node_vercel "https://github.com/pohi-protocol/pohi/blob/main/vercel.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_core_types,node_attestation,node_provider_layer,node_verification,node_core_api toneBlue
class node_cli,node_github_action,node_gitlab_ci,node_bitbucket_pipe toneAmber
class node_evm_utils,node_sdk_client,node_registry toneMint
class node_demo_ui,node_provider_selector,node_demo_verify,node_vercel toneRose
class node_pop_networks,node_source_control,node_world_chain toneNeutral
```

## Components

### Protocol core

Chain-neutral attestation trust boundary.

- [Normalized attestation types](https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/types.ts): TypeScript module · `packages/core/src/types.ts`
- [Attestation hashing & validation](https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/attestation.ts): TypeScript module · Binds proof evidence to repository and commit signals. · `packages/core/src/attestation.ts`
- [Provider verification adapters](https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/providers.ts): TypeScript module · Shared interface for provider-specific evidence. · `packages/core/src/providers.ts`
- [Verification implementations](https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/verification/index.ts): TypeScript module · `packages/core/src/verification/index.ts`
- [Core public API](https://github.com/pohi-protocol/pohi/blob/main/packages/core/src/index.ts): package entry point · Zero-dependency protocol library. · `packages/core/src/index.ts`

### Developer integrations

- [Operator CLI](https://github.com/pohi-protocol/pohi/blob/main/packages/cli/src/index.ts): Node.js CLI · `packages/cli/src/index.ts`
- [GitHub Action](https://github.com/pohi-protocol/pohi/blob/main/packages/action/src/index.ts): CI adapter · `packages/action/src/index.ts`
- [GitLab CI adapter](https://github.com/pohi-protocol/pohi/blob/main/packages/gitlab-ci/src/index.ts): CI adapter · `packages/gitlab-ci/src/index.ts`
- [Bitbucket Pipe](https://github.com/pohi-protocol/pohi/blob/main/packages/bitbucket-pipe/src/index.ts): Docker CI adapter · `packages/bitbucket-pipe/src/index.ts`

### Optional EVM

- [EVM encoding & hashing](https://github.com/pohi-protocol/pohi/blob/main/packages/evm/src/index.ts): package entry point · `packages/evm/src/index.ts`
- [World Chain SDK client](https://github.com/pohi-protocol/pohi/blob/main/packages/sdk/src/client.ts): TypeScript client · Uses configured chain and ABI to access the registry. · `packages/sdk/src/client.ts`
- [PoHI Registry](https://github.com/pohi-protocol/pohi/blob/main/packages/contracts/src/PoHIRegistry.sol): Solidity contract · Immutable on-chain attestation records. · `packages/contracts/src/PoHIRegistry.sol`

### Demo application

- [Demo approval UI](https://github.com/pohi-protocol/pohi/blob/main/packages/demo/src/app/page.tsx): Next.js page · Interactive provider selection and approval. · `packages/demo/src/app/page.tsx`
- [Provider selector](https://github.com/pohi-protocol/pohi/blob/main/packages/demo/src/components/ProviderSelector.tsx): React component · `packages/demo/src/components/ProviderSelector.tsx`
- [Demo verification API](https://github.com/pohi-protocol/pohi/blob/main/packages/demo/src/app/api/verify/route.ts): Next.js route · Server endpoint for verification and status. · `packages/demo/src/app/api/verify/route.ts`
- [Vercel deployment](https://github.com/pohi-protocol/pohi/blob/main/vercel.json): hosting platform · `vercel.json`

### Other components

- **PoP identity networks**: external services · World ID, Passport, BrightID, Civic, and other proof providers.
- **Source-control platforms**: external APIs · GitHub, GitLab, and Bitbucket commit and status APIs.
- **World Chain / EVM RPC**: blockchain network

## Connections

- PoP identity networks → Provider verification adapters: proof evidence
- Provider verification adapters → Verification implementations: delegates checks
- Verification implementations → Attestation hashing & validation: validated evidence
- Normalized attestation types → Attestation hashing & validation: attestation model
- Attestation hashing & validation → Core public API: exports protocol operations
- Provider verification adapters → Core public API: exports provider interface
- Operator CLI → Core public API: attest and verify
- GitHub Action → Core public API: CI protocol checks
- GitLab CI adapter → Core public API: CI protocol checks
- Bitbucket Pipe → Core public API: containerized checks
- GitHub Action → Source-control platforms: commit status
- GitLab CI adapter → Source-control platforms: pipeline status
- Bitbucket Pipe → Source-control platforms: pipe status
- Core public API → EVM encoding & hashing: optional recording payload
- EVM encoding & hashing → World Chain SDK client: encoded attestation
- World Chain SDK client → PoHI Registry: contract calls
- PoHI Registry → World Chain / EVM RPC: deployed on
- Demo approval UI → Provider selector: renders
- Provider selector → Demo verification API: submits proof
- Demo verification API → Core public API: verifies attestation
- Vercel deployment → Demo approval UI: hosts
