# kashyapanand21/arguschain architecture

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

- Interactive diagram: https://gitdiagram.com/kashyapanand21/arguschain
- Repository: https://github.com/kashyapanand21/arguschain

## Overview

ArgusChain manages classified engineering files through wallet-based identity, contract-enforced permissions, encrypted file storage, and auditable decisions. The principal workflow is sign-in, asset discovery and permission resolution, then an authorized content read or export; classified grants can enter an approval workflow. The browser signs state changes, while the backend authenticates, evaluates requests, serves encrypted files, and records decisions. Contract responsibilities and several product capabilities are documented in the README; backend and frontend wiring beyond the sampled files is shown only where supported.

Main entry points: [`backend/src/index.ts`](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/index.ts) (HTTP API), [`backend/src/chain.ts`](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/chain.ts) (Chain Client), [`backend/src/controllers/assets.ts`](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/controllers/assets.ts) (Asset Service), [`frontend/src/lib/session.tsx`](https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/lib/session.tsx) (Wallet Session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser Console"]
  node_app["App Router<br/>[main.tsx]"]
  node_session["Wallet Session<br/>[session.tsx]"]
  node_explorer["File Explorer<br/>[Explorer.tsx]"]
  node_assetview["Asset Detail<br/>[AssetDetail.tsx]"]
  node_grantview["Proposals"]
  node_adminview["Administration<br/>[Admin.tsx]"]
end

subgraph group_service["Backend Services"]
  node_api["HTTP API<br/>[index.ts]"]
  node_auth["SIWE Authentication<br/>[auth.ts]"]
  node_guard["JWT Guard<br/>[auth.ts]"]
  node_assets["Asset Service<br/>[assets.ts]"]
  node_pdp["Permission Resolver<br/>[pdp.ts]"]
  node_risk["Risk Scoring<br/>[risk.ts]"]
  node_audit["Decision Audit<br/>[audit.ts]"]
  node_chainclient["Chain Client<br/>[chain.ts]"]
  node_cipher["File Encryption<br/>[storage.ts]"]
end

subgraph group_chain["On-chain Authority"]
  node_identity["Identity Credential<br/>[ArgusIdentity.sol]"]
  node_did["DID Registry"]
  node_roles["Role Registry<br/>[RoleRegistry.sol]"]
  node_assetnft["Asset Registry<br/>[AssetNFT.sol]"]
  node_access["Access Rules<br/>[AccessRegistry.sol]"]
  node_workflow["Grant Workflow<br/>[GrantWorkflow.sol]"]
  node_anchor["Audit Anchor<br/>[AuditAnchor.sol]"]
end

subgraph group_data["Stored Data"]
  node_db[("Decision Database<br/>[schema.prisma]")]
  node_files[("Encrypted Files<br/>[storage.ts]")]
end

node_person(("User"))
node_wallet(("Wallet"))

node_person -->|"uses"| node_app
node_app -->|"provides session"| node_session
node_session -->|"requests signature"| node_wallet
node_session -->|"requests nonce, verifies"| node_api
node_explorer -->|"lists assets"| node_api
node_assetview -->|"requests details, content"| node_api
node_grantview -->|"requests proposals"| node_api
node_adminview -->|"requests administration"| node_api
node_wallet -->|"signs state changes"| node_identity
node_api -->|"dispatches auth"| node_auth
node_api -->|"dispatches assets"| node_assets
node_api -->|"dispatches audit"| node_audit
node_api -->|"guards protected routes"| node_guard
node_auth -->|"reads identity, roles"| node_chainclient
node_assets -->|"checks permissions"| node_pdp
node_assets -->|"reads asset state"| node_chainclient
node_assets -->|"stores, decrypts files"| node_cipher
node_assets -->|"scores requests"| node_risk
node_assets -->|"records decisions"| node_audit
node_audit -->|"reads, writes log"| node_db
node_cipher -->|"writes, reads ciphertext"| node_files
node_chainclient -->|"reads"| node_identity
node_chainclient -->|"reads"| node_did
node_chainclient -->|"reads"| node_roles
node_chainclient -->|"reads"| node_assetnft
node_chainclient -->|"resolves access"| node_access
node_wallet -->|"submits proposals"| node_workflow
node_wallet -->|"mints assets"| node_assetnft
node_anchor -.->|"anchors roots"| node_db

click node_app "https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/main.tsx"
click node_session "https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/lib/session.tsx"
click node_explorer "https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/pages/Explorer.tsx"
click node_assetview "https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/pages/AssetDetail.tsx"
click node_grantview "https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/pages/RiskAndProposals.tsx"
click node_adminview "https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/pages/Admin.tsx"
click node_api "https://github.com/kashyapanand21/arguschain/blob/main/backend/src/index.ts"
click node_auth "https://github.com/kashyapanand21/arguschain/blob/main/backend/src/controllers/auth.ts"
click node_guard "https://github.com/kashyapanand21/arguschain/blob/main/backend/src/middleware/auth.ts"
click node_assets "https://github.com/kashyapanand21/arguschain/blob/main/backend/src/controllers/assets.ts"
click node_pdp "https://github.com/kashyapanand21/arguschain/blob/main/backend/src/pdp.ts"
click node_risk "https://github.com/kashyapanand21/arguschain/blob/main/backend/src/risk.ts"
click node_audit "https://github.com/kashyapanand21/arguschain/blob/main/backend/src/audit.ts"
click node_chainclient "https://github.com/kashyapanand21/arguschain/blob/main/backend/src/chain.ts"
click node_cipher "https://github.com/kashyapanand21/arguschain/blob/main/backend/src/storage.ts"
click node_identity "https://github.com/kashyapanand21/arguschain/blob/main/contracts/ArgusIdentity.sol"
click node_did "https://github.com/kashyapanand21/arguschain/blob/main/contracts/identity/EthereumDIDRegistry.sol"
click node_roles "https://github.com/kashyapanand21/arguschain/blob/main/contracts/RoleRegistry.sol"
click node_assetnft "https://github.com/kashyapanand21/arguschain/blob/main/contracts/AssetNFT.sol"
click node_access "https://github.com/kashyapanand21/arguschain/blob/main/contracts/AccessRegistry.sol"
click node_workflow "https://github.com/kashyapanand21/arguschain/blob/main/contracts/GrantWorkflow.sol"
click node_anchor "https://github.com/kashyapanand21/arguschain/blob/main/contracts/AuditAnchor.sol"
click node_db "https://github.com/kashyapanand21/arguschain/blob/main/backend/prisma/schema.prisma"
click node_files "https://github.com/kashyapanand21/arguschain/blob/main/backend/src/storage.ts"

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_app,node_session,node_explorer,node_assetview,node_grantview,node_adminview,node_person toneBlue
class node_api,node_auth,node_guard,node_assets,node_pdp,node_risk,node_audit,node_chainclient,node_cipher toneAmber
class node_identity,node_did,node_roles,node_assetnft,node_access,node_workflow,node_anchor toneMint
class node_db,node_files toneRose
class node_wallet toneIndigo
```

## Components

### Browser Console

- [App Router](https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Wallet Session](https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/lib/session.tsx): `frontend/src/lib/session.tsx`
- [File Explorer](https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/pages/Explorer.tsx): `frontend/src/pages/Explorer.tsx`
- [Asset Detail](https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/pages/AssetDetail.tsx): `frontend/src/pages/AssetDetail.tsx`
- [Proposals](https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/pages/RiskAndProposals.tsx): `frontend/src/pages/RiskAndProposals.tsx`
- [Administration](https://github.com/kashyapanand21/arguschain/blob/main/frontend/src/pages/Admin.tsx): `frontend/src/pages/Admin.tsx`

### Backend Services

- [HTTP API](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [SIWE Authentication](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/controllers/auth.ts): `backend/src/controllers/auth.ts`
- [JWT Guard](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/middleware/auth.ts): `backend/src/middleware/auth.ts`
- [Asset Service](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/controllers/assets.ts): `backend/src/controllers/assets.ts`
- [Permission Resolver](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/pdp.ts): `backend/src/pdp.ts`
- [Risk Scoring](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/risk.ts): `backend/src/risk.ts`
- [Decision Audit](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/audit.ts): `backend/src/audit.ts`
- [Chain Client](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/chain.ts): `backend/src/chain.ts`
- [File Encryption](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/storage.ts): `backend/src/storage.ts`

### On-chain Authority

- [Identity Credential](https://github.com/kashyapanand21/arguschain/blob/main/contracts/ArgusIdentity.sol): `contracts/ArgusIdentity.sol`
- [DID Registry](https://github.com/kashyapanand21/arguschain/blob/main/contracts/identity/EthereumDIDRegistry.sol): `contracts/identity/EthereumDIDRegistry.sol`
- [Role Registry](https://github.com/kashyapanand21/arguschain/blob/main/contracts/RoleRegistry.sol): `contracts/RoleRegistry.sol`
- [Asset Registry](https://github.com/kashyapanand21/arguschain/blob/main/contracts/AssetNFT.sol): `contracts/AssetNFT.sol`
- [Access Rules](https://github.com/kashyapanand21/arguschain/blob/main/contracts/AccessRegistry.sol): `contracts/AccessRegistry.sol`
- [Grant Workflow](https://github.com/kashyapanand21/arguschain/blob/main/contracts/GrantWorkflow.sol): `contracts/GrantWorkflow.sol`
- [Audit Anchor](https://github.com/kashyapanand21/arguschain/blob/main/contracts/AuditAnchor.sol): `contracts/AuditAnchor.sol`

### Stored Data

- [Decision Database](https://github.com/kashyapanand21/arguschain/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`
- [Encrypted Files](https://github.com/kashyapanand21/arguschain/blob/main/backend/src/storage.ts): `backend/src/storage.ts`

### Other components

- **User**
- **Wallet**

## Connections

- User → App Router: uses
- App Router → Wallet Session: provides session
- Wallet Session → Wallet: requests signature
- Wallet Session → HTTP API: requests nonce, verifies
- File Explorer → HTTP API: lists assets
- Asset Detail → HTTP API: requests details, content
- Proposals → HTTP API: requests proposals
- Administration → HTTP API: requests administration
- Wallet → Identity Credential: signs state changes
- HTTP API → SIWE Authentication: dispatches auth
- HTTP API → Asset Service: dispatches assets
- HTTP API → Decision Audit: dispatches audit
- HTTP API → JWT Guard: guards protected routes
- SIWE Authentication → Chain Client: reads identity, roles
- Asset Service → Permission Resolver: checks permissions
- Asset Service → Chain Client: reads asset state
- Asset Service → File Encryption: stores, decrypts files
- Asset Service → Risk Scoring: scores requests
- Asset Service → Decision Audit: records decisions
- Decision Audit → Decision Database: reads, writes log
- File Encryption → Encrypted Files: writes, reads ciphertext
- Chain Client → Identity Credential: reads
- Chain Client → DID Registry: reads
- Chain Client → Role Registry: reads
- Chain Client → Asset Registry: reads
- Chain Client → Access Rules: resolves access
- Wallet → Grant Workflow: submits proposals
- Wallet → Asset Registry: mints assets
- Audit Anchor → Decision Database: anchors roots
