# yaviracjorge/crud-react-native architecture

> Architecture diagram of the GitHub repository yaviracjorge/crud-react-native, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yaviracjorge/crud-react-native
- Repository: https://github.com/yaviracjorge/crud-react-native

## Overview

1. **Overall shape**
   - This is an **Expo / React Native / TypeScript** app using **file-based routing** from `app/`.
   - There is no custom backend service in the repo; the app appears to talk directly to **Firebase** from the client.

2. **Navigation boundary**
   - The router shell lives in `app/_layout.tsx`, with a tab navigator in `app/(tabs)/_layout.tsx`.
   - The visible app surface is split into two main tabs: `app/(tabs)/index.tsx` and `app/(tabs)/userView.tsx`.

3. **Primary product flow**
   - The filenames strongly suggest a **user management workflow**: one path for **creating/editing a user** and another for **showing/listing users**.
   - The `interface/createUser.tsx` and `interface/showUser.tsx` modules likely define the data shape or screen-level UI for those two concerns.

4. **Data access layer**
   - `database/firebase.js` is the app’s integration point to Firebase.
   - The app’s persistence boundary is therefore: **screens/components → hooks → Firebase client**.

5. **State and domain hook**
   - `hooks/useUsers.ts` is the key domain hook.
   - It likely encapsulates user fetching, mutation, and subscription logic so the UI stays thin and Firebase-specific details stay centralized.

6. **Reusable form/UI components**
   - `components/FormComp.tsx`, `inputCom.tsx`, `ButtonCom.tsx`, `SwitchCom.tsx`, and `CalendarCom.tsx` form a reusable input toolkit.
   - `components/UserCardCom.tsx` is the list/detail presentation primitive for displaying individual user records.
   - This suggests a form-driven screen feeding structured user data into a card-based list view.

7. **Likely screen-level data flow**
   - The create-user screen gathers input through the form components.
   - Submitted values flow into `useUsers`, which persists them through Firebase.
   - The user-view screen consumes the same hook or its derived state to render users via `UserCardCom`.

8. **UI feature boundaries**
   - `SwitchCom` and `CalendarCom` imply the user model includes at least one **boolean field** and one **date-like field**.
   - The app is not just plain text entry; it has richer form controls baked into the user creation flow.

9. **Theming and appearance**
   - Theme behavior is split across `style/themeProvider.tsx`, `style/globalStyle.tsx`, `style/colorStyle.tsx`, `constants/theme.ts`, and the `hooks/use-color-scheme*` / `use-theme-color` hooks.
   - The architecture includes a **system-aware light/dark theme layer** that feeds styles into the UI components and screens.

10. **Asset and presentation layer**
   - `assets/images` stores static app assets.
   - Styling is centralized enough to suggest a consistent visual system rather than ad hoc per-screen styles.

11. **Platform/runtime support**
   - The project is set up to run in the Expo ecosystem across **iOS, Android, and web**.
   - The presence of both `use-color-scheme.ts` and `use-color-scheme.web.ts` shows platform-specific adaptation at the hook level.

12. **Tooling and project hygiene**
   - `eslint.config.js`, `tsconfig.json`, and `package.json` indicate a standard TypeScript linted Expo codebase.
   - `scripts/reset-project.js` is the starter reset utility from `create-expo-app`, so this repo is still close to the scaffolded Expo structure.

13. **How to draw the architecture**
   - A good diagram would show:
     - **Router shell** at the top
     - Two **tab screens**
     - A shared **component library**
     - A central **users hook**
     - A **Firebase data source**
     - A cross-cutting **theme/styling layer**
   - The main dependency direction is from UI screens down to hooks and Firebase, with theming applied across all UI layers.

