# yamakazeankk/appgreeniot architecture

> Architecture diagram of the GitHub repository yamakazeankk/appgreeniot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yamakazeankk/appgreeniot
- Repository: https://github.com/yamakazeankk/appgreeniot

## Overview

##### Project type and purpose
- This is a cross-platform Green IoT monitoring application built with React Native + Expo for mobile and Next.js for web (using the new App Router under `app/`).

##### File structure
- Top-level config:
- app.json + metro.config.js – Expo + Metro bundler setup for mobile
- babel.config.js, tsconfig.json, tailwind.config.js – build and styling configs
- Client code:
- app/ – Next.js web routes and layouts (`(auth)`, `(tabs)`, dynamic pages under `page/` and `grow/`)
- loginProfile/ – A standalone loginProfile component for mobile?
- Shared UI:
- components/ – All reusable UI pieces (cards, charts, modals, grids, chat interface)
- components/ui/ – Lower-level UI primitives (chat interface)
- State & logic:
- context/auth.tsx – React Context for auth state
- hooks/ – Custom hooks (`useWearther`, `useColorScheme`, etc.)
- Data & services:
- firebase.tsx – Firebase initialization (Auth, Firestore, Storage)
- data/data.ts – Static or seed data
- Assets & styling:
- assets/ – Fonts, images
- global.css + nativewind-env.d.ts – Tailwind styles and types

##### README for additional insights
- The README states “React Native + Expo,” instructs `npm install` and `expo start`.
- It outlines a conventional project split (assets, components, screens, navigation, constants, services). The actual tree uses Next.js for web routes (`app/`) and a mixture of “components” and “hooks.”

## Diagram (Mermaid)

