# afnanalamm/hear architecture

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

- Interactive diagram: https://gitdiagram.com/afnanalamm/hear
- Repository: https://github.com/afnanalamm/hear

## Overview

1. This is an Expo React Native app structured with Expo Router. The `app/` directory is the navigation source of truth, and the rest of the repo is mostly shared UI, auth state, and static assets.

2. The app has three main route groups:
   - unauthenticated screens: `SignIn.jsx` and `SignUp.jsx`
   - standard user tabs: `app/(tabs)/...`
   - elevated/admin-style tabs: `app/(superuser-tabs)/...`
   This separation is the clearest architectural boundary in the repo.

3. Root navigation is centralized in `app/_layout.tsx`, with additional group layouts in `app/(tabs)/_layout.tsx` and `app/(superuser-tabs)/_layout.tsx`. That implies a nested navigation model where the root decides the auth flow, then hands off to either the normal or superuser tab navigator.

4. `components/AuthenticationContext.tsx` is the main cross-cutting state container. It likely governs login status, user role, and session transitions, and is the key data-flow dependency between sign-in/sign-up screens and the tabbed app areas.

5. The standard user experience is organized around five feature screens:
   - `Create`
   - `Feed`
   - `Map`
   - `Notifications`
   - `Settings`
   These are the primary functional modules of the app and represent the user-facing product surface.

6. The superuser experience mirrors the standard tabs with role-specific counterparts:
   - `SuperFeed`
   - `SuperMap`
   - `SuperNotifications`
   - `SuperSettings`
   This suggests the app has role-based feature access rather than a separate admin app.

7. Shared UI for settings is factored into reusable components:
   - `SettingsSectionsList.jsx`
   - `SuperSettingsSectionsList.jsx`
   - `ToggleSwitch.jsx`
   These indicate the settings screens are composed from reusable section/list primitives rather than being fully bespoke.

8. `components/serverConfig.jsx` is the main hint of external integration. It likely centralizes API or service configuration, meaning the app is a client that depends on remote backend endpoints even though no backend code is present here.

9. Static resources live in `assets/` and are split into fonts, icons, and images. That means branding and UI assets are bundled locally and consumed by the React Native screens.

10. `app/+not-found.tsx` provides a router fallback, so the navigation layer is designed to handle invalid routes gracefully. The `app/Psuedocodes/...` folders appear to be non-runtime design notes or implementation sketches, not part of the shipping app.

11. The repo also contains `Privacy Policy for Hear.docx` and `Terms and Conditions.docx`, which are product/legal artifacts rather than technical modules, but they matter operationally because they suggest a user-facing mobile product distributed through store channels.

12. In diagram terms, the architecture is: app startup through Expo Router, auth state managed centrally in context, role-based navigation branching into standard or superuser tab groups, shared settings components reused across screens, and remote service calls configured through a central server config.

