# harishmelwani/privazy architecture

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

- Interactive diagram: https://gitdiagram.com/harishmelwani/privazy
- Repository: https://github.com/harishmelwani/privazy

## Overview

PrivAZy is a browser-based private messaging application on Aztec. Users connect or restore a wallet, sync an inbox, select a peer, and send private messages; long messages are chunked and delivered through a persistent retrying queue. The frontend also supports sponsored fees and wallet backup/restore. The contract and test package are visible in the tree but their implementation was not sampled; their interaction with the frontend is therefore documented only where source excerpts show it. External network internals are not represented.

Main entry points: [`privazy_frontend/src/privazy.ts`](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/privazy.ts) (Message operations), [`privazy_frontend/src/App.tsx`](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/App.tsx) (Chat interface), [`privazy_frontend/src/wallet.ts`](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/wallet.ts) (Wallet lifecycle), [`privazy_frontend/src/fees.ts`](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/fees.ts) (Sponsored fees)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Messaging app"]
  node_app_ui["Chat interface<br/>[App.tsx]"]
end

subgraph group_wallet["Wallet and fees"]
  node_wallet_ops["Wallet lifecycle<br/>[wallet.ts]"]
  node_fee_setup["Sponsored fees<br/>[fees.ts]"]
  node_config["Network config<br/>[config.ts]"]
  node_fee_artifact["Sponsored fee artifact<br/>[SponsoredFPC.json]"]
end

subgraph group_chain["Aztec messaging"]
  node_messaging["Message operations<br/>[privazy.ts]"]
end

subgraph group_contract["On-chain contracts"]
  node_contract_src["PrivAZy contract<br/>[main.nr]"]
  node_contract_artifact["Contract artifact<br/>[PrivAZy.ts]"]
  node_test_contract["Contract test package<br/>[lib.nr]"]
end

subgraph group_runtime["Browser runtime"]
  node_entry["React entry<br/>[main.tsx]"]
  node_polyfills["Browser polyfills<br/>[polyfills.ts]"]
end

node_user(("User"))
node_node_service["Aztec node"]
node_browser_store[("Browser persistence")]
node_aztec_network["Aztec network"]

node_user -->|"opens app"| node_entry
node_entry -->|"loads"| node_polyfills
node_entry -->|"renders"| node_app_ui
node_user -.->|"uses"| node_app_ui
node_app_ui -->|"creates or restores"| node_wallet_ops
node_app_ui -->|"registers fees"| node_fee_setup
node_app_ui -->|"syncs and sends"| node_messaging
node_wallet_ops -->|"gets node URL"| node_config
node_messaging -->|"gets node URL"| node_config
node_app_ui -->|"reads contract address"| node_config
node_wallet_ops -->|"persists wallet and PXE"| node_browser_store
node_wallet_ops -->|"creates node client"| node_node_service
node_messaging -->|"queries contract"| node_node_service
node_node_service -.->|"connects"| node_aztec_network
node_messaging -->|"creates payment method"| node_fee_setup
node_fee_setup -->|"loads artifact"| node_fee_artifact
node_fee_setup -.->|"registers contracts"| node_wallet_ops
node_messaging -->|"uses contract bindings"| node_contract_artifact
node_contract_artifact -.->|"represents"| node_contract_src
node_test_contract -.->|"tests"| node_contract_src
node_messaging -.->|"simulates and sends"| node_aztec_network

