# mohamedabdelmoniemsaeed/games architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedabdelmoniemsaeed/games
- Repository: https://github.com/mohamedabdelmoniemsaeed/games

## Overview

Green Valley Farm (Farmly) is a bilingual farm-management web app, with an interactive farm-game experience as the entry point evidenced by the sampled runtime. The entry workflow mounts game state, displays the game shell, and lets users manage plots, livestock, orders, quests, and shop activity. A separate management UI represented in the README and source tree covers farm operations, weather, harvest planning, analytics, and profiles through FarmContext. Its connection to the entry shell is not shown, so it is kept as a distinct branch. Relationships are limited to README statements and SOURCE INDEX references; unsampled internals are not assumed.

Main entry points: [`src/game/GameContext.tsx`](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/game/GameContext.tsx) (Game state), [`src/context/FarmContext.tsx`](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/context/FarmContext.tsx) (Farm state), [`src/ui/Shell.tsx`](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/Shell.tsx) (Game shell), [`src/ui/FarmView.tsx`](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/FarmView.tsx) (Crop plots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_mount["React mount<br/>[main.tsx]"]
  node_app["App provider<br/>[App.tsx]"]
end

subgraph group_game["Farm game"]
  node_shell["Game shell<br/>[Shell.tsx]"]
  node_game_state["Game state<br/>[GameContext.tsx]"]
  node_farm_view["Crop plots<br/>[FarmView.tsx]"]
  node_animal_view["Livestock<br/>[AnimalsView.tsx]"]
  node_orders["Orders<br/>[OrdersView.tsx]"]
  node_quests["Quests<br/>[QuestsView.tsx]"]
  node_shop["Farm shop<br/>[ShopView.tsx]"]
  node_hud["Game HUD<br/>[Hud.tsx]"]
end

subgraph group_management["Farm management"]
  node_app_shell["Management shell<br/>[AppShell.tsx]"]
  node_auth["Sign-in screens<br/>[AuthScreens.tsx]"]
  node_farm_screen["Farm map<br/>[FarmScreen.tsx]"]
  node_home["Farm dashboard<br/>[HomeScreen.tsx]"]
  node_livestock_screen["Herd records"]
  node_weather["Weather advice<br/>[WeatherScreen.tsx]"]
  node_harvest["Harvest planner<br/>[HarvestScreen.tsx]"]
  node_analytics["Farm analytics"]
  node_profile["Farm profile<br/>[ProfileScreen.tsx]"]
  node_watering["Watering advice"]
  node_assistant["Farm assistant"]
  node_farm_map["Farm map widget<br/>[FarmMap.tsx]"]
end

subgraph group_shared["Shared state and UI"]
  node_farm_context["Farm state<br/>[FarmContext.tsx]"]
  node_locales["Translations<br/>[strings.ts]"]
  node_game_models["Game models<br/>[models.ts]"]
  node_game_constants["Game rules<br/>[constants.ts]"]
  node_game_sounds["Game sounds<br/>[sound.ts]"]
  node_common_ui["Shared game widgets<br/>[Common.tsx]"]
  node_infrastructure["Farm structures"]
  node_animal_sprites["Animal artwork<br/>[AnimalSprites.tsx]"]
  node_painters["Farm rendering<br/>[painters.tsx]"]
end

node_browser(("Farm user"))

node_browser -->|"opens app"| node_mount
node_mount -->|"renders"| node_app
node_app -->|"provides state"| node_game_state
node_app -->|"renders"| node_shell
node_shell -->|"reads state"| node_game_state
node_shell -->|"routes to"| node_farm_view
node_shell -->|"routes to"| node_animal_view
node_shell -->|"routes to"| node_orders
node_shell -->|"routes to"| node_quests
node_shell -->|"routes to"| node_shop
node_shell -->|"renders"| node_hud
node_game_state -->|"uses types"| node_game_models
node_game_state -->|"uses rules"| node_game_constants
node_game_state -->|"plays sounds"| node_game_sounds
node_farm_view -->|"reads state"| node_game_state
node_farm_view -->|"renders"| node_common_ui
node_farm_view -->|"renders"| node_infrastructure
node_farm_view -->|"renders with"| node_painters
node_animal_view -->|"reads state"| node_game_state
node_animal_view -->|"renders"| node_common_ui
node_animal_view -->|"renders"| node_animal_sprites
node_animal_view -->|"renders"| node_infrastructure
node_orders -->|"reads state"| node_game_state
node_quests -->|"reads state"| node_game_state
node_shop -->|"reads state"| node_game_state
node_hud -->|"reads state"| node_game_state
node_mount -->|"provides state"| node_farm_context
node_app_shell -->|"reads state"| node_farm_context
node_app_shell -->|"renders"| node_assistant
node_auth -->|"reads state"| node_farm_context
node_farm_screen -->|"reads state"| node_farm_context
node_farm_screen -->|"renders"| node_watering
node_farm_screen -->|"renders"| node_farm_map
node_home -->|"reads state"| node_farm_context
node_home -->|"renders"| node_watering
node_home -->|"renders"| node_assistant
node_livestock_screen -->|"reads state"| node_farm_context
node_weather -->|"reads state"| node_farm_context
node_harvest -->|"reads state"| node_farm_context
node_analytics -->|"reads state"| node_farm_context
node_profile -->|"reads state"| node_farm_context
node_farm_context -->|"translates"| node_locales

click node_mount "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/main.tsx"
click node_app "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/App.tsx"
click node_shell "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/Shell.tsx"
click node_game_state "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/game/GameContext.tsx"
click node_farm_view "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/FarmView.tsx"
click node_animal_view "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/AnimalsView.tsx"
click node_orders "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/OrdersView.tsx"
click node_quests "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/QuestsView.tsx"
click node_shop "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/ShopView.tsx"
click node_hud "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/Hud.tsx"
click node_farm_context "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/context/FarmContext.tsx"
click node_app_shell "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/AppShell.tsx"
click node_auth "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/AuthScreens.tsx"
click node_farm_screen "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/FarmScreen.tsx"
click node_home "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/HomeScreen.tsx"
click node_livestock_screen "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/LivestockScreen.tsx"
click node_weather "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/WeatherScreen.tsx"
click node_harvest "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/HarvestScreen.tsx"
click node_analytics "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/AnalyticsScreen.tsx"
click node_profile "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/ProfileScreen.tsx"
click node_watering "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/SmartWateringModal.tsx"
click node_assistant "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/FarmAssistantModal.tsx"
click node_locales "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/locales/strings.ts"
click node_game_models "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/game/models.ts"
click node_game_constants "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/game/constants.ts"
click node_game_sounds "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/game/sound.ts"
click node_common_ui "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/Common.tsx"
click node_infrastructure "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/FarmInfrastructure.tsx"
click node_animal_sprites "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/AnimalSprites.tsx"
click node_painters "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/painters.tsx"
click node_farm_map "https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/FarmMap.tsx"

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_mount,node_app,node_browser toneBlue
class node_shell,node_game_state,node_farm_view,node_animal_view,node_orders,node_quests,node_shop,node_hud toneAmber
class node_app_shell,node_auth,node_farm_screen,node_home,node_livestock_screen,node_weather,node_harvest,node_analytics,node_profile,node_watering,node_assistant,node_farm_map toneMint
class node_farm_context,node_locales,node_game_models,node_game_constants,node_game_sounds,node_common_ui,node_infrastructure,node_animal_sprites,node_painters toneRose
```

## Components

### Application entry

- [React mount](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/main.tsx): `src/main.tsx`
- [App provider](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/App.tsx): `src/App.tsx`

### Farm game

- [Game shell](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/Shell.tsx): `src/ui/Shell.tsx`
- [Game state](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/game/GameContext.tsx): `src/game/GameContext.tsx`
- [Crop plots](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/FarmView.tsx): `src/ui/FarmView.tsx`
- [Livestock](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/AnimalsView.tsx): `src/ui/AnimalsView.tsx`
- [Orders](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/OrdersView.tsx): `src/ui/OrdersView.tsx`
- [Quests](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/QuestsView.tsx): `src/ui/QuestsView.tsx`
- [Farm shop](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/ShopView.tsx): `src/ui/ShopView.tsx`
- [Game HUD](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/Hud.tsx): `src/ui/Hud.tsx`

### Farm management

- [Management shell](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/AppShell.tsx): `src/components/AppShell.tsx`
- [Sign-in screens](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/AuthScreens.tsx): `src/components/AuthScreens.tsx`
- [Farm map](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/FarmScreen.tsx): `src/components/FarmScreen.tsx`
- [Farm dashboard](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/HomeScreen.tsx): `src/components/HomeScreen.tsx`
- [Herd records](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/LivestockScreen.tsx): `src/components/LivestockScreen.tsx`
- [Weather advice](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/WeatherScreen.tsx): `src/components/WeatherScreen.tsx`
- [Harvest planner](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/HarvestScreen.tsx): `src/components/HarvestScreen.tsx`
- [Farm analytics](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/AnalyticsScreen.tsx): `src/components/AnalyticsScreen.tsx`
- [Farm profile](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/ProfileScreen.tsx): `src/components/ProfileScreen.tsx`
- [Watering advice](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/SmartWateringModal.tsx): `src/components/SmartWateringModal.tsx`
- [Farm assistant](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/FarmAssistantModal.tsx): `src/components/FarmAssistantModal.tsx`
- [Farm map widget](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/components/FarmMap.tsx): `src/components/FarmMap.tsx`

### Shared state and UI

- [Farm state](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/context/FarmContext.tsx): `src/context/FarmContext.tsx`
- [Translations](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/locales/strings.ts): `src/locales/strings.ts`
- [Game models](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/game/models.ts): `src/game/models.ts`
- [Game rules](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/game/constants.ts): `src/game/constants.ts`
- [Game sounds](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/game/sound.ts): `src/game/sound.ts`
- [Shared game widgets](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/Common.tsx): `src/ui/Common.tsx`
- [Farm structures](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/FarmInfrastructure.tsx): `src/ui/FarmInfrastructure.tsx`
- [Animal artwork](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/AnimalSprites.tsx): `src/ui/AnimalSprites.tsx`
- [Farm rendering](https://github.com/mohamedabdelmoniemsaeed/games/blob/main/src/ui/painters.tsx): `src/ui/painters.tsx`

### Other components

- **Farm user**

## Connections

- Farm user → React mount: opens app (evidence: `src/main.tsx`)
- React mount → App provider: renders (evidence: `src/main.tsx`)
- App provider → Game state: provides state (evidence: `src/App.tsx`)
- App provider → Game shell: renders (evidence: `src/App.tsx`)
- Game shell → Game state: reads state (evidence: `src/ui/Shell.tsx`)
- Game shell → Crop plots: routes to (evidence: `src/ui/Shell.tsx`)
- Game shell → Livestock: routes to (evidence: `src/ui/Shell.tsx`)
- Game shell → Orders: routes to (evidence: `src/ui/Shell.tsx`)
- Game shell → Quests: routes to (evidence: `src/ui/Shell.tsx`)
- Game shell → Farm shop: routes to (evidence: `src/ui/Shell.tsx`)
- Game shell → Game HUD: renders (evidence: `src/ui/Shell.tsx`)
- Game state → Game models: uses types (evidence: `src/game/GameContext.tsx`)
- Game state → Game rules: uses rules (evidence: `src/game/GameContext.tsx`)
- Game state → Game sounds: plays sounds (evidence: `src/game/GameContext.tsx`)
- Crop plots → Game state: reads state (evidence: `src/ui/FarmView.tsx`)
- Crop plots → Shared game widgets: renders (evidence: `src/ui/FarmView.tsx`)
- Crop plots → Farm structures: renders (evidence: `src/ui/FarmView.tsx`)
- Crop plots → Farm rendering: renders with (evidence: `src/ui/FarmView.tsx`)
- Livestock → Game state: reads state (evidence: `src/ui/AnimalsView.tsx`)
- Livestock → Shared game widgets: renders (evidence: `src/ui/AnimalsView.tsx`)
- Livestock → Animal artwork: renders (evidence: `src/ui/AnimalsView.tsx`)
- Livestock → Farm structures: renders (evidence: `src/ui/AnimalsView.tsx`)
- Orders → Game state: reads state (evidence: `src/ui/OrdersView.tsx`)
- Quests → Game state: reads state (evidence: `src/ui/QuestsView.tsx`)
- Farm shop → Game state: reads state (evidence: `src/ui/ShopView.tsx`)
- Game HUD → Game state: reads state (evidence: `src/ui/Hud.tsx`)
- React mount → Farm state: provides state (evidence: `src/main.tsx`)
- Management shell → Farm state: reads state (evidence: `src/components/AppShell.tsx`)
- Management shell → Farm assistant: renders (evidence: `src/components/AppShell.tsx`)
- Sign-in screens → Farm state: reads state (evidence: `src/components/AuthScreens.tsx`)
- Farm map → Farm state: reads state (evidence: `src/components/FarmScreen.tsx`)
- Farm map → Watering advice: renders (evidence: `src/components/FarmScreen.tsx`)
- Farm map → Farm map widget: renders (evidence: `src/components/FarmScreen.tsx`)
- Farm dashboard → Farm state: reads state (evidence: `src/components/HomeScreen.tsx`)
- Farm dashboard → Watering advice: renders (evidence: `src/components/HomeScreen.tsx`)
- Farm dashboard → Farm assistant: renders (evidence: `src/components/HomeScreen.tsx`)
- Herd records → Farm state: reads state (evidence: `src/components/LivestockScreen.tsx`)
- Weather advice → Farm state: reads state (evidence: `src/components/WeatherScreen.tsx`)
- Harvest planner → Farm state: reads state (evidence: `src/components/HarvestScreen.tsx`)
- Farm analytics → Farm state: reads state (evidence: `src/components/AnalyticsScreen.tsx`)
- Farm profile → Farm state: reads state (evidence: `src/components/ProfileScreen.tsx`)
- Farm state → Translations: translates (evidence: `src/context/FarmContext.tsx`)
