# davideast/pyric architecture

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

- Interactive diagram: https://gitdiagram.com/davideast/pyric
- Repository: https://github.com/davideast/pyric

## Overview

Pyric is a local Firebase sandbox and compatibility toolkit. The main workflow keeps application code on standard Firebase imports while a development plugin redirects supported SDKs to a browser-local backend; developers and agents can then seed, inspect, and change that sandbox. Separate capabilities provide Studio observability, sandbox branching, Security Rules verification, and Firebase conformance evidence. The graph reflects README-described wiring and the sampled Storage surfaces; several core modules are indexed but their internal calls were not sampled, so those links are omitted.

Main entry points: [`packages/cli/src/serve/worker`](https://github.com/davideast/pyric/tree/main/packages/cli/src/serve/worker) (Worker protocol), [`packages/cli/src/bridge`](https://github.com/davideast/pyric/tree/main/packages/cli/src/bridge) (Agent and CLI tools), [`packages/pyric/src/sandbox`](https://github.com/davideast/pyric/tree/main/packages/pyric/src/sandbox) (Sandbox state), [`packages/studio/src/features/data/StoragePane.tsx`](https://github.com/davideast/pyric/blob/main/packages/studio/src/features/data/StoragePane.tsx) (Studio observability)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dev["Development entry"]
  node_devswap["SDK development swap"]
end

subgraph group_sandbox["Sandbox runtime"]
  node_mirror["Mirror SDKs"]
  node_worker["Worker protocol"]
  node_restauth["Auth and RTDB REST<br/>[rest-auth-rtdb.ts]"]
  node_store[("Sandbox state")]
  node_storagebyte["Storage byte route"]
  node_branching["Sandbox branching"]
  node_rules["Storage rules engine<br/>[storage.ts]"]
end

subgraph group_tools["Developer tools"]
  node_studio["Studio observability<br/>[StoragePane.tsx]"]
  node_storageapi["Storage UI API<br/>[storageApi.ts]"]
  node_agent["Agent and CLI tools"]
  node_bridgeprotocol["Bridge protocol<br/>[protocol.ts]"]
end

subgraph group_evidence["Verification and conformance"]
  node_verify["Session verification<br/>[storage-verify.ts]"]
  node_fixture["Verification fixtures<br/>[fixture.ts]"]
  node_conformance["Firebase conformance"]
  node_oracle["Rules oracle session"]
end

node_app(("Firebase application"))
node_externalfirebase(("Firebase production"))

node_app -->|"uses in dev"| node_devswap
node_devswap -->|"swaps SDKs"| node_mirror
node_mirror -.->|"communicates locally"| node_worker
node_worker -.->|"accesses state"| node_store
node_worker -.->|"routes operations"| node_restauth
node_worker -->|"transfers bytes"| node_storagebyte
node_app -->|"uses in production"| node_externalfirebase
node_studio -->|"inspects same backend"| node_worker
node_studio -->|"uses storage API"| node_storageapi
node_storageapi -.->|"evaluates rules"| node_rules
node_agent -->|"routes agent operations"| node_worker
node_agent -.->|"uses protocol"| node_bridgeprotocol
node_agent -->|"seeds and inspects"| node_store
node_branching -->|"manages sandbox data"| node_store
node_verify -->|"loads fixtures"| node_fixture
node_verify -->|"optionally evaluates rules"| node_externalfirebase
node_conformance -->|"deploys probe rules"| node_oracle
node_oracle -->|"deploys and restores rules"| node_externalfirebase

click node_devswap "https://github.com/davideast/pyric/tree/main/packages/cli/src"
click node_mirror "https://github.com/davideast/pyric/blob/main/packages/swift-client/Sources/PyricFirestore/PyricFirestore.swift"
click node_worker "https://github.com/davideast/pyric/tree/main/packages/cli/src/serve/worker"
click node_restauth "https://github.com/davideast/pyric/blob/main/packages/cli/src/serve/rest-auth-rtdb.ts"
click node_store "https://github.com/davideast/pyric/tree/main/packages/pyric/src/sandbox"
click node_storagebyte "https://github.com/davideast/pyric/blob/main/packages/cli/src/serve/hosted/storage-byte-route.ts"
click node_branching "https://github.com/davideast/pyric/tree/main/packages/pyric/src/sandbox/branches"
click node_studio "https://github.com/davideast/pyric/blob/main/packages/studio/src/features/data/StoragePane.tsx"
click node_storageapi "https://github.com/davideast/pyric/blob/main/packages/ui/src/storage/storageApi.ts"
click node_agent "https://github.com/davideast/pyric/tree/main/packages/cli/src/bridge"
click node_bridgeprotocol "https://github.com/davideast/pyric/blob/main/packages/cli/src/bridge/protocol.ts"
click node_rules "https://github.com/davideast/pyric/blob/main/packages/rules/src/api/storage.ts"
click node_verify "https://github.com/davideast/pyric/blob/main/packages/cli/src/verify/storage-verify.ts"
click node_fixture "https://github.com/davideast/pyric/blob/main/packages/cli/src/verify/fixture.ts"
click node_conformance "https://github.com/davideast/pyric/blob/main/packages/conformance/src/sdk-probe-runtime.ts"
click node_oracle "https://github.com/davideast/pyric/blob/main/packages/conformance/src/oracle-rules-session.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_devswap toneBlue
class node_mirror,node_worker,node_restauth,node_store,node_storagebyte,node_branching,node_rules toneAmber
class node_studio,node_storageapi,node_agent,node_bridgeprotocol toneMint
class node_verify,node_fixture,node_conformance,node_oracle toneRose
class node_app,node_externalfirebase toneIndigo
```

## Components

### Development entry

- [SDK development swap](https://github.com/davideast/pyric/tree/main/packages/cli/src): `packages/cli/src`

### Sandbox runtime

- [Mirror SDKs](https://github.com/davideast/pyric/blob/main/packages/swift-client/Sources/PyricFirestore/PyricFirestore.swift): `packages/swift-client/Sources/PyricFirestore/PyricFirestore.swift`
- [Worker protocol](https://github.com/davideast/pyric/tree/main/packages/cli/src/serve/worker): `packages/cli/src/serve/worker`
- [Auth and RTDB REST](https://github.com/davideast/pyric/blob/main/packages/cli/src/serve/rest-auth-rtdb.ts): `packages/cli/src/serve/rest-auth-rtdb.ts`
- [Sandbox state](https://github.com/davideast/pyric/tree/main/packages/pyric/src/sandbox): `packages/pyric/src/sandbox`
- [Storage byte route](https://github.com/davideast/pyric/blob/main/packages/cli/src/serve/hosted/storage-byte-route.ts): `packages/cli/src/serve/hosted/storage-byte-route.ts`
- [Sandbox branching](https://github.com/davideast/pyric/tree/main/packages/pyric/src/sandbox/branches): `packages/pyric/src/sandbox/branches`
- [Storage rules engine](https://github.com/davideast/pyric/blob/main/packages/rules/src/api/storage.ts): `packages/rules/src/api/storage.ts`

### Developer tools

- [Studio observability](https://github.com/davideast/pyric/blob/main/packages/studio/src/features/data/StoragePane.tsx): `packages/studio/src/features/data/StoragePane.tsx`
- [Storage UI API](https://github.com/davideast/pyric/blob/main/packages/ui/src/storage/storageApi.ts): `packages/ui/src/storage/storageApi.ts`
- [Agent and CLI tools](https://github.com/davideast/pyric/tree/main/packages/cli/src/bridge): `packages/cli/src/bridge`
- [Bridge protocol](https://github.com/davideast/pyric/blob/main/packages/cli/src/bridge/protocol.ts): `packages/cli/src/bridge/protocol.ts`

### Verification and conformance

- [Session verification](https://github.com/davideast/pyric/blob/main/packages/cli/src/verify/storage-verify.ts): `packages/cli/src/verify/storage-verify.ts`
- [Verification fixtures](https://github.com/davideast/pyric/blob/main/packages/cli/src/verify/fixture.ts): `packages/cli/src/verify/fixture.ts`
- [Firebase conformance](https://github.com/davideast/pyric/blob/main/packages/conformance/src/sdk-probe-runtime.ts): `packages/conformance/src/sdk-probe-runtime.ts`
- [Rules oracle session](https://github.com/davideast/pyric/blob/main/packages/conformance/src/oracle-rules-session.ts): `packages/conformance/src/oracle-rules-session.ts`

### Other components

- **Firebase application**
- **Firebase production**

## Connections

- Firebase application → SDK development swap: uses in dev
- SDK development swap → Mirror SDKs: swaps SDKs
- Mirror SDKs → Worker protocol: communicates locally
- Worker protocol → Sandbox state: accesses state
- Worker protocol → Auth and RTDB REST: routes operations
- Worker protocol → Storage byte route: transfers bytes (evidence: `packages/cli/src/serve/hosted/storage-byte-route.ts`)
- Firebase application → Firebase production: uses in production
- Studio observability → Worker protocol: inspects same backend
- Studio observability → Storage UI API: uses storage API (evidence: `packages/studio/src/features/data/StoragePane.tsx`)
- Storage UI API → Storage rules engine: evaluates rules
- Agent and CLI tools → Worker protocol: routes agent operations (evidence: `packages/cli/src/bridge/server/peer.ts`)
- Agent and CLI tools → Bridge protocol: uses protocol (evidence: `packages/cli/src/bridge/server/peer.ts`)
- Agent and CLI tools → Sandbox state: seeds and inspects
- Sandbox branching → Sandbox state: manages sandbox data
- Session verification → Verification fixtures: loads fixtures (evidence: `packages/cli/src/verify/storage-verify.ts`)
- Session verification → Firebase production: optionally evaluates rules
- Firebase conformance → Rules oracle session: deploys probe rules (evidence: `packages/conformance/src/storage-probe-session.ts`)
- Rules oracle session → Firebase production: deploys and restores rules (evidence: `packages/conformance/src/oracle-rules-session.ts`)
