# baala-codes/rent-olana architecture

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

- Interactive diagram: https://gitdiagram.com/baala-codes/rent-olana
- Repository: https://github.com/baala-codes/rent-olana

## Overview

This is a Solana physical-asset rental marketplace: owners publish listings, renters discover and book them, and the on-chain program governs escrow and rental outcomes. The portal combines backend search and metadata with wallet-signed program transactions; the backend mirrors finalized chain state for discovery and history, but does not move funds. The graph preserves listing, booking, settlement, dispute, and administration stages, plus the client contract and backend mirror layers. Some subsystem links rely on README statements or the SOURCE INDEX; unsampled implementation details are not inferred.

Main entry points: [`frontend/src/App.tsx`](https://github.com/baala-codes/rent-olana/blob/main/frontend/src/App.tsx) (Portal navigation), [`frontend/src/ProgramContext.tsx`](https://github.com/baala-codes/rent-olana/blob/main/frontend/src/ProgramContext.tsx) (Portal state and actions), [`programs/asset-rental/src/state.rs`](https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/state.rs) (Listing and rental state), [`frontend/src/api/client.ts`](https://github.com/baala-codes/rent-olana/blob/main/frontend/src/api/client.ts) (Backend API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Browser portal"]
  node_portal_app["Portal navigation<br/>[App.tsx]"]
  node_market["Market discovery<br/>[MarketView.tsx]"]
  node_listing_detail["Listing booking"]
  node_manage["Listing management<br/>[ManageView.tsx]"]
  node_rental_admin_views["Rental and admin views"]
  node_portal_state["Portal state and actions<br/>[ProgramContext.tsx]"]
  node_portal_api["Backend API client<br/>[client.ts]"]
  node_metadata_store["Metadata commitment<br/>[store.ts]"]
end

subgraph group_backend["Provider backend"]
  node_http_api["HTTP API<br/>[http.ts]"]
  node_mirror_service["Chain reconciliation<br/>[mirror.ts]"]
  node_mirror_db[("Search and rental mirror<br/>[db.ts]")]
  node_chain_reader["Solana chain reader<br/>[chain.ts]"]
  node_media_store["Media storage<br/>[media.ts]"]
  node_audit_log["JSONL audit<br/>[audit.ts]"]
end

subgraph group_shared["Off-chain contract"]
  node_shared_api_search["API and search contract<br/>[api.ts]"]
  node_shared_metadata["Metadata contract<br/>[metadata.ts]"]
end

subgraph group_client["Solana client"]
  node_ts_client["Instruction and account client<br/>[wire.ts]"]
end

subgraph group_program["On-chain program"]
  node_program_state["Listing and rental state<br/>[state.rs]"]
  node_listing_ops["Listing operations<br/>[register_asset.rs]"]
  node_booking_ops["Booking and escrow<br/>[create_rental.rs]"]
  node_settlement_ops["Settlement and cancellation<br/>[settle_rental.rs]"]
  node_dispute_ops["Dispute resolution<br/>[resolve_dispute.rs]"]
  node_config_ops["Platform administration<br/>[config.rs]"]
end

node_owners(("Owners"))
node_renters(("Renters"))
node_admins(("Admins"))
node_rpc{{"Solana RPC"}}

node_owners -->|"manage listings"| node_portal_app
node_renters -->|"discover and rent"| node_portal_app
node_admins -->|"administer"| node_portal_app
node_portal_app -->|"routes to"| node_market
node_portal_app -->|"opens listing"| node_listing_detail
node_portal_app -->|"routes to"| node_manage
node_portal_app -->|"routes to"| node_rental_admin_views
node_market -->|"reads listings"| node_portal_state
node_portal_state -->|"searches backend"| node_portal_api
node_portal_state -->|"reads and submits"| node_rpc
node_manage -->|"uses actions"| node_portal_state
node_manage -->|"uploads media"| node_portal_api
node_manage -->|"saves metadata"| node_metadata_store
node_portal_api -->|"requests API"| node_http_api
node_http_api -->|"queries mirror"| node_mirror_db
node_http_api -->|"serves media"| node_media_store
node_mirror_service -->|"reads finalized state"| node_chain_reader
node_mirror_service -->|"updates mirror"| node_mirror_db
node_mirror_service -->|"records events"| node_audit_log
node_listing_detail -->|"books rental"| node_portal_state
node_rental_admin_views -->|"submits actions"| node_portal_state
node_portal_state -->|"builds instructions"| node_ts_client
node_ts_client -->|"encodes transactions"| node_rpc
node_rpc -->|"executes program"| node_program_state
node_listing_ops -.->|"creates listings"| node_program_state
node_booking_ops -->|"creates rentals"| node_program_state
node_settlement_ops -->|"updates rental"| node_program_state
node_dispute_ops -.->|"resolves dispute"| node_program_state
node_config_ops -.->|"updates config"| node_program_state
node_shared_api_search -->|"defines payloads"| node_portal_api
node_shared_metadata -->|"defines metadata"| node_portal_api

click node_portal_app "https://github.com/baala-codes/rent-olana/blob/main/frontend/src/App.tsx"
click node_market "https://github.com/baala-codes/rent-olana/blob/main/frontend/src/views/MarketView.tsx"
click node_listing_detail "https://github.com/baala-codes/rent-olana/blob/main/frontend/src/views/ListingDetailView.tsx"
click node_manage "https://github.com/baala-codes/rent-olana/blob/main/frontend/src/views/ManageView.tsx"
click node_rental_admin_views "https://github.com/baala-codes/rent-olana/tree/main/frontend/src/views"
click node_portal_state "https://github.com/baala-codes/rent-olana/blob/main/frontend/src/ProgramContext.tsx"
click node_portal_api "https://github.com/baala-codes/rent-olana/blob/main/frontend/src/api/client.ts"
click node_metadata_store "https://github.com/baala-codes/rent-olana/blob/main/frontend/src/metadata/store.ts"
click node_http_api "https://github.com/baala-codes/rent-olana/blob/main/backend/src/http.ts"
click node_mirror_service "https://github.com/baala-codes/rent-olana/blob/main/backend/src/mirror.ts"
click node_mirror_db "https://github.com/baala-codes/rent-olana/blob/main/backend/src/db.ts"
click node_chain_reader "https://github.com/baala-codes/rent-olana/blob/main/backend/src/chain.ts"
click node_media_store "https://github.com/baala-codes/rent-olana/blob/main/backend/src/media.ts"
click node_audit_log "https://github.com/baala-codes/rent-olana/blob/main/backend/src/audit.ts"
click node_shared_api_search "https://github.com/baala-codes/rent-olana/blob/main/shared/src/api.ts"
click node_shared_metadata "https://github.com/baala-codes/rent-olana/blob/main/shared/src/metadata.ts"
click node_ts_client "https://github.com/baala-codes/rent-olana/blob/main/clients/ts/wire.ts"
click node_program_state "https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/state.rs"
click node_listing_ops "https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/instructions/register_asset.rs"
click node_booking_ops "https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/instructions/create_rental.rs"
click node_settlement_ops "https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/instructions/settle_rental.rs"
click node_dispute_ops "https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/instructions/resolve_dispute.rs"
click node_config_ops "https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/instructions/config.rs"

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_portal_app,node_market,node_listing_detail,node_manage,node_rental_admin_views,node_portal_state,node_portal_api,node_metadata_store toneBlue
class node_http_api,node_mirror_service,node_mirror_db,node_chain_reader,node_media_store,node_audit_log toneAmber
class node_shared_api_search,node_shared_metadata toneMint
class node_ts_client toneRose
class node_program_state,node_listing_ops,node_booking_ops,node_settlement_ops,node_dispute_ops,node_config_ops,node_owners,node_renters,node_admins,node_rpc toneIndigo
```

## Components

### Browser portal

- [Portal navigation](https://github.com/baala-codes/rent-olana/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Market discovery](https://github.com/baala-codes/rent-olana/blob/main/frontend/src/views/MarketView.tsx): `frontend/src/views/MarketView.tsx`
- [Listing booking](https://github.com/baala-codes/rent-olana/blob/main/frontend/src/views/ListingDetailView.tsx): `frontend/src/views/ListingDetailView.tsx`
- [Listing management](https://github.com/baala-codes/rent-olana/blob/main/frontend/src/views/ManageView.tsx): `frontend/src/views/ManageView.tsx`
- [Rental and admin views](https://github.com/baala-codes/rent-olana/tree/main/frontend/src/views): `frontend/src/views`
- [Portal state and actions](https://github.com/baala-codes/rent-olana/blob/main/frontend/src/ProgramContext.tsx): `frontend/src/ProgramContext.tsx`
- [Backend API client](https://github.com/baala-codes/rent-olana/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Metadata commitment](https://github.com/baala-codes/rent-olana/blob/main/frontend/src/metadata/store.ts): `frontend/src/metadata/store.ts`

### Provider backend

- [HTTP API](https://github.com/baala-codes/rent-olana/blob/main/backend/src/http.ts): `backend/src/http.ts`
- [Chain reconciliation](https://github.com/baala-codes/rent-olana/blob/main/backend/src/mirror.ts): `backend/src/mirror.ts`
- [Search and rental mirror](https://github.com/baala-codes/rent-olana/blob/main/backend/src/db.ts): `backend/src/db.ts`
- [Solana chain reader](https://github.com/baala-codes/rent-olana/blob/main/backend/src/chain.ts): `backend/src/chain.ts`
- [Media storage](https://github.com/baala-codes/rent-olana/blob/main/backend/src/media.ts): `backend/src/media.ts`
- [JSONL audit](https://github.com/baala-codes/rent-olana/blob/main/backend/src/audit.ts): `backend/src/audit.ts`

### Off-chain contract

- [API and search contract](https://github.com/baala-codes/rent-olana/blob/main/shared/src/api.ts): `shared/src/api.ts`
- [Metadata contract](https://github.com/baala-codes/rent-olana/blob/main/shared/src/metadata.ts): `shared/src/metadata.ts`

### Solana client

- [Instruction and account client](https://github.com/baala-codes/rent-olana/blob/main/clients/ts/wire.ts): `clients/ts/wire.ts`

### On-chain program

- [Listing and rental state](https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/state.rs): `programs/asset-rental/src/state.rs`
- [Listing operations](https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/instructions/register_asset.rs): `programs/asset-rental/src/instructions/register_asset.rs`
- [Booking and escrow](https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/instructions/create_rental.rs): `programs/asset-rental/src/instructions/create_rental.rs`
- [Settlement and cancellation](https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/instructions/settle_rental.rs): `programs/asset-rental/src/instructions/settle_rental.rs`
- [Dispute resolution](https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/instructions/resolve_dispute.rs): `programs/asset-rental/src/instructions/resolve_dispute.rs`
- [Platform administration](https://github.com/baala-codes/rent-olana/blob/main/programs/asset-rental/src/instructions/config.rs): `programs/asset-rental/src/instructions/config.rs`

### Other components

- **Owners**
- **Renters**
- **Admins**
- **Solana RPC**

## Connections

- Owners → Portal navigation: manage listings (evidence: `README.md`)
- Renters → Portal navigation: discover and rent (evidence: `README.md`)
- Admins → Portal navigation: administer (evidence: `README.md`)
- Portal navigation → Market discovery: routes to (evidence: `frontend/src/App.tsx`)
- Portal navigation → Listing booking: opens listing (evidence: `frontend/src/App.tsx`)
- Portal navigation → Listing management: routes to (evidence: `frontend/src/App.tsx`)
- Portal navigation → Rental and admin views: routes to (evidence: `frontend/src/App.tsx`)
- Market discovery → Portal state and actions: reads listings (evidence: `frontend/src/views/MarketView.tsx`)
- Portal state and actions → Backend API client: searches backend (evidence: `frontend/src/ProgramContext.tsx`)
- Portal state and actions → Solana RPC: reads and submits (evidence: `README.md`)
- Listing management → Portal state and actions: uses actions (evidence: `frontend/src/views/ManageView.tsx`)
- Listing management → Backend API client: uploads media (evidence: `frontend/src/views/ManageView.tsx`)
- Listing management → Metadata commitment: saves metadata (evidence: `frontend/src/views/ManageView.tsx`)
- Backend API client → HTTP API: requests API (evidence: `README.md`)
- HTTP API → Search and rental mirror: queries mirror (evidence: `backend/src/http.ts`)
- HTTP API → Media storage: serves media (evidence: `backend/src/http.ts`)
- Chain reconciliation → Solana chain reader: reads finalized state (evidence: `README.md`)
- Chain reconciliation → Search and rental mirror: updates mirror (evidence: `backend/src/mirror.ts`)
- Chain reconciliation → JSONL audit: records events (evidence: `backend/src/mirror.ts`)
- Listing booking → Portal state and actions: books rental (evidence: `README.md`)
- Rental and admin views → Portal state and actions: submits actions (evidence: `README.md`)
- Portal state and actions → Instruction and account client: builds instructions (evidence: `frontend/src/ProgramContext.tsx`)
- Instruction and account client → Solana RPC: encodes transactions (evidence: `README.md`)
- Solana RPC → Listing and rental state: executes program (evidence: `README.md`)
- Listing operations → Listing and rental state: creates listings
- Booking and escrow → Listing and rental state: creates rentals (evidence: `programs/asset-rental/src/instructions/create_rental.rs`)
- Settlement and cancellation → Listing and rental state: updates rental (evidence: `programs/asset-rental/src/instructions/settle_rental.rs`)
- Dispute resolution → Listing and rental state: resolves dispute
- Platform administration → Listing and rental state: updates config
- API and search contract → Backend API client: defines payloads
- Metadata contract → Backend API client: defines metadata