Main entry points: [`components/serverConfig.jsx`](https://github.com/afnanalamm/hear/blob/master/components/serverConfig.jsx) (Server Config), [`app/_layout.tsx`](https://github.com/afnanalamm/hear/blob/master/app/_layout.tsx) (Root Layout), [`app/(tabs)/_layout.tsx`](https://github.com/afnanalamm/hear/blob/master/app/(tabs)/_layout.tsx) (Tabs Layout), [`app/(superuser-tabs)/_layout.tsx`](https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/_layout.tsx) (Super Layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Routing"]
  node_app_layout["Root Layout<br/>router shell<br/>[_layout.tsx]"]
  node_app_not_found["Not Found<br/>router fallback<br/>[+not-found.tsx]"]
  node_signin["Sign In<br/>auth screen<br/>[SignIn.jsx]"]
  node_signup["Sign Up<br/>auth screen<br/>[SignUp.jsx]"]
end

subgraph group_standard["Standard App"]
  node_tabs_layout["Tabs Layout<br/>tab navigator<br/>[_layout.tsx]"]
  node_create["Create<br/>composer screen<br/>[Create.jsx]"]
  node_feed["Feed<br/>content screen<br/>[Feed.jsx]"]
  node_map["Map<br/>location screen<br/>[Map.jsx]"]
  node_notifications["Notifications<br/>alerts screen<br/>[Notifications.tsx]"]
  node_settings["Settings<br/>profile screen<br/>[Settings.tsx]"]
end

subgraph group_superuser["Superuser App"]
  node_super_layout["Super Layout<br/>tab navigator<br/>[_layout.tsx]"]
  node_super_feed["Super Feed<br/>admin feed<br/>[SuperFeed.jsx]"]
  node_super_map["Super Map<br/>admin map<br/>[SuperMap.jsx]"]
  node_super_notifications["Super Alerts<br/>admin alerts"]
  node_super_settings["Super Settings<br/>admin profile<br/>[SuperSettings.tsx]"]
end

subgraph group_shared["Shared Core"]
  node_auth_context(("Auth Context<br/>state provider"))
  node_settings_list["Settings List<br/>ui composite"]
  node_super_settings_list["Super List<br/>ui composite"]
  node_toggle_switch{{"Toggle Switch<br/>ui control<br/>[ToggleSwitch.jsx]"}}
  node_server_config["Server Config<br/>api config<br/>[serverConfig.jsx]"]
end

subgraph group_assets["Assets"]
  node_assets_bundle[("Assets<br/>static bundle")]
end

node_app_layout -->|"wraps"| node_auth_context
node_app_layout -->|"routes to"| node_signin
node_app_layout -->|"routes to"| node_signup
node_app_layout -->|"hands off to"| node_tabs_layout
node_app_layout -->|"hands off to"| node_super_layout
node_app_layout -.->|"falls back to"| node_app_not_found
node_signin -->|"updates"| node_auth_context
node_signup -->|"updates"| node_auth_context
node_tabs_layout -->|"contains"| node_create
node_tabs_layout -->|"contains"| node_feed
node_tabs_layout -->|"contains"| node_map
node_tabs_layout -->|"contains"| node_notifications
node_tabs_layout -->|"contains"| node_settings
node_super_layout -->|"contains"| node_super_feed
node_super_layout -->|"contains"| node_super_map
node_super_layout -->|"contains"| node_super_notifications
node_super_layout -->|"contains"| node_super_settings
node_settings -->|"uses"| node_settings_list
node_super_settings -->|"uses"| node_super_settings_list
node_settings_list -->|"uses"| node_toggle_switch
node_super_settings_list -->|"uses"| node_toggle_switch
node_create -.->|"calls"| node_server_config
node_feed -.->|"calls"| node_server_config
node_map -.->|"calls"| node_server_config
node_notifications -.->|"calls"| node_server_config
node_settings -.->|"calls"| node_server_config
node_super_feed -.->|"calls"| node_server_config
node_super_map -.->|"calls"| node_server_config
node_super_notifications -.->|"calls"| node_server_config
node_super_settings -.->|"calls"| node_server_config
node_app_layout -.->|"loads"| node_assets_bundle

click node_app_layout "https://github.com/afnanalamm/hear/blob/master/app/_layout.tsx"
click node_app_not_found "https://github.com/afnanalamm/hear/blob/master/app/+not-found.tsx"
click node_signin "https://github.com/afnanalamm/hear/blob/master/app/SignIn.jsx"
click node_signup "https://github.com/afnanalamm/hear/blob/master/app/SignUp.jsx"
click node_tabs_layout "https://github.com/afnanalamm/hear/blob/master/app/(tabs)/_layout.tsx"
click node_create "https://github.com/afnanalamm/hear/blob/master/app/(tabs)/Create.jsx"
click node_feed "https://github.com/afnanalamm/hear/blob/master/app/(tabs)/Feed.jsx"
click node_map "https://github.com/afnanalamm/hear/blob/master/app/(tabs)/Map.jsx"
click node_notifications "https://github.com/afnanalamm/hear/blob/master/app/(tabs)/Notifications.tsx"
click node_settings "https://github.com/afnanalamm/hear/blob/master/app/(tabs)/Settings.tsx"
click node_super_layout "https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/_layout.tsx"
click node_super_feed "https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/SuperFeed.jsx"
click node_super_map "https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/SuperMap.jsx"
click node_super_notifications "https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/SuperNotifications.tsx"
click node_super_settings "https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/SuperSettings.tsx"
click node_auth_context "https://github.com/afnanalamm/hear/blob/master/components/AuthenticationContext.tsx"
click node_settings_list "https://github.com/afnanalamm/hear/blob/master/components/SettingsSectionsList.jsx"
click node_super_settings_list "https://github.com/afnanalamm/hear/blob/master/components/SuperSettingsSectionsList.jsx"
click node_toggle_switch "https://github.com/afnanalamm/hear/blob/master/components/ToggleSwitch.jsx"
click node_server_config "https://github.com/afnanalamm/hear/blob/master/components/serverConfig.jsx"
click node_assets_bundle "https://github.com/afnanalamm/hear/tree/master/assets"

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_layout,node_app_not_found,node_signin,node_signup toneBlue
class node_tabs_layout,node_create,node_feed,node_map,node_notifications,node_settings toneAmber
class node_super_layout,node_super_feed,node_super_map,node_super_notifications,node_super_settings toneMint
class node_auth_context,node_settings_list,node_super_settings_list,node_toggle_switch,node_server_config toneRose
class node_assets_bundle toneIndigo
```

## Components

### Routing

Expo Router navigation and route groups

- [Root Layout](https://github.com/afnanalamm/hear/blob/master/app/_layout.tsx): router shell · Centralizes app startup, auth gating, and route handoff · `app/_layout.tsx`
- [Not Found](https://github.com/afnanalamm/hear/blob/master/app/+not-found.tsx): router fallback · Handles invalid routes · `app/+not-found.tsx`
- [Sign In](https://github.com/afnanalamm/hear/blob/master/app/SignIn.jsx): auth screen · Unauthenticated entry screen · `app/SignIn.jsx`
- [Sign Up](https://github.com/afnanalamm/hear/blob/master/app/SignUp.jsx): auth screen · Account creation screen · `app/SignUp.jsx`

### Standard App

Primary user-facing tab screens

- [Tabs Layout](https://github.com/afnanalamm/hear/blob/master/app/(tabs)/_layout.tsx): tab navigator · Layout for standard user navigation · `app/(tabs)/_layout.tsx`
- [Create](https://github.com/afnanalamm/hear/blob/master/app/(tabs)/Create.jsx): composer screen · Primary creation flow · `app/(tabs)/Create.jsx`
- [Feed](https://github.com/afnanalamm/hear/blob/master/app/(tabs)/Feed.jsx): content screen · Standard feed view · `app/(tabs)/Feed.jsx`
- [Map](https://github.com/afnanalamm/hear/blob/master/app/(tabs)/Map.jsx): location screen · Standard map view · `app/(tabs)/Map.jsx`
- [Notifications](https://github.com/afnanalamm/hear/blob/master/app/(tabs)/Notifications.tsx): alerts screen · Standard notifications view · `app/(tabs)/Notifications.tsx`
- [Settings](https://github.com/afnanalamm/hear/blob/master/app/(tabs)/Settings.tsx): profile screen · Standard settings view · `app/(tabs)/Settings.tsx`

### Superuser App

Role-based elevated tab screens

- [Super Layout](https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/_layout.tsx): tab navigator · Layout for elevated role navigation · `app/(superuser-tabs)/_layout.tsx`
- [Super Feed](https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/SuperFeed.jsx): admin feed · Role-specific feed view · `app/(superuser-tabs)/SuperFeed.jsx`
- [Super Map](https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/SuperMap.jsx): admin map · Role-specific map view · `app/(superuser-tabs)/SuperMap.jsx`
- [Super Alerts](https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/SuperNotifications.tsx): admin alerts · Role-specific notifications view · `app/(superuser-tabs)/SuperNotifications.tsx`
- [Super Settings](https://github.com/afnanalamm/hear/blob/master/app/(superuser-tabs)/SuperSettings.tsx): admin profile · Role-specific settings view · `app/(superuser-tabs)/SuperSettings.tsx`

### Shared Core

Cross-cutting state, UI, and service config

- [Auth Context](https://github.com/afnanalamm/hear/blob/master/components/AuthenticationContext.tsx): state provider · Central session and role state · `components/AuthenticationContext.tsx`
- [Settings List](https://github.com/afnanalamm/hear/blob/master/components/SettingsSectionsList.jsx): ui composite · Reusable settings section list for standard users · `components/SettingsSectionsList.jsx`
- [Super List](https://github.com/afnanalamm/hear/blob/master/components/SuperSettingsSectionsList.jsx): ui composite · Reusable settings section list for superuser screens · `components/SuperSettingsSectionsList.jsx`
- [Toggle Switch](https://github.com/afnanalamm/hear/blob/master/components/ToggleSwitch.jsx): ui control · Shared on/off setting control · `components/ToggleSwitch.jsx`
- [Server Config](https://github.com/afnanalamm/hear/blob/master/components/serverConfig.jsx): api config · Central remote service configuration · `components/serverConfig.jsx`

### Assets

Bundled fonts, icons, and images

- [Assets](https://github.com/afnanalamm/hear/tree/master/assets): static bundle · Bundled fonts, icons, and images · `assets`

## Connections

- Root Layout → Auth Context: wraps · Provides session state across navigation
- Root Layout → Sign In: routes to · Shows auth entry when unauthenticated
- Root Layout → Sign Up: routes to · Shows registration flow when needed
- Root Layout → Tabs Layout: hands off to · Enters standard app after auth
- Root Layout → Super Layout: hands off to · Enters elevated app after role check
- Root Layout → Not Found: falls back to · Handles invalid routes
- Sign In → Auth Context: updates · Signs user in through shared session state
- Sign Up → Auth Context: updates · Creates account and initializes session state
- Tabs Layout → Create: contains · Standard tab set
- Tabs Layout → Feed: contains · Standard tab set
- Tabs Layout → Map: contains · Standard tab set
- Tabs Layout → Notifications: contains · Standard tab set
- Tabs Layout → Settings: contains · Standard tab set
- Super Layout → Super Feed: contains · Superuser tab set
- Super Layout → Super Map: contains · Superuser tab set
- Super Layout → Super Alerts: contains · Superuser tab set
- Super Layout → Super Settings: contains · Superuser tab set
- Settings → Settings List: uses · Composes settings sections from shared list primitives
- Super Settings → Super List: uses · Composes role-specific settings sections
- Settings List → Toggle Switch: uses · Reuses shared setting control
- Super List → Toggle Switch: uses · Reuses shared setting control
- Create → Server Config: calls · Relies on configured backend services
- Feed → Server Config: calls · Relies on configured backend services
- Map → Server Config: calls · Relies on configured backend services
- Notifications → Server Config: calls · Relies on configured backend services
- Settings → Server Config: calls · Relies on configured backend services
- Super Feed → Server Config: calls · Relies on configured backend services
- Super Map → Server Config: calls · Relies on configured backend services
- Super Alerts → Server Config: calls · Relies on configured backend services
- Super Settings → Server Config: calls · Relies on configured backend services
- Root Layout → Assets: loads · Uses bundled static resources
