# 0415t/imahima architecture

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

- Interactive diagram: https://gitdiagram.com/0415t/imahima
- Repository: https://github.com/0415t/imahima

## Overview

ImaHima is an Expo mobile app for viewing users and their availability, with email/password authentication and a server endpoint for toggling the current user's availability. The visible home screen loads user records from Supabase; sign-in delegates account actions to an auth module. A separate Express service validates bearer tokens and performs availability changes through injected dependencies. The source index also identifies push-notification and theme modules, but their detailed behavior is not shown; the graph preserves them without guessing their internal flow.

Main entry points: [`lib/supabase.ts`](https://github.com/0415t/imahima/blob/main/lib/supabase.ts) (Supabase client), [`app/(tabs)/index.tsx`](https://github.com/0415t/imahima/blob/main/app/(tabs)/index.tsx) (User list), [`app/sign-in.tsx`](https://github.com/0415t/imahima/blob/main/app/sign-in.tsx) (Sign-in screen), [`hooks/use-theme-color.ts`](https://github.com/0415t/imahima/blob/main/hooks/use-theme-color.ts) (Theme selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_home["User list<br/>[index.tsx]"]
  node_signin["Sign-in screen<br/>[sign-in.tsx]"]
  node_router["App navigation<br/>[_layout.tsx]"]
  node_themed_ui["Themed UI"]
  node_theme["Theme colors<br/>[theme.ts]"]
  node_theme_hook["Theme selection<br/>[use-theme-color.ts]"]
end

subgraph group_client_services["Client services"]
  node_auth["Auth operations<br/>[auth.ts]"]
  node_client_supabase["Supabase client<br/>[supabase.ts]"]
  node_session_storage["Session storage<br/>[auth-storage.ts]"]
  node_push["Push notifications"]
end

subgraph group_server["Availability API"]
  node_api["Express API<br/>[app.ts]"]
  node_server_supabase["Server Supabase client<br/>[supabase.ts]"]
end

subgraph group_backend["Backend services"]
  node_supabase[("Supabase backend")]
end

node_user(("App user"))

node_user -->|"views users"| node_home
node_user -->|"submits credentials"| node_signin
node_home -->|"queries users"| node_client_supabase
node_signin -->|"calls auth"| node_auth
node_auth -->|"uses client"| node_client_supabase
node_client_supabase -->|"persists session"| node_session_storage
node_router -->|"loads notifications"| node_push
node_themed_ui -->|"gets colors"| node_theme_hook
node_theme_hook -->|"reads palette"| node_theme
node_api -.->|"uses injected service"| node_server_supabase
node_server_supabase -->|"creates client"| node_supabase

click node_home "https://github.com/0415t/imahima/blob/main/app/(tabs)/index.tsx"
click node_signin "https://github.com/0415t/imahima/blob/main/app/sign-in.tsx"
click node_router "https://github.com/0415t/imahima/blob/main/app/_layout.tsx"
click node_themed_ui "https://github.com/0415t/imahima/tree/main/components"
click node_theme "https://github.com/0415t/imahima/blob/main/constants/theme.ts"
click node_theme_hook "https://github.com/0415t/imahima/blob/main/hooks/use-theme-color.ts"
click node_auth "https://github.com/0415t/imahima/blob/main/lib/auth.ts"
click node_client_supabase "https://github.com/0415t/imahima/blob/main/lib/supabase.ts"
click node_session_storage "https://github.com/0415t/imahima/blob/main/lib/auth-storage.ts"
click node_push "https://github.com/0415t/imahima/blob/main/lib/push-notifications.ts"
click node_api "https://github.com/0415t/imahima/blob/main/server/app.ts"
click node_server_supabase "https://github.com/0415t/imahima/blob/main/server/services/supabase.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_home,node_signin,node_router,node_themed_ui,node_theme,node_theme_hook,node_user toneBlue
class node_auth,node_client_supabase,node_session_storage,node_push toneAmber
class node_api,node_server_supabase toneMint
class node_supabase toneRose
```

## Components

### Mobile app

- [User list](https://github.com/0415t/imahima/blob/main/app/(tabs)/index.tsx): `app/(tabs)/index.tsx`
- [Sign-in screen](https://github.com/0415t/imahima/blob/main/app/sign-in.tsx): `app/sign-in.tsx`
- [App navigation](https://github.com/0415t/imahima/blob/main/app/_layout.tsx): `app/_layout.tsx`
- [Themed UI](https://github.com/0415t/imahima/tree/main/components): `components`
- [Theme colors](https://github.com/0415t/imahima/blob/main/constants/theme.ts): `constants/theme.ts`
- [Theme selection](https://github.com/0415t/imahima/blob/main/hooks/use-theme-color.ts): `hooks/use-theme-color.ts`

### Client services

- [Auth operations](https://github.com/0415t/imahima/blob/main/lib/auth.ts): `lib/auth.ts`
- [Supabase client](https://github.com/0415t/imahima/blob/main/lib/supabase.ts): `lib/supabase.ts`
- [Session storage](https://github.com/0415t/imahima/blob/main/lib/auth-storage.ts): `lib/auth-storage.ts`
- [Push notifications](https://github.com/0415t/imahima/blob/main/lib/push-notifications.ts): `lib/push-notifications.ts`

### Availability API

- [Express API](https://github.com/0415t/imahima/blob/main/server/app.ts): `server/app.ts`
- [Server Supabase client](https://github.com/0415t/imahima/blob/main/server/services/supabase.ts): `server/services/supabase.ts`

### Backend services

- **Supabase backend**

### Other components

- **App user**

## Connections

- App user → User list: views users (evidence: `app/(tabs)/index.tsx`)
- App user → Sign-in screen: submits credentials (evidence: `app/sign-in.tsx`)
- User list → Supabase client: queries users (evidence: `app/(tabs)/index.tsx`)
- Sign-in screen → Auth operations: calls auth (evidence: `app/sign-in.tsx`)
- Auth operations → Supabase client: uses client (evidence: `lib/auth.ts`)
- Supabase client → Session storage: persists session (evidence: `lib/supabase.ts`)
- App navigation → Push notifications: loads notifications (evidence: `app/_layout.tsx`)
- Themed UI → Theme selection: gets colors (evidence: `components/themed-text.tsx`)
- Theme selection → Theme colors: reads palette (evidence: `hooks/use-theme-color.ts`)
- Express API → Server Supabase client: uses injected service
- Server Supabase client → Supabase backend: creates client (evidence: `server/services/supabase.ts`)
