# katzennjammer/baylo-app architecture

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

- Interactive diagram: https://gitdiagram.com/katzennjammer/baylo-app
- Repository: https://github.com/katzennjammer/baylo-app

## Overview

Baylo is the Expo/React Native mobile client for a non-monetary local barter marketplace; its API and web admin are a separate repository. The main user journey is account access, discovering listings, posting an item, proposing and reviewing a swap, then coordinating and confirming the trade. The graph also preserves documented safety, messaging, reputation, and engagement capabilities. Several screens and API modules are indexed but unsampled, so their nodes are included while uncertain connections are omitted.

Main entry points: [`src/api/client.ts`](https://github.com/katzennjammer/baylo-app/blob/main/src/api/client.ts) (API client), [`app/(app)/index.tsx`](https://github.com/katzennjammer/baylo-app/blob/main/app/(app)/index.tsx) (Home feed), [`app/(auth)/login.tsx`](https://github.com/katzennjammer/baylo-app/blob/main/app/(auth)/login.tsx) (Sign in and register), [`app/offer-review.tsx`](https://github.com/katzennjammer/baylo-app/blob/main/app/offer-review.tsx) (Offer review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and app shell"]
  node_entry["App entry<br/>[index.tsx]"]
  node_session["Session state<br/>[session.tsx]"]
  node_authscreens["Sign in and register<br/>[login.tsx]"]
  node_authui["Auth sheet UI<br/>[auth-sheet.tsx]"]
  node_securestore[("Secure session storage<br/>[storage.ts]")]
  node_client["API client<br/>[client.ts]"]
end

subgraph group_discovery["Browse and listings"]
  node_home["Home feed<br/>[index.tsx]"]
  node_feedui["Feed components<br/>[FeedCard.tsx]"]
  node_market["Marketplace browse<br/>[marketplace.tsx]"]
  node_item["Item detail<br/>[item.tsx]"]
  node_post["Post item flow<br/>[state.tsx]"]
  node_postreview["Listing review<br/>[listing-review.tsx]"]
  node_valuation["Item valuation<br/>[post.ts]"]
end

subgraph group_exchange["Offers and trades"]
  node_offer["Offer rules and API<br/>[offer.ts]"]
  node_offerreview["Offer review<br/>[offer-review.tsx]"]
  node_trades["Trade lifecycle<br/>[trades.ts]"]
  node_tradeui["Trade coordination<br/>[trade-code.tsx]"]
  node_hubs["Safe-zone hubs<br/>[hubs.ts]"]
end

subgraph group_community["Trust and community"]
  node_messages["Messaging<br/>[thread.tsx]"]
  node_reputation["Profiles and trust<br/>[profile.ts]"]
  node_social["Social activity<br/>[social.ts]"]
  node_engagement["Notifications and rewards<br/>[notifications.ts]"]
  node_realtime["Realtime updates<br/>[pusher.ts]"]
end

node_user(("Mobile user"))
node_api["Baylo API"]

node_user -->|"opens app"| node_entry
node_entry -->|"checks session"| node_session
node_user -->|"signs in"| node_authscreens
node_authscreens -->|"renders"| node_authui
node_authscreens -->|"authenticates"| node_client
node_session -->|"manages session"| node_client
node_client -->|"reads and writes"| node_securestore
node_client -->|"sends HTTPS requests"| node_api
node_user -->|"views feed"| node_home
node_home -->|"renders"| node_feedui
node_home -->|"loads feed"| node_client
node_user -->|"browses listings"| node_market
node_market -.->|"requests listings"| node_client
node_home -->|"opens listing"| node_item
node_item -->|"requests offer data"| node_offer
node_user -->|"creates listing"| node_post
node_post -.->|"submits for review"| node_postreview
node_postreview -->|"uses posting API"| node_valuation
node_user -->|"reviews proposed swap"| node_offerreview
node_offerreview -->|"loads offer details"| node_offer
node_offerreview -->|"loads trade state"| node_trades
node_user -->|"confirms meetup swap"| node_tradeui
node_tradeui -.->|"confirms trade"| node_trades
node_user -->|"finds meetup points"| node_hubs
node_user -->|"messages trader"| node_messages
node_messages -.->|"receives live updates"| node_realtime
node_user -->|"views trust profile"| node_reputation
node_user -->|"likes and comments"| node_social
node_user -->|"tracks activity"| node_engagement

click node_entry "https://github.com/katzennjammer/baylo-app/blob/main/app/index.tsx"
click node_session "https://github.com/katzennjammer/baylo-app/blob/main/src/auth/session.tsx"
click node_authscreens "https://github.com/katzennjammer/baylo-app/blob/main/app/(auth)/login.tsx"
click node_authui "https://github.com/katzennjammer/baylo-app/blob/main/src/components/auth-sheet.tsx"
click node_securestore "https://github.com/katzennjammer/baylo-app/blob/main/src/auth/storage.ts"
click node_client "https://github.com/katzennjammer/baylo-app/blob/main/src/api/client.ts"
click node_home "https://github.com/katzennjammer/baylo-app/blob/main/app/(app)/index.tsx"
click node_feedui "https://github.com/katzennjammer/baylo-app/blob/main/src/components/home/FeedCard.tsx"
click node_market "https://github.com/katzennjammer/baylo-app/blob/main/app/(app)/marketplace.tsx"
click node_item "https://github.com/katzennjammer/baylo-app/blob/main/app/(app)/item.tsx"
click node_post "https://github.com/katzennjammer/baylo-app/blob/main/src/post/state.tsx"
click node_postreview "https://github.com/katzennjammer/baylo-app/blob/main/app/listing-review.tsx"
click node_valuation "https://github.com/katzennjammer/baylo-app/blob/main/src/api/post.ts"
click node_offer "https://github.com/katzennjammer/baylo-app/blob/main/src/api/offer.ts"
click node_offerreview "https://github.com/katzennjammer/baylo-app/blob/main/app/offer-review.tsx"
click node_trades "https://github.com/katzennjammer/baylo-app/blob/main/src/api/trades.ts"
click node_tradeui "https://github.com/katzennjammer/baylo-app/blob/main/app/trade-code.tsx"
click node_hubs "https://github.com/katzennjammer/baylo-app/blob/main/src/api/hubs.ts"
click node_messages "https://github.com/katzennjammer/baylo-app/blob/main/app/messages/thread.tsx"
click node_reputation "https://github.com/katzennjammer/baylo-app/blob/main/src/api/profile.ts"
click node_social "https://github.com/katzennjammer/baylo-app/blob/main/src/api/social.ts"
click node_engagement "https://github.com/katzennjammer/baylo-app/blob/main/src/api/notifications.ts"
click node_realtime "https://github.com/katzennjammer/baylo-app/blob/main/src/api/pusher.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_entry,node_session,node_authscreens,node_authui,node_securestore,node_client,node_user toneBlue
class node_home,node_feedui,node_market,node_item,node_post,node_postreview,node_valuation toneAmber
class node_offer,node_offerreview,node_trades,node_tradeui,node_hubs,node_api toneMint
class node_messages,node_reputation,node_social,node_engagement,node_realtime toneRose
```

## Components

### Identity and app shell

- [App entry](https://github.com/katzennjammer/baylo-app/blob/main/app/index.tsx): `app/index.tsx`
- [Session state](https://github.com/katzennjammer/baylo-app/blob/main/src/auth/session.tsx): `src/auth/session.tsx`
- [Sign in and register](https://github.com/katzennjammer/baylo-app/blob/main/app/(auth)/login.tsx): `app/(auth)/login.tsx`
- [Auth sheet UI](https://github.com/katzennjammer/baylo-app/blob/main/src/components/auth-sheet.tsx): `src/components/auth-sheet.tsx`
- [Secure session storage](https://github.com/katzennjammer/baylo-app/blob/main/src/auth/storage.ts): `src/auth/storage.ts`
- [API client](https://github.com/katzennjammer/baylo-app/blob/main/src/api/client.ts): `src/api/client.ts`

### Browse and listings

- [Home feed](https://github.com/katzennjammer/baylo-app/blob/main/app/(app)/index.tsx): `app/(app)/index.tsx`
- [Feed components](https://github.com/katzennjammer/baylo-app/blob/main/src/components/home/FeedCard.tsx): `src/components/home/FeedCard.tsx`
- [Marketplace browse](https://github.com/katzennjammer/baylo-app/blob/main/app/(app)/marketplace.tsx): `app/(app)/marketplace.tsx`
- [Item detail](https://github.com/katzennjammer/baylo-app/blob/main/app/(app)/item.tsx): `app/(app)/item.tsx`
- [Post item flow](https://github.com/katzennjammer/baylo-app/blob/main/src/post/state.tsx): `src/post/state.tsx`
- [Listing review](https://github.com/katzennjammer/baylo-app/blob/main/app/listing-review.tsx): `app/listing-review.tsx`
- [Item valuation](https://github.com/katzennjammer/baylo-app/blob/main/src/api/post.ts): `src/api/post.ts`

### Offers and trades

- [Offer rules and API](https://github.com/katzennjammer/baylo-app/blob/main/src/api/offer.ts): `src/api/offer.ts`
- [Offer review](https://github.com/katzennjammer/baylo-app/blob/main/app/offer-review.tsx): `app/offer-review.tsx`
- [Trade lifecycle](https://github.com/katzennjammer/baylo-app/blob/main/src/api/trades.ts): `src/api/trades.ts`
- [Trade coordination](https://github.com/katzennjammer/baylo-app/blob/main/app/trade-code.tsx): `app/trade-code.tsx`
- [Safe-zone hubs](https://github.com/katzennjammer/baylo-app/blob/main/src/api/hubs.ts): `src/api/hubs.ts`

### Trust and community

- [Messaging](https://github.com/katzennjammer/baylo-app/blob/main/app/messages/thread.tsx): `app/messages/thread.tsx`
- [Profiles and trust](https://github.com/katzennjammer/baylo-app/blob/main/src/api/profile.ts): `src/api/profile.ts`
- [Social activity](https://github.com/katzennjammer/baylo-app/blob/main/src/api/social.ts): `src/api/social.ts`
- [Notifications and rewards](https://github.com/katzennjammer/baylo-app/blob/main/src/api/notifications.ts): `src/api/notifications.ts`
- [Realtime updates](https://github.com/katzennjammer/baylo-app/blob/main/src/api/pusher.ts): `src/api/pusher.ts`

### Other components

- **Mobile user**
- **Baylo API**

## Connections

- Mobile user → App entry: opens app (evidence: `README.md`)
- App entry → Session state: checks session (evidence: `app/index.tsx`)
- Mobile user → Sign in and register: signs in (evidence: `app/(auth)/login.tsx`)
- Sign in and register → Auth sheet UI: renders (evidence: `app/(auth)/login.tsx`)
- Sign in and register → API client: authenticates (evidence: `app/(auth)/login.tsx`)
- Session state → API client: manages session (evidence: `src/auth/session.tsx`)
- API client → Secure session storage: reads and writes (evidence: `src/api/client.ts`)
- API client → Baylo API: sends HTTPS requests (evidence: `README.md`)
- Mobile user → Home feed: views feed (evidence: `README.md`)
- Home feed → Feed components: renders (evidence: `app/(app)/index.tsx`)
- Home feed → API client: loads feed (evidence: `app/(app)/index.tsx`)
- Mobile user → Marketplace browse: browses listings (evidence: `README.md`)
- Marketplace browse → API client: requests listings
- Home feed → Item detail: opens listing (evidence: `app/(app)/index.tsx`)
- Item detail → Offer rules and API: requests offer data (evidence: `app/(app)/item.tsx`)
- Mobile user → Post item flow: creates listing (evidence: `README.md`)
- Post item flow → Listing review: submits for review
- Listing review → Item valuation: uses posting API
- Mobile user → Offer review: reviews proposed swap (evidence: `README.md`)
- Offer review → Offer rules and API: loads offer details (evidence: `app/offer-review.tsx`)
- Offer review → Trade lifecycle: loads trade state (evidence: `app/offer-review.tsx`)
- Mobile user → Trade coordination: confirms meetup swap (evidence: `README.md`)
- Trade coordination → Trade lifecycle: confirms trade
- Mobile user → Safe-zone hubs: finds meetup points (evidence: `README.md`)
- Mobile user → Messaging: messages trader (evidence: `README.md`)
- Messaging → Realtime updates: receives live updates (evidence: `app/messages/thread.tsx`)
- Mobile user → Profiles and trust: views trust profile (evidence: `README.md`)
- Mobile user → Social activity: likes and comments (evidence: `README.md`)
- Mobile user → Notifications and rewards: tracks activity (evidence: `README.md`)