click node_entry "https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/main.tsx"
click node_polyfills "https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/polyfills.ts"
click node_app_ui "https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/App.tsx"
click node_wallet_ops "https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/wallet.ts"
click node_fee_setup "https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/fees.ts"
click node_config "https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/config.ts"
click node_messaging "https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/privazy.ts"
click node_contract_src "https://github.com/harishmelwani/privazy/blob/main/privazy_contract/src/main.nr"
click node_contract_artifact "https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/generated/PrivAZy.ts"
click node_fee_artifact "https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/generated/SponsoredFPC.json"
click node_test_contract "https://github.com/harishmelwani/privazy/blob/main/privazy_test/src/lib.nr"

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_ui,node_user toneBlue
class node_wallet_ops,node_fee_setup,node_config,node_fee_artifact,node_browser_store toneAmber
class node_messaging toneMint
class node_contract_src,node_contract_artifact,node_test_contract toneRose
class node_entry,node_polyfills,node_node_service,node_aztec_network toneIndigo
```

## Components

### Messaging app

- [Chat interface](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/App.tsx): `privazy_frontend/src/App.tsx`

### Wallet and fees

- [Wallet lifecycle](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/wallet.ts): `privazy_frontend/src/wallet.ts`
- [Sponsored fees](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/fees.ts): `privazy_frontend/src/fees.ts`
- [Network config](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/config.ts): `privazy_frontend/src/config.ts`
- [Sponsored fee artifact](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/generated/SponsoredFPC.json): `privazy_frontend/src/generated/SponsoredFPC.json`

### Aztec messaging

- [Message operations](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/privazy.ts): `privazy_frontend/src/privazy.ts`

### On-chain contracts

- [PrivAZy contract](https://github.com/harishmelwani/privazy/blob/main/privazy_contract/src/main.nr): `privazy_contract/src/main.nr`
- [Contract artifact](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/generated/PrivAZy.ts): `privazy_frontend/src/generated/PrivAZy.ts`
- [Contract test package](https://github.com/harishmelwani/privazy/blob/main/privazy_test/src/lib.nr): `privazy_test/src/lib.nr`

### Browser runtime

- [React entry](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/main.tsx): `privazy_frontend/src/main.tsx`
- [Browser polyfills](https://github.com/harishmelwani/privazy/blob/main/privazy_frontend/src/polyfills.ts): `privazy_frontend/src/polyfills.ts`

### Other components

- **User**
- **Aztec node**
- **Browser persistence**
- **Aztec network**

## Connections

- User → React entry: opens app (evidence: `privazy_frontend/src/main.tsx`)
- React entry → Browser polyfills: loads (evidence: `privazy_frontend/src/main.tsx`)
- React entry → Chat interface: renders (evidence: `privazy_frontend/src/main.tsx`)
- User → Chat interface: uses
- Chat interface → Wallet lifecycle: creates or restores (evidence: `privazy_frontend/src/App.tsx`)
- Chat interface → Sponsored fees: registers fees (evidence: `privazy_frontend/src/App.tsx`)
- Chat interface → Message operations: syncs and sends (evidence: `privazy_frontend/src/App.tsx`)
- Wallet lifecycle → Network config: gets node URL (evidence: `privazy_frontend/src/wallet.ts`)
- Message operations → Network config: gets node URL (evidence: `privazy_frontend/src/privazy.ts`)
- Chat interface → Network config: reads contract address (evidence: `privazy_frontend/src/App.tsx`)
- Wallet lifecycle → Browser persistence: persists wallet and PXE (evidence: `privazy_frontend/src/wallet.ts`)
- Wallet lifecycle → Aztec node: creates node client (evidence: `privazy_frontend/src/wallet.ts`)
- Message operations → Aztec node: queries contract (evidence: `privazy_frontend/src/privazy.ts`)
- Aztec node → Aztec network: connects
- Message operations → Sponsored fees: creates payment method (evidence: `privazy_frontend/src/privazy.ts`)
- Sponsored fees → Sponsored fee artifact: loads artifact (evidence: `privazy_frontend/src/fees.ts`)
- Sponsored fees → Wallet lifecycle: registers contracts
- Message operations → Contract artifact: uses contract bindings (evidence: `privazy_frontend/src/privazy.ts`)
- Contract artifact → PrivAZy contract: represents
- Contract test package → PrivAZy contract: tests
- Message operations → Aztec network: simulates and sends