```mermaid
graph TB
  %% Presentation Layer
  subgraph "Presentation Layer"
    subgraph "Mobile Client" 
      AppJSON["app.json"]:::mobile
      MetroConfig["metro.config.js"]:::mobile
      LoginProfile["loginProfile.tsx"]:::mobile
    end
    subgraph "Web Client"
      WC_Layout["_layout.tsx"]:::web
      WC_Index["index.tsx"]:::web
      subgraph "(auth)"
        Auth_Layout["_layout.tsx"]:::web
        Auth_Login["login.tsx"]:::web
        Auth_Register["register.tsx"]:::web
      end
      subgraph "(tabs)"
        Tabs_Layout["_layout.tsx"]:::web
        Tab_Dashboard["dashboard.tsx"]:::web
        Tab_Index["index.tsx"]:::web
        Tab_Notification["notification.tsx"]:::web
        Tab_Profile["profile.tsx"]:::web
      end
      subgraph "Pages"
        Page_ID["[id].tsx"]:::web
        Page_Edit["edit.tsx"]:::web
        Page_Grow["grow/[growSlug]/[slug].tsx"]:::web
      end
    end
  end

  %% Shared UI & Logic Layer
  subgraph "Shared UI & Logic Layer"
    Components["components/"]:::shared
    ChatUI["chat-interface.tsx"]:::shared
    AuthContext["context/auth.tsx"]:::shared
    Hook_Weather["useWearther.ts"]:::shared
    Hook_Color["useColorScheme.ts"]:::shared
    Hook_ColorWeb["useColorScheme.web.ts"]:::shared
    Hook_Theme["useThemeColor.ts"]:::shared
  end

  %% Data & Services Layer
  subgraph "Data & Services Layer"
    FirebaseInit["firebase.tsx"]:::data
    StaticData["data/data.ts"]:::data
    IconsConst["constants/icons.tsx"]:::data
    SensorConst["constants/sensor.tsx"]:::data
    AuthService[(Firebase Auth)]:::data
    Firestore[(Firestore)]:::data
    Storage[(Storage)]:::data
  end

  %% Assets & Static Files
  subgraph "Assets & Static Files"
    Fonts["assets/fonts/"]:::assets
    Images["assets/images/"]:::assets
    GlobalCSS["global.css"]:::assets
    TailwindConfig["tailwind.config.js"]:::assets
    Nativewind["nativewind-env.d.ts"]:::assets
  end

  %% Type Definitions
  subgraph "Type Definitions"
    WeatherType["types/weather.ts"]:::types
    ComponentsType["components/types.ts"]:::types
  end

  %% Connections
  AppJSON -->|bundles| MetroConfig
  MetroConfig -->|configures| LoginProfile
  LoginProfile -->|uses| AuthService
  WC_Layout -->|routes| WC_Index
  WC_Index -->|links| Auth_Layout
  Auth_Layout -->|routes| Auth_Login
  Auth_Layout -->|routes| Auth_Register
  WC_Layout -->|routes| Tabs_Layout
  Tabs_Layout -->|contains| Tab_Dashboard
  Tabs_Layout -->|contains| Tab_Index
  Tabs_Layout -->|contains| Tab_Notification
  Tabs_Layout -->|contains| Tab_Profile
  WC_Layout -->|routes| Page_ID
  WC_Layout -->|routes| Page_Edit
  WC_Layout -->|routes| Page_Grow

  %% Clients to Shared
  AppJSON -->|imports| Components
  LoginProfile -->|imports| AuthContext
  WC_Layout -->|imports| Components
  Auth_Login -->|uses| AuthContext
  Tab_Dashboard -->|uses| Hook_Weather
  Tab_Profile -->|uses| Hook_Color

  %% Shared to Data
  AuthContext -->|calls| AuthService
  Components -->|calls| Firestore
  Components -->|calls| Storage
  Hook_Weather -->|fetches| Firestore
  FirebaseInit -->|initializes| AuthService
  FirebaseInit -->|initializes| Firestore
  FirebaseInit -->|initializes| Storage
  StaticData -->|provides| Components
  IconsConst -->|usedBy| Components
  SensorConst -->|usedBy| Components

  %% Assets
  Components -->|imports| Fonts
  Components -->|imports| Images
  GlobalCSS -->|styles| Components
  TailwindConfig -->|config| Components
  Nativewind -->|types| Components

  %% Types
  Components -->|typedBy| ComponentsType
  Hook_Weather -->|typedBy| WeatherType

  %% Click Events
  click AppJSON "https://github.com/yamakazeankk/appgreeniot/blob/main/app.json"
  click MetroConfig "https://github.com/yamakazeankk/appgreeniot/blob/main/metro.config.js"
  click LoginProfile "https://github.com/yamakazeankk/appgreeniot/blob/main/loginProfile/loginProfile.tsx"
  click WC_Layout "https://github.com/yamakazeankk/appgreeniot/blob/main/app/_layout.tsx"
  click WC_Index "https://github.com/yamakazeankk/appgreeniot/blob/main/app/index.tsx"
  click Auth_Layout "https://github.com/yamakazeankk/appgreeniot/blob/main/app/(auth)/_layout.tsx"
  click Auth_Login "https://github.com/yamakazeankk/appgreeniot/blob/main/app/(auth)/login.tsx"
  click Auth_Register "https://github.com/yamakazeankk/appgreeniot/blob/main/app/(auth)/register.tsx"
  click Tabs_Layout "https://github.com/yamakazeankk/appgreeniot/blob/main/app/(tabs)/_layout.tsx"
  click Tab_Dashboard "https://github.com/yamakazeankk/appgreeniot/blob/main/app/(tabs)/dashboard.tsx"
  click Tab_Index "https://github.com/yamakazeankk/appgreeniot/blob/main/app/(tabs)/index.tsx"
  click Tab_Notification "https://github.com/yamakazeankk/appgreeniot/blob/main/app/(tabs)/notification.tsx"
  click Tab_Profile "https://github.com/yamakazeankk/appgreeniot/blob/main/app/(tabs)/profile.tsx"
  click Page_ID "https://github.com/yamakazeankk/appgreeniot/blob/main/app/page/[id].tsx"
  click Page_Edit "https://github.com/yamakazeankk/appgreeniot/blob/main/app/page/edit.tsx"
  click Page_Grow "https://github.com/yamakazeankk/appgreeniot/blob/main/app/page/grow/[growSlug]/[slug].tsx"
  click Components "https://github.com/yamakazeankk/appgreeniot/tree/main/components/"
  click ChatUI "https://github.com/yamakazeankk/appgreeniot/blob/main/components/ui/chat-interface.tsx"
  click AuthContext "https://github.com/yamakazeankk/appgreeniot/blob/main/context/auth.tsx"
  click Hook_Weather "https://github.com/yamakazeankk/appgreeniot/blob/main/hooks/useWearther.ts"
  click Hook_Color "https://github.com/yamakazeankk/appgreeniot/blob/main/hooks/useColorScheme.ts"
  click Hook_ColorWeb "https://github.com/yamakazeankk/appgreeniot/blob/main/hooks/useColorScheme.web.ts"
  click Hook_Theme "https://github.com/yamakazeankk/appgreeniot/blob/main/hooks/useThemeColor.ts"
  click FirebaseInit "https://github.com/yamakazeankk/appgreeniot/blob/main/firebase.tsx"
  click StaticData "https://github.com/yamakazeankk/appgreeniot/blob/main/data/data.ts"
  click IconsConst "https://github.com/yamakazeankk/appgreeniot/blob/main/constants/icons.tsx"
  click SensorConst "https://github.com/yamakazeankk/appgreeniot/blob/main/constants/sensor.tsx"
  click Fonts "https://github.com/yamakazeankk/appgreeniot/tree/main/assets/fonts/"
  click Images "https://github.com/yamakazeankk/appgreeniot/tree/main/assets/images/"
  click GlobalCSS "https://github.com/yamakazeankk/appgreeniot/blob/main/global.css"
  click TailwindConfig "https://github.com/yamakazeankk/appgreeniot/blob/main/tailwind.config.js"
  click Nativewind "https://github.com/yamakazeankk/appgreeniot/blob/main/nativewind-env.d.ts"
  click WeatherType "https://github.com/yamakazeankk/appgreeniot/blob/main/types/weather.ts"
  click ComponentsType "https://github.com/yamakazeankk/appgreeniot/blob/main/components/types.ts"

  %% Styles
  classDef mobile fill:#ADD8E6,stroke:#333,stroke-width:1px
  classDef web fill:#90EE90,stroke:#333,stroke-width:1px
  classDef shared fill:#F5DEB3,stroke:#333,stroke-width:1px
  classDef data fill:#FFB6C1,stroke:#333,stroke-width:1px
  classDef assets fill:#D3D3D3,stroke:#333,stroke-width:1px
  classDef types fill:#E0E0E0,stroke:#333,stroke-width:1px
```
