How prabhavalabs/opentreasury works
OpenTreasury is a public-finance transparency and treasury-management platform. Government finance exports are mapped by connectors and submitted to the Core API, which validates treasury lifecycle rules and persists operational data in PostgreSQL; the ledger gateway anchors public-safe proofs to a traceability backend. Web and mobile applications, public APIs, independent verification, and MCP tools expose the resulting information. The graph includes README-documented capabilities whose implementation was not sampled; those broader links are marked dashed where source-level wiring was not shown.
Main entry points: router.go Core API · anchor.go Ledger gateway · main.go Independent verifier · deliver.go File connector
Components 20
Ingestion and treasury
- File connector
services/connectors/generic-file/internal/connector/deliver.go - Treasury rules
services/core-api/internal/treasury - Journal and accounts
services/core-api/internal/treasury - Commitments
services/core-api/internal/treasury/commitment.go - Reconciliation
services/core-api/internal/treasury - Insights
services/core-api/internal/treasury/insights.go
API and persistence
- Core API
services/core-api/internal/httpapi/router.go - Identity and policy
services/core-api/internal/authz/authz.go - PostgreSQL
Public traceability
- Ledger gateway
services/ledger-gateway/internal/anchor/anchor.go - Merkle proofs
services/ledger-gateway/internal/merkle/merkle.go - Fabric chaincode
chaincode/treasury/internal/contract/anchor_contract.go - Independent verifier
services/ledger-gateway/cmd/verify/main.go
User applications
- Web dashboard
apps/web/src/routes/index.tsx - Mobile app
apps/mobile/src/app/(tabs)/explorer.tsx - MCP server
services/mcp-server/cmd/mcp-server/main.go
External integrations
- Hyperledger Fabric
- OIDC identity provider
Other components
- Government systems
- Auditors and public
Connections 23
- Government systems → File connector: provides exports
README.md - File connector → Core API: submits staging data
- Core API → Identity and policy: checks access
- Core API → Treasury rules: validates lifecycle
README.md - Core API → PostgreSQL: persists records
- Core API → Journal and accounts: serves journal data
services/core-api/internal/httpapi/router.go - Core API → Commitments: serves commitments
README.md - Core API → Reconciliation: serves reconciliation
README.md - Core API → Insights: serves insights
services/core-api/internal/httpapi/router.go - Ledger gateway → Merkle proofs: builds proofs
services/ledger-gateway/internal/anchor/anchor.go - Ledger gateway → PostgreSQL: reads and records anchors
README.md - Ledger gateway → Fabric chaincode: commits roots
- Fabric chaincode → Hyperledger Fabric: records anchors
README.md - Web dashboard → Core API: uses APIs
README.md - Mobile app → Core API: uses APIs
README.md - Independent verifier → Core API: fetches proofs
services/ledger-gateway/cmd/verify/main.go - Independent verifier → Merkle proofs: checks inclusion
services/ledger-gateway/cmd/verify/main.go - MCP server → Core API: reads public tier
services/mcp-server/cmd/mcp-server/main.go - OIDC identity provider → Identity and policy: provides identity
README.md - Auditors and public → Web dashboard: reviews dashboards
README.md - Auditors and public → Mobile app: checks entries
README.md - Auditors and public → Independent verifier: independently verifies
README.md - Auditors and public → MCP server: queries public data
README.md