# mrtwister99-png/mychat_final architecture

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

- Interactive diagram: https://gitdiagram.com/mrtwister99-png/mychat_final
- Repository: https://github.com/mrtwister99-png/mychat_final

## Overview

blbEchat is an Expo mobile chat with PIN-based user/admin access and a Socket.IO backend. The primary workflow is entering a PIN, server-side role classification, then using the appropriate user or admin chat interface; the backend also manages chat state, device trust, recovery, and persisted configuration. Push notifications and the Žížala game are additional capabilities. The backend excerpt is partial, so the graph includes only clearly documented or evidenced connections and omits uncertain event wiring.

Main entry points: [`App.js`](https://github.com/mrtwister99-png/mychat_final/blob/master/App.js) (App navigation), [`server/index.js`](https://github.com/mrtwister99-png/mychat_final/blob/master/server/index.js) (Socket.IO server), [`src/socket.js`](https://github.com/mrtwister99-png/mychat_final/blob/master/src/socket.js) (Socket client), [`src/screens/UzivatelPin.js`](https://github.com/mrtwister99-png/mychat_final/blob/master/src/screens/UzivatelPin.js) (User chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_app["App navigation<br/>[App.js]"]
  node_pin_entry["PIN entry<br/>[PinEntry.js]"]
  node_user_chat["User chat<br/>[UzivatelPin.js]"]
  node_admin_chat["Admin console<br/>[AdminPin.js]"]
  node_socket_client["Socket client<br/>[socket.js]"]
  node_notifications["Push notifications<br/>[notifications.js]"]
end

subgraph group_backend["Chat backend"]
  node_server["Socket.IO server<br/>[index.js]"]
  node_pin_router["PIN classification<br/>[pinRouter.js]"]
  node_supabase_adapter["Persistence adapter<br/>[supabase.js]"]
end

subgraph group_services["External services"]
  node_supabase[("Supabase data")]
  node_expo_push["Expo push service"]
  node_score_store[("Game scores")]
end

subgraph group_extras["Additional features"]
  node_game["Žížala game<br/>[Zizala.js]"]
end

node_user(("Chat user"))
node_admin_actor(("Administrator"))

node_user -->|"opens app"| node_app
node_admin_actor -->|"opens app"| node_app
node_app -->|"shows entry"| node_pin_entry
node_pin_entry -->|"submits auth"| node_socket_client
node_socket_client -->|"Socket.IO events"| node_server
node_server -->|"classifies PIN"| node_pin_router
node_server -->|"loads and persists"| node_supabase_adapter
node_supabase_adapter -->|"reads and writes"| node_supabase
node_server -->|"sends updates"| node_socket_client
node_app -->|"routes user"| node_user_chat
node_app -->|"routes admin"| node_admin_chat
node_user_chat -->|"chat events"| node_socket_client
node_admin_chat -->|"admin events"| node_socket_client
node_app -->|"registers and handles"| node_notifications
node_server -->|"sends push"| node_expo_push
node_user_chat -->|"presents game"| node_game
node_game -->|"reads and writes scores"| node_score_store

click node_app "https://github.com/mrtwister99-png/mychat_final/blob/master/App.js"
click node_pin_entry "https://github.com/mrtwister99-png/mychat_final/blob/master/src/screens/PinEntry.js"
click node_user_chat "https://github.com/mrtwister99-png/mychat_final/blob/master/src/screens/UzivatelPin.js"
click node_admin_chat "https://github.com/mrtwister99-png/mychat_final/blob/master/src/screens/AdminPin.js"
click node_socket_client "https://github.com/mrtwister99-png/mychat_final/blob/master/src/socket.js"
click node_notifications "https://github.com/mrtwister99-png/mychat_final/blob/master/src/notifications.js"
click node_server "https://github.com/mrtwister99-png/mychat_final/blob/master/server/index.js"
click node_pin_router "https://github.com/mrtwister99-png/mychat_final/blob/master/server/pinRouter.js"
click node_supabase_adapter "https://github.com/mrtwister99-png/mychat_final/blob/master/server/supabase.js"
click node_game "https://github.com/mrtwister99-png/mychat_final/blob/master/src/components/Zizala.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_app,node_pin_entry,node_user_chat,node_admin_chat,node_socket_client,node_notifications,node_user toneBlue
class node_server,node_pin_router,node_supabase_adapter toneAmber
class node_supabase,node_expo_push,node_score_store toneMint
class node_game toneRose
class node_admin_actor toneIndigo
```

## Components

### Mobile app

- [App navigation](https://github.com/mrtwister99-png/mychat_final/blob/master/App.js): `App.js`
- [PIN entry](https://github.com/mrtwister99-png/mychat_final/blob/master/src/screens/PinEntry.js): `src/screens/PinEntry.js`
- [User chat](https://github.com/mrtwister99-png/mychat_final/blob/master/src/screens/UzivatelPin.js): `src/screens/UzivatelPin.js`
- [Admin console](https://github.com/mrtwister99-png/mychat_final/blob/master/src/screens/AdminPin.js): `src/screens/AdminPin.js`
- [Socket client](https://github.com/mrtwister99-png/mychat_final/blob/master/src/socket.js): `src/socket.js`
- [Push notifications](https://github.com/mrtwister99-png/mychat_final/blob/master/src/notifications.js): `src/notifications.js`

### Chat backend

- [Socket.IO server](https://github.com/mrtwister99-png/mychat_final/blob/master/server/index.js): `server/index.js`
- [PIN classification](https://github.com/mrtwister99-png/mychat_final/blob/master/server/pinRouter.js): `server/pinRouter.js`
- [Persistence adapter](https://github.com/mrtwister99-png/mychat_final/blob/master/server/supabase.js): `server/supabase.js`

### External services

- **Supabase data**
- **Expo push service**
- **Game scores**

### Additional features

- [Žížala game](https://github.com/mrtwister99-png/mychat_final/blob/master/src/components/Zizala.js): `src/components/Zizala.js`

### Other components

- **Chat user**
- **Administrator**

## Connections

- Chat user → App navigation: opens app
- Administrator → App navigation: opens app
- App navigation → PIN entry: shows entry
- PIN entry → Socket client: submits auth
- Socket client → Socket.IO server: Socket.IO events
- Socket.IO server → PIN classification: classifies PIN
- Socket.IO server → Persistence adapter: loads and persists
- Persistence adapter → Supabase data: reads and writes
- Socket.IO server → Socket client: sends updates
- App navigation → User chat: routes user
- App navigation → Admin console: routes admin
- User chat → Socket client: chat events
- Admin console → Socket client: admin events
- App navigation → Push notifications: registers and handles
- Socket.IO server → Expo push service: sends push
- User chat → Žížala game: presents game
- Žížala game → Game scores: reads and writes scores