Main entry points: [`style/themeProvider.tsx`](https://github.com/yaviracjorge/crud-react-native/blob/main/style/themeProvider.tsx) (Theme provider), [`components/FormComp.tsx`](https://github.com/yaviracjorge/crud-react-native/blob/main/components/FormComp.tsx) (Form), [`app/(tabs)/index.tsx`](https://github.com/yaviracjorge/crud-react-native/blob/main/app/(tabs)/index.tsx) (Create user), [`app/(tabs)/userView.tsx`](https://github.com/yaviracjorge/crud-react-native/blob/main/app/(tabs)/userView.tsx) (User view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_nav["Navigation"]
  node_app_layout["App shell<br/>router layout<br/>[_layout.tsx]"]
  node_tabs_layout["Tabs<br/>tab layout<br/>[_layout.tsx]"]
end

subgraph group_users["Users Flow"]
  node_home_screen["Create user<br/>screen<br/>[index.tsx]"]
  node_user_view_screen["User view<br/>screen<br/>[userView.tsx]"]
  node_create_user_interface["Create model<br/>UI contract<br/>[createUser.tsx]"]
  node_show_user_interface["Show model<br/>UI contract<br/>[showUser.tsx]"]
  node_use_users["useUsers<br/>domain hook<br/>[useUsers.ts]"]
end

subgraph group_ui["UI Kit"]
  node_form_comp["Form<br/>[FormComp.tsx]"]
  node_input_comp["Input<br/>field control<br/>[inputCom.tsx]"]
  node_button_comp["Button<br/>action control<br/>[ButtonCom.tsx]"]
  node_switch_comp(("Switch<br/>boolean control<br/>[SwitchCom.tsx]"))
  node_calendar_comp(("Calendar<br/>date control<br/>[CalendarCom.tsx]"))
  node_user_card["User card<br/>display card<br/>[UserCardCom.tsx]"]
end

subgraph group_theme["Theme"]
  node_theme_provider["Theme provider<br/>theme boundary<br/>[themeProvider.tsx]"]
  node_global_style["Global style<br/>style system<br/>[globalStyle.tsx]"]
  node_color_style["Color style<br/>palette map<br/>[colorStyle.tsx]"]
  node_theme_constants["Theme tokens<br/>theme constants<br/>[theme.ts]"]
  node_scheme_hook["Color scheme<br/>platform hook"]
  node_theme_color_hook["Theme color<br/>theme hook<br/>[use-theme-color.ts]"]
end

subgraph group_data["Data"]
  node_firebase_client[("Firebase<br/>client SDK<br/>[firebase.js]")]
end

node_assets_images["Images<br/>asset folder"]

node_app_layout -->|"mounts"| node_tabs_layout
node_tabs_layout -->|"routes"| node_home_screen
node_tabs_layout -->|"routes"| node_user_view_screen
node_home_screen -->|"uses"| node_form_comp
node_home_screen -->|"mutates"| node_use_users
node_home_screen -->|"shapes"| node_create_user_interface
node_user_view_screen -->|"renders"| node_user_card
node_user_view_screen -->|"reads"| node_use_users
node_user_view_screen -->|"shapes"| node_show_user_interface
node_form_comp -->|"composes"| node_input_comp
node_form_comp -->|"composes"| node_switch_comp
node_form_comp -->|"composes"| node_calendar_comp
node_form_comp -->|"composes"| node_button_comp
node_use_users -->|"persists"| node_firebase_client
node_use_users -->|"feeds"| node_user_card
node_theme_provider -->|"applies"| node_global_style
node_theme_provider -->|"applies"| node_color_style
node_theme_provider -->|"configures"| node_theme_constants
node_scheme_hook -->|"supports"| node_theme_color_hook
node_theme_color_hook -->|"resolves"| node_color_style
node_scheme_hook -->|"drives"| node_theme_provider
node_theme_provider -->|"styles"| node_home_screen
node_theme_provider -->|"styles"| node_user_view_screen
node_theme_provider -->|"styles"| node_form_comp
node_theme_provider -->|"styles"| node_user_card
node_assets_images -.->|"supports"| node_home_screen

click node_app_layout "https://github.com/yaviracjorge/crud-react-native/blob/main/app/_layout.tsx"
click node_tabs_layout "https://github.com/yaviracjorge/crud-react-native/blob/main/app/(tabs)/_layout.tsx"
click node_home_screen "https://github.com/yaviracjorge/crud-react-native/blob/main/app/(tabs)/index.tsx"
click node_user_view_screen "https://github.com/yaviracjorge/crud-react-native/blob/main/app/(tabs)/userView.tsx"
click node_create_user_interface "https://github.com/yaviracjorge/crud-react-native/blob/main/interface/createUser.tsx"
click node_show_user_interface "https://github.com/yaviracjorge/crud-react-native/blob/main/interface/showUser.tsx"
click node_use_users "https://github.com/yaviracjorge/crud-react-native/blob/main/hooks/useUsers.ts"
click node_firebase_client "https://github.com/yaviracjorge/crud-react-native/blob/main/database/firebase.js"
click node_form_comp "https://github.com/yaviracjorge/crud-react-native/blob/main/components/FormComp.tsx"
click node_input_comp "https://github.com/yaviracjorge/crud-react-native/blob/main/components/inputCom.tsx"
click node_button_comp "https://github.com/yaviracjorge/crud-react-native/blob/main/components/ButtonCom.tsx"
click node_switch_comp "https://github.com/yaviracjorge/crud-react-native/blob/main/components/SwitchCom.tsx"
click node_calendar_comp "https://github.com/yaviracjorge/crud-react-native/blob/main/components/CalendarCom.tsx"
click node_user_card "https://github.com/yaviracjorge/crud-react-native/blob/main/components/UserCardCom.tsx"
click node_theme_provider "https://github.com/yaviracjorge/crud-react-native/blob/main/style/themeProvider.tsx"
click node_global_style "https://github.com/yaviracjorge/crud-react-native/blob/main/style/globalStyle.tsx"
click node_color_style "https://github.com/yaviracjorge/crud-react-native/blob/main/style/colorStyle.tsx"
click node_theme_constants "https://github.com/yaviracjorge/crud-react-native/blob/main/constants/theme.ts"
click node_scheme_hook "https://github.com/yaviracjorge/crud-react-native/blob/main/hooks/use-color-scheme.ts"
click node_theme_color_hook "https://github.com/yaviracjorge/crud-react-native/blob/main/hooks/use-theme-color.ts"
click node_assets_images "https://github.com/yaviracjorge/crud-react-native/tree/main/assets/images"

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_tabs_layout toneBlue
class node_home_screen,node_user_view_screen,node_create_user_interface,node_show_user_interface,node_use_users toneAmber
class node_form_comp,node_input_comp,node_button_comp,node_switch_comp,node_calendar_comp,node_user_card toneMint
class node_theme_provider,node_global_style,node_color_style,node_theme_constants,node_scheme_hook,node_theme_color_hook toneRose
class node_firebase_client toneIndigo
class node_assets_images toneNeutral
```

## Components

### Navigation

Expo router shell and tab-based screens

- [App shell](https://github.com/yaviracjorge/crud-react-native/blob/main/app/_layout.tsx): router layout · Root Expo router layout · `app/_layout.tsx`
- [Tabs](https://github.com/yaviracjorge/crud-react-native/blob/main/app/(tabs)/_layout.tsx): tab layout · Tab navigator for the app surface · `app/(tabs)/_layout.tsx`

### Users Flow

User creation and listing domain

- [Create user](https://github.com/yaviracjorge/crud-react-native/blob/main/app/(tabs)/index.tsx): screen · Primary tab for creating or editing users · `app/(tabs)/index.tsx`
- [User view](https://github.com/yaviracjorge/crud-react-native/blob/main/app/(tabs)/userView.tsx): screen · Primary tab for listing or viewing users · `app/(tabs)/userView.tsx`
- [Create model](https://github.com/yaviracjorge/crud-react-native/blob/main/interface/createUser.tsx): UI contract · Screen-level structure for the create user flow · `interface/createUser.tsx`
- [Show model](https://github.com/yaviracjorge/crud-react-native/blob/main/interface/showUser.tsx): UI contract · Screen-level structure for the user list flow · `interface/showUser.tsx`
- [useUsers](https://github.com/yaviracjorge/crud-react-native/blob/main/hooks/useUsers.ts): domain hook · Central user state, fetching, and mutation logic · `hooks/useUsers.ts`

### UI Kit

Reusable form and display components

- [Form](https://github.com/yaviracjorge/crud-react-native/blob/main/components/FormComp.tsx): form container · Reusable user form wrapper · `components/FormComp.tsx`
- [Input](https://github.com/yaviracjorge/crud-react-native/blob/main/components/inputCom.tsx): field control · Reusable text input control · `components/inputCom.tsx`
- [Button](https://github.com/yaviracjorge/crud-react-native/blob/main/components/ButtonCom.tsx): action control · Reusable action button control · `components/ButtonCom.tsx`
- [Switch](https://github.com/yaviracjorge/crud-react-native/blob/main/components/SwitchCom.tsx): boolean control · Reusable boolean field control · `components/SwitchCom.tsx`
- [Calendar](https://github.com/yaviracjorge/crud-react-native/blob/main/components/CalendarCom.tsx): date control · Reusable date field control · `components/CalendarCom.tsx`
- [User card](https://github.com/yaviracjorge/crud-react-native/blob/main/components/UserCardCom.tsx): display card · Reusable user record presentation · `components/UserCardCom.tsx`

### Theme

Shared color and styling system

- [Theme provider](https://github.com/yaviracjorge/crud-react-native/blob/main/style/themeProvider.tsx): theme boundary · Provides app-wide theme context · `style/themeProvider.tsx`
- [Global style](https://github.com/yaviracjorge/crud-react-native/blob/main/style/globalStyle.tsx): style system · Shared app-wide style definitions · `style/globalStyle.tsx`
- [Color style](https://github.com/yaviracjorge/crud-react-native/blob/main/style/colorStyle.tsx): palette map · Central color definitions and mappings · `style/colorStyle.tsx`
- [Theme tokens](https://github.com/yaviracjorge/crud-react-native/blob/main/constants/theme.ts): theme constants · Theme configuration and tokens · `constants/theme.ts`
- [Color scheme](https://github.com/yaviracjorge/crud-react-native/blob/main/hooks/use-color-scheme.ts): platform hook · System-aware color scheme hook with web variant · `hooks/use-color-scheme.ts`
- [Theme color](https://github.com/yaviracjorge/crud-react-native/blob/main/hooks/use-theme-color.ts): theme hook · Resolves theme-aware colors for components · `hooks/use-theme-color.ts`

### Data

Firebase client integration

- [Firebase](https://github.com/yaviracjorge/crud-react-native/blob/main/database/firebase.js): client SDK · Client-side persistence and backend integration · `database/firebase.js`

### Other components

- [Images](https://github.com/yaviracjorge/crud-react-native/tree/main/assets/images): asset folder · Static image assets · `assets/images`

## Connections

- App shell → Tabs: mounts · Root layout renders the tab navigator
- Tabs → Create user: routes · Tabs expose the create user screen
- Tabs → User view: routes · Tabs expose the user view screen
- Create user → Form: uses · Create-user screen is built from the shared form container
- Create user → useUsers: mutates · Submission flows through the domain hook
- Create user → Create model: shapes · Screen follows the create-user interface contract
- User view → User card: renders · User list is presented as cards
- User view → useUsers: reads · Screen consumes user state from the domain hook
- User view → Show model: shapes · Screen follows the show-user interface contract
- Form → Input: composes · Form uses reusable input control
- Form → Switch: composes · Form includes boolean field control
- Form → Calendar: composes · Form includes date field control
- Form → Button: composes · Form uses shared action button
- useUsers → Firebase: persists · Hook reads and writes user data through Firebase
- useUsers → User card: feeds · Hook supplies records for user presentation
- Theme provider → Global style: applies · Theme provider wires shared styling
- Theme provider → Color style: applies · Theme provider supplies palette values
- Theme provider → Theme tokens: configures · Theme provider relies on shared tokens
- Color scheme → Theme color: supports · Scheme selection feeds theme color resolution
- Theme color → Color style: resolves · Theme color hook maps to palette values
- Color scheme → Theme provider: drives · System scheme influences app theme context
- Theme provider → Create user: styles · Theme context affects screen presentation
- Theme provider → User view: styles · Theme context affects screen presentation
- Theme provider → Form: styles · Theme context affects shared form UI
- Theme provider → User card: styles · Theme context affects card presentation
- Images → Create user: supports · Static assets are available to the app surface
