# nasstyfox/pastimes_xisd_android architecture

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

- Interactive diagram: https://gitdiagram.com/nasstyfox/pastimes_xisd_android
- Repository: https://github.com/nasstyfox/pastimes_xisd_android

## Overview

Pastimes is a second-hand clothing marketplace: buyers browse and purchase listings, sellers manage inventory, and admins oversee accounts and activity. The Android app authenticates users and routes them by role; feature screens use the API client to reach the Express API, whose route handlers implement marketplace operations against MySQL. Firebase provides authentication, while Cloudinary supports item-image uploads. README documents the broad capability and integration map; sampled source verifies app routing, API contracts, server dispatch, authentication, and database access, but not every feature implementation.

Main entry points: [`api/src/server.js`](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/server.js) (Express server), [`api/src/config/db.js`](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/config/db.js) (SQL connection pool), [`android/app/src/main/java/com/pastimes/app/data/api/ApiService.kt`](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/data/api/ApiService.kt) (API contract), [`android/app/src/main/java/com/pastimes/app/ui/RootNav.kt`](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/ui/RootNav.kt) (Role navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Android app"]
  node_activity["App startup<br/>[MainActivity.kt]"]
  node_authui["Login and registration"]
  node_authvm["Auth state<br/>[AuthViewModel.kt]"]
  node_authrepo["Auth repository<br/>[AuthRepository.kt]"]
  node_navigation["Role navigation<br/>[RootNav.kt]"]
  node_buyer["Buyer features"]
  node_seller["Seller features"]
  node_admin["Admin features"]
  node_settings["User preferences"]
  node_client["HTTP client<br/>[ApiClient.kt]"]
  node_contract["API contract<br/>[ApiService.kt]"]
end

subgraph group_api["Marketplace API"]
  node_server["Express server<br/>[server.js]"]
  node_authroutes["Authentication routes<br/>[auth.js]"]
  node_catalog["Categories and listings<br/>[items.js]"]
  node_cart["Cart operations<br/>[cart.js]"]
  node_orders["Checkout and orders<br/>[orders.js]"]
  node_addresses["Delivery addresses<br/>[addresses.js]"]
  node_adminroutes["Administration routes<br/>[admin.js]"]
  node_preferences["Settings routes<br/>[settings.js]"]
  node_authmw["Token authentication<br/>[auth.js]"]
  node_roles["Role authorization<br/>[role.js]"]
  node_dbpool["SQL connection pool<br/>[db.js]"]
end

subgraph group_identity["Identity and media"]
  node_firebasecfg["Firebase setup<br/>[firebase.js]"]
  node_firebase{{"Firebase services"}}
  node_cloudinary{{"Cloudinary image hosting"}}
end

subgraph group_state["Marketplace data"]
  node_mysql[("MySQL marketplace DB")]
end

node_person(("Marketplace user"))

node_person -->|"signs in"| node_authui
node_authui -->|"submits credentials"| node_authvm
node_authvm -->|"delegates auth"| node_authrepo
node_authrepo -->|"authenticates"| node_firebase
node_authrepo -->|"registers profile"| node_contract
node_activity -->|"routes by role"| node_navigation
node_navigation -->|"opens buyer routes"| node_buyer
node_navigation -->|"opens seller routes"| node_seller
node_navigation -->|"opens admin routes"| node_admin
node_navigation -->|"opens preferences"| node_settings
node_buyer -->|"requests marketplace data"| node_contract
node_seller -->|"manages listings"| node_contract
node_admin -->|"requests user actions"| node_contract
node_settings -->|"updates preferences"| node_contract
node_contract -->|"uses Retrofit"| node_client
node_client -->|"sends HTTPS requests"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_catalog
node_server -->|"mounts routes"| node_cart
node_server -->|"mounts routes"| node_orders
node_server -->|"mounts routes"| node_addresses
node_server -->|"mounts routes"| node_adminroutes
node_server -->|"mounts routes"| node_preferences
node_authroutes -->|"protects profile lookup"| node_authmw
node_authmw -->|"verifies token"| node_firebasecfg
node_firebasecfg -->|"initializes Admin SDK"| node_firebase
node_authmw -->|"loads user profile"| node_dbpool
node_authroutes -->|"reads and creates profiles"| node_dbpool
node_catalog -->|"queries listings"| node_dbpool
node_cart -->|"updates cart"| node_dbpool
node_orders -->|"records purchases"| node_dbpool
node_addresses -->|"stores addresses"| node_dbpool
node_adminroutes -->|"reads and updates users"| node_dbpool
node_preferences -->|"stores preferences"| node_dbpool
node_dbpool -->|"queries marketplace data"| node_mysql
node_roles -.->|"authorizes admin actions"| node_adminroutes
node_seller -.->|"uploads listing images"| node_cloudinary
node_adminroutes -.->|"sends password resets"| node_firebase

click node_activity "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/MainActivity.kt"
click node_authui "https://github.com/nasstyfox/pastimes_xisd_android/tree/main/android/app/src/main/java/com/pastimes/app/ui/auth"
click node_authvm "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/ui/auth/AuthViewModel.kt"
click node_authrepo "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/data/repository/AuthRepository.kt"
click node_navigation "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/ui/RootNav.kt"
click node_buyer "https://github.com/nasstyfox/pastimes_xisd_android/tree/main/android/app/src/main/java/com/pastimes/app/ui/buyer"
click node_seller "https://github.com/nasstyfox/pastimes_xisd_android/tree/main/android/app/src/main/java/com/pastimes/app/ui/seller"
click node_admin "https://github.com/nasstyfox/pastimes_xisd_android/tree/main/android/app/src/main/java/com/pastimes/app/ui/admin"
click node_settings "https://github.com/nasstyfox/pastimes_xisd_android/tree/main/android/app/src/main/java/com/pastimes/app/ui/settings"
click node_client "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/data/api/ApiClient.kt"
click node_contract "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/data/api/ApiService.kt"
click node_server "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/server.js"
click node_authroutes "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/auth.js"
click node_catalog "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/items.js"
click node_cart "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/cart.js"
click node_orders "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/orders.js"
click node_addresses "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/addresses.js"
click node_adminroutes "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/admin.js"
click node_preferences "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/settings.js"
click node_authmw "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/middleware/auth.js"
click node_roles "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/middleware/role.js"
click node_dbpool "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/config/db.js"
click node_firebasecfg "https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/config/firebase.js"

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_activity,node_authui,node_authvm,node_authrepo,node_navigation,node_buyer,node_seller,node_admin,node_settings,node_client,node_contract,node_person toneBlue
class node_server,node_authroutes,node_catalog,node_cart,node_orders,node_addresses,node_adminroutes,node_preferences,node_authmw,node_roles,node_dbpool toneAmber
class node_firebasecfg,node_firebase,node_cloudinary toneMint
class node_mysql toneRose
```

## Components

### Android app

- [App startup](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/MainActivity.kt): `android/app/src/main/java/com/pastimes/app/MainActivity.kt`
- [Login and registration](https://github.com/nasstyfox/pastimes_xisd_android/tree/main/android/app/src/main/java/com/pastimes/app/ui/auth): `android/app/src/main/java/com/pastimes/app/ui/auth`
- [Auth state](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/ui/auth/AuthViewModel.kt): `android/app/src/main/java/com/pastimes/app/ui/auth/AuthViewModel.kt`
- [Auth repository](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/data/repository/AuthRepository.kt): `android/app/src/main/java/com/pastimes/app/data/repository/AuthRepository.kt`
- [Role navigation](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/ui/RootNav.kt): `android/app/src/main/java/com/pastimes/app/ui/RootNav.kt`
- [Buyer features](https://github.com/nasstyfox/pastimes_xisd_android/tree/main/android/app/src/main/java/com/pastimes/app/ui/buyer): `android/app/src/main/java/com/pastimes/app/ui/buyer`
- [Seller features](https://github.com/nasstyfox/pastimes_xisd_android/tree/main/android/app/src/main/java/com/pastimes/app/ui/seller): `android/app/src/main/java/com/pastimes/app/ui/seller`
- [Admin features](https://github.com/nasstyfox/pastimes_xisd_android/tree/main/android/app/src/main/java/com/pastimes/app/ui/admin): `android/app/src/main/java/com/pastimes/app/ui/admin`
- [User preferences](https://github.com/nasstyfox/pastimes_xisd_android/tree/main/android/app/src/main/java/com/pastimes/app/ui/settings): `android/app/src/main/java/com/pastimes/app/ui/settings`
- [HTTP client](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/data/api/ApiClient.kt): `android/app/src/main/java/com/pastimes/app/data/api/ApiClient.kt`
- [API contract](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/android/app/src/main/java/com/pastimes/app/data/api/ApiService.kt): `android/app/src/main/java/com/pastimes/app/data/api/ApiService.kt`

### Marketplace API

- [Express server](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/server.js): `api/src/server.js`
- [Authentication routes](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/auth.js): `api/src/routes/auth.js`
- [Categories and listings](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/items.js): `api/src/routes/items.js`
- [Cart operations](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/cart.js): `api/src/routes/cart.js`
- [Checkout and orders](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/orders.js): `api/src/routes/orders.js`
- [Delivery addresses](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/addresses.js): `api/src/routes/addresses.js`
- [Administration routes](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/admin.js): `api/src/routes/admin.js`
- [Settings routes](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/routes/settings.js): `api/src/routes/settings.js`
- [Token authentication](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/middleware/auth.js): `api/src/middleware/auth.js`
- [Role authorization](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/middleware/role.js): `api/src/middleware/role.js`
- [SQL connection pool](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/config/db.js): `api/src/config/db.js`

### Identity and media

- [Firebase setup](https://github.com/nasstyfox/pastimes_xisd_android/blob/main/api/src/config/firebase.js): `api/src/config/firebase.js`
- **Firebase services**
- **Cloudinary image hosting**

### Marketplace data

- **MySQL marketplace DB**

### Other components

- **Marketplace user**

## Connections

- Marketplace user → Login and registration: signs in
- Login and registration → Auth state: submits credentials (evidence: `android/app/src/main/java/com/pastimes/app/ui/auth/LoginScreen.kt`)
- Auth state → Auth repository: delegates auth (evidence: `android/app/src/main/java/com/pastimes/app/ui/auth/AuthViewModel.kt`)
- Auth repository → Firebase services: authenticates (evidence: `android/app/src/main/java/com/pastimes/app/data/repository/AuthRepository.kt`)
- Auth repository → API contract: registers profile (evidence: `android/app/src/main/java/com/pastimes/app/data/repository/AuthRepository.kt`)
- App startup → Role navigation: routes by role (evidence: `android/app/src/main/java/com/pastimes/app/MainActivity.kt`)
- Role navigation → Buyer features: opens buyer routes (evidence: `android/app/src/main/java/com/pastimes/app/ui/RootNav.kt`)
- Role navigation → Seller features: opens seller routes (evidence: `android/app/src/main/java/com/pastimes/app/ui/RootNav.kt`)
- Role navigation → Admin features: opens admin routes (evidence: `android/app/src/main/java/com/pastimes/app/ui/RootNav.kt`)
- Role navigation → User preferences: opens preferences (evidence: `android/app/src/main/java/com/pastimes/app/ui/RootNav.kt`)
- Buyer features → API contract: requests marketplace data (evidence: `android/app/src/main/java/com/pastimes/app/ui/buyer/ItemDetailScreen.kt`)
- Seller features → API contract: manages listings (evidence: `android/app/src/main/java/com/pastimes/app/ui/seller/AddEditItemViewModel.kt`)
- Admin features → API contract: requests user actions (evidence: `android/app/src/main/java/com/pastimes/app/ui/admin/AdminUserDetailViewModel.kt`)
- User preferences → API contract: updates preferences (evidence: `android/app/src/main/java/com/pastimes/app/ui/settings/SettingsViewModel.kt`)
- API contract → HTTP client: uses Retrofit (evidence: `android/app/src/main/java/com/pastimes/app/data/api/ApiClient.kt`)
- HTTP client → Express server: sends HTTPS requests (evidence: `README.md`)
- Express server → Authentication routes: mounts routes (evidence: `api/src/server.js`)
- Express server → Categories and listings: mounts routes (evidence: `api/src/server.js`)
- Express server → Cart operations: mounts routes (evidence: `api/src/server.js`)
- Express server → Checkout and orders: mounts routes (evidence: `api/src/server.js`)
- Express server → Delivery addresses: mounts routes (evidence: `api/src/server.js`)
- Express server → Administration routes: mounts routes (evidence: `api/src/server.js`)
- Express server → Settings routes: mounts routes (evidence: `api/src/server.js`)
- Authentication routes → Token authentication: protects profile lookup (evidence: `api/src/routes/auth.js`)
- Token authentication → Firebase setup: verifies token (evidence: `api/src/middleware/auth.js`)
- Firebase setup → Firebase services: initializes Admin SDK (evidence: `api/src/config/firebase.js`)
- Token authentication → SQL connection pool: loads user profile (evidence: `api/src/middleware/auth.js`)
- Authentication routes → SQL connection pool: reads and creates profiles (evidence: `api/src/routes/auth.js`)
- Categories and listings → SQL connection pool: queries listings (evidence: `api/src/routes/items.js`)
- Cart operations → SQL connection pool: updates cart (evidence: `api/src/routes/cart.js`)
- Checkout and orders → SQL connection pool: records purchases (evidence: `api/src/routes/orders.js`)
- Delivery addresses → SQL connection pool: stores addresses (evidence: `api/src/routes/addresses.js`)
- Administration routes → SQL connection pool: reads and updates users (evidence: `api/src/routes/admin.js`)
- Settings routes → SQL connection pool: stores preferences (evidence: `api/src/routes/settings.js`)
- SQL connection pool → MySQL marketplace DB: queries marketplace data (evidence: `README.md`)
- Role authorization → Administration routes: authorizes admin actions (evidence: `api/src/routes/admin.js`)
- Seller features → Cloudinary image hosting: uploads listing images (evidence: `README.md`)
- Administration routes → Firebase services: sends password resets (evidence: `README.md`)
