# dani-8/devgarden architecture

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

- Interactive diagram: https://gitdiagram.com/dani-8/devgarden
- Repository: https://github.com/dani-8/devgarden

## Overview

DevGarden is a multiplayer pixel-art greenhouse game. Players authenticate with GitHub, enter the game world, interact with other players and garden features, and earn progression from GitHub activity or coding challenges. The frontend combines React interface components with Phaser game scenes; an Express backend serves authentication and feature APIs, while Socket.IO/Supabase support multiplayer state and Supabase stores persistent data. The README documents major capabilities not fully sampled; links to those features are limited to documented or indexed relationships.

Main entry points: [`frontend/src/App.tsx`](https://github.com/dani-8/devgarden/blob/main/frontend/src/App.tsx) (App shell), [`backend/src/routes/authRoutes.ts`](https://github.com/dani-8/devgarden/blob/main/backend/src/routes/authRoutes.ts) (Auth routes), [`backend/src/routes/apiRoutes.ts`](https://github.com/dani-8/devgarden/blob/main/backend/src/routes/apiRoutes.ts) (Feature API), [`frontend/src/game/GameContainer.tsx`](https://github.com/dani-8/devgarden/blob/main/frontend/src/game/GameContainer.tsx) (Game container)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_auth_ui["Login UI<br/>[LoginView.tsx]"]
  node_sidebar["Sidebar profile<br/>[Sidebar.tsx]"]
  node_chat_ui["Chat and emotes<br/>[ChatBar.tsx]"]
  node_leaderboard_ui["Leaderboard<br/>[Leaderboard.tsx]"]
  node_profile_ui["Profile card<br/>[ProfileCard.tsx]"]
  node_challenge_ui["Challenge interface<br/>[ChallengeModal.tsx]"]
  node_decor_ui["Decor hotbar<br/>[DecorHotbar.tsx]"]
  node_collab_ui["Cafe boards"]
end

subgraph group_world["Game world"]
  node_game["Game container<br/>[GameContainer.tsx]"]
  node_cafe["Cafe scene<br/>[CodeCafeScene.ts]"]
  node_cafe_props["Cafe furnishings"]
  node_community_wing["Community wing"]
  node_cafe_interaction["Cafe interactions"]
  node_garden["Garden scene<br/>[GardenScene.ts]"]
  node_world_props["Garden props"]
  node_player_manager["Player rendering<br/>[PlayerManager.ts]"]
  node_star_tree["Sprout Tree<br/>[StarTreeManager.ts]"]
end

subgraph group_backend["Backend services"]
  node_auth_api["Auth routes<br/>[authRoutes.ts]"]
  node_api_routes["Feature API<br/>[apiRoutes.ts]"]
  node_ai_challenge["AI challenges<br/>[aiChallenge.ts]"]
  node_github["GitHub integration<br/>[githubService.ts]"]
  node_leveling["Level calculation<br/>[levelingService.ts]"]
  node_socket_server["Realtime server<br/>[socketServer.ts]"]
end

subgraph group_data["Persistence and integrations"]
  node_socket_client["Realtime client<br/>[SupabaseSocket.ts]"]
  node_db_client["Supabase client<br/>[client.ts]"]
  node_user_store[("User and sessions<br/>[users.ts]")]
  node_decoration_store[("Decorations<br/>[decorations.ts]")]
  node_community_store[("Community data<br/>[cafeCommunity.ts]")]
  node_tree_store[("Tree progression<br/>[starTree.ts]")]
end

node_player(("Gardener"))
node_supabase[("Supabase")]
node_github_service["GitHub OAuth/API"]
node_gemini["Gemini"]

node_player -->|"opens"| node_app
node_app -->|"renders"| node_auth_ui
node_app -->|"renders"| node_sidebar
node_app -->|"mounts"| node_game
node_app -->|"renders"| node_chat_ui
node_app -->|"renders"| node_leaderboard_ui
node_app -->|"renders"| node_profile_ui
node_player -->|"signs in"| node_auth_ui
node_auth_ui -->|"starts OAuth"| node_auth_api
node_auth_api -->|"exchanges code"| node_github
node_github -->|"requests stats"| node_github_service
node_auth_api -->|"calculates level"| node_leveling
node_auth_api -->|"saves user session"| node_user_store
node_auth_api -.->|"returns session"| node_app
node_app -.->|"offers challenges"| node_challenge_ui
node_challenge_ui -.->|"requests challenge"| node_api_routes
node_api_routes -->|"generates and verifies"| node_ai_challenge
node_ai_challenge -->|"uses model"| node_gemini
node_player -->|"plays"| node_game
node_game -.->|"hosts scene"| node_cafe
node_cafe -.->|"builds furnishings"| node_cafe_props
node_cafe_props -->|"creates wing"| node_community_wing
node_cafe -.->|"handles interaction"| node_cafe_interaction
node_game -.->|"hosts garden"| node_garden
node_garden -.->|"builds environment"| node_world_props
node_world_props -.->|"places tree"| node_star_tree
node_game -.->|"renders avatars"| node_player_manager
node_app -->|"connects multiplayer"| node_socket_client
node_socket_client -.->|"syncs realtime state"| node_socket_server
node_player -->|"chats"| node_chat_ui
node_player -->|"views rankings"| node_leaderboard_ui
node_player -.->|"shares projects"| node_collab_ui
node_player -.->|"customizes world"| node_decor_ui
node_api_routes -.->|"reads and writes"| node_community_store
node_api_routes -->|"reads and writes"| node_decoration_store
node_api_routes -->|"reads users"| node_user_store
node_socket_server -.->|"handles cafe data"| node_community_store
node_socket_server -.->|"handles decor data"| node_decoration_store
node_star_tree -.->|"persists growth"| node_tree_store
node_db_client -->|"connects"| node_supabase
node_user_store -.->|"uses client"| node_db_client
node_decoration_store -->|"uses client"| node_db_client

click node_app "https://github.com/dani-8/devgarden/blob/main/frontend/src/App.tsx"
click node_auth_ui "https://github.com/dani-8/devgarden/blob/main/frontend/src/components/auth/LoginView.tsx"
click node_sidebar "https://github.com/dani-8/devgarden/blob/main/frontend/src/components/layout/Sidebar.tsx"
click node_chat_ui "https://github.com/dani-8/devgarden/blob/main/frontend/src/components/chat/ChatBar.tsx"
click node_leaderboard_ui "https://github.com/dani-8/devgarden/blob/main/frontend/src/components/leaderboard/Leaderboard.tsx"
click node_profile_ui "https://github.com/dani-8/devgarden/blob/main/frontend/src/components/profile/ProfileCard.tsx"
click node_challenge_ui "https://github.com/dani-8/devgarden/blob/main/frontend/src/components/modals/ChallengeModal.tsx"
click node_decor_ui "https://github.com/dani-8/devgarden/blob/main/frontend/src/components/decor/DecorHotbar.tsx"
click node_collab_ui "https://github.com/dani-8/devgarden/blob/main/frontend/src/components/modals/CafeCollabModal.tsx"
click node_game "https://github.com/dani-8/devgarden/blob/main/frontend/src/game/GameContainer.tsx"
click node_cafe "https://github.com/dani-8/devgarden/blob/main/frontend/src/game/scenes/CodeCafeScene.ts"
click node_cafe_props "https://github.com/dani-8/devgarden/blob/main/frontend/src/game/cafe/CafePropsManager.ts"
click node_community_wing "https://github.com/dani-8/devgarden/blob/main/frontend/src/game/cafe/communityWing/CafeCommunityWing.ts"
click node_cafe_interaction "https://github.com/dani-8/devgarden/blob/main/frontend/src/game/scenes/cafe/CafeInteractionManager.ts"
click node_garden "https://github.com/dani-8/devgarden/blob/main/frontend/src/game/scenes/GardenScene.ts"
click node_world_props "https://github.com/dani-8/devgarden/blob/main/frontend/src/game/props/WorldPropsManager.ts"
click node_player_manager "https://github.com/dani-8/devgarden/blob/main/frontend/src/game/scenes/PlayerManager.ts"
click node_star_tree "https://github.com/dani-8/devgarden/blob/main/frontend/src/game/managers/StarTreeManager.ts"
click node_socket_client "https://github.com/dani-8/devgarden/blob/main/frontend/src/SupabaseSocket.ts"
click node_auth_api "https://github.com/dani-8/devgarden/blob/main/backend/src/routes/authRoutes.ts"
click node_api_routes "https://github.com/dani-8/devgarden/blob/main/backend/src/routes/apiRoutes.ts"
click node_ai_challenge "https://github.com/dani-8/devgarden/blob/main/backend/src/services/aiChallenge.ts"
click node_github "https://github.com/dani-8/devgarden/blob/main/backend/src/services/githubService.ts"
click node_leveling "https://github.com/dani-8/devgarden/blob/main/backend/src/services/levelingService.ts"
click node_socket_server "https://github.com/dani-8/devgarden/blob/main/backend/src/socket/socketServer.ts"
click node_db_client "https://github.com/dani-8/devgarden/blob/main/backend/src/db/client.ts"
click node_user_store "https://github.com/dani-8/devgarden/blob/main/backend/src/db/users.ts"
click node_decoration_store "https://github.com/dani-8/devgarden/blob/main/backend/src/db/decorations.ts"
click node_community_store "https://github.com/dani-8/devgarden/blob/main/backend/src/db/cafeCommunity.ts"
click node_tree_store "https://github.com/dani-8/devgarden/blob/main/backend/src/db/starTree.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_app,node_auth_ui,node_sidebar,node_chat_ui,node_leaderboard_ui,node_profile_ui,node_challenge_ui,node_decor_ui,node_collab_ui toneBlue
class node_game,node_cafe,node_cafe_props,node_community_wing,node_cafe_interaction,node_garden,node_world_props,node_player_manager,node_star_tree,node_supabase toneAmber
class node_auth_api,node_api_routes,node_ai_challenge,node_github,node_leveling,node_socket_server,node_github_service toneMint
class node_socket_client,node_db_client,node_user_store,node_decoration_store,node_community_store,node_tree_store toneRose
class node_player,node_gemini toneIndigo
```

## Components

### Client experience

- [App shell](https://github.com/dani-8/devgarden/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login UI](https://github.com/dani-8/devgarden/blob/main/frontend/src/components/auth/LoginView.tsx): `frontend/src/components/auth/LoginView.tsx`
- [Sidebar profile](https://github.com/dani-8/devgarden/blob/main/frontend/src/components/layout/Sidebar.tsx): `frontend/src/components/layout/Sidebar.tsx`
- [Chat and emotes](https://github.com/dani-8/devgarden/blob/main/frontend/src/components/chat/ChatBar.tsx): `frontend/src/components/chat/ChatBar.tsx`
- [Leaderboard](https://github.com/dani-8/devgarden/blob/main/frontend/src/components/leaderboard/Leaderboard.tsx): `frontend/src/components/leaderboard/Leaderboard.tsx`
- [Profile card](https://github.com/dani-8/devgarden/blob/main/frontend/src/components/profile/ProfileCard.tsx): `frontend/src/components/profile/ProfileCard.tsx`
- [Challenge interface](https://github.com/dani-8/devgarden/blob/main/frontend/src/components/modals/ChallengeModal.tsx): `frontend/src/components/modals/ChallengeModal.tsx`
- [Decor hotbar](https://github.com/dani-8/devgarden/blob/main/frontend/src/components/decor/DecorHotbar.tsx): `frontend/src/components/decor/DecorHotbar.tsx`
- [Cafe boards](https://github.com/dani-8/devgarden/blob/main/frontend/src/components/modals/CafeCollabModal.tsx): `frontend/src/components/modals/CafeCollabModal.tsx`

### Game world

- [Game container](https://github.com/dani-8/devgarden/blob/main/frontend/src/game/GameContainer.tsx): `frontend/src/game/GameContainer.tsx`
- [Cafe scene](https://github.com/dani-8/devgarden/blob/main/frontend/src/game/scenes/CodeCafeScene.ts): `frontend/src/game/scenes/CodeCafeScene.ts`
- [Cafe furnishings](https://github.com/dani-8/devgarden/blob/main/frontend/src/game/cafe/CafePropsManager.ts): `frontend/src/game/cafe/CafePropsManager.ts`
- [Community wing](https://github.com/dani-8/devgarden/blob/main/frontend/src/game/cafe/communityWing/CafeCommunityWing.ts): `frontend/src/game/cafe/communityWing/CafeCommunityWing.ts`
- [Cafe interactions](https://github.com/dani-8/devgarden/blob/main/frontend/src/game/scenes/cafe/CafeInteractionManager.ts): `frontend/src/game/scenes/cafe/CafeInteractionManager.ts`
- [Garden scene](https://github.com/dani-8/devgarden/blob/main/frontend/src/game/scenes/GardenScene.ts): `frontend/src/game/scenes/GardenScene.ts`
- [Garden props](https://github.com/dani-8/devgarden/blob/main/frontend/src/game/props/WorldPropsManager.ts): `frontend/src/game/props/WorldPropsManager.ts`
- [Player rendering](https://github.com/dani-8/devgarden/blob/main/frontend/src/game/scenes/PlayerManager.ts): `frontend/src/game/scenes/PlayerManager.ts`
- [Sprout Tree](https://github.com/dani-8/devgarden/blob/main/frontend/src/game/managers/StarTreeManager.ts): `frontend/src/game/managers/StarTreeManager.ts`

### Backend services

- [Auth routes](https://github.com/dani-8/devgarden/blob/main/backend/src/routes/authRoutes.ts): `backend/src/routes/authRoutes.ts`
- [Feature API](https://github.com/dani-8/devgarden/blob/main/backend/src/routes/apiRoutes.ts): `backend/src/routes/apiRoutes.ts`
- [AI challenges](https://github.com/dani-8/devgarden/blob/main/backend/src/services/aiChallenge.ts): `backend/src/services/aiChallenge.ts`
- [GitHub integration](https://github.com/dani-8/devgarden/blob/main/backend/src/services/githubService.ts): `backend/src/services/githubService.ts`
- [Level calculation](https://github.com/dani-8/devgarden/blob/main/backend/src/services/levelingService.ts): `backend/src/services/levelingService.ts`
- [Realtime server](https://github.com/dani-8/devgarden/blob/main/backend/src/socket/socketServer.ts): `backend/src/socket/socketServer.ts`

### Persistence and integrations

- [Realtime client](https://github.com/dani-8/devgarden/blob/main/frontend/src/SupabaseSocket.ts): `frontend/src/SupabaseSocket.ts`
- [Supabase client](https://github.com/dani-8/devgarden/blob/main/backend/src/db/client.ts): `backend/src/db/client.ts`
- [User and sessions](https://github.com/dani-8/devgarden/blob/main/backend/src/db/users.ts): `backend/src/db/users.ts`
- [Decorations](https://github.com/dani-8/devgarden/blob/main/backend/src/db/decorations.ts): `backend/src/db/decorations.ts`
- [Community data](https://github.com/dani-8/devgarden/blob/main/backend/src/db/cafeCommunity.ts): `backend/src/db/cafeCommunity.ts`
- [Tree progression](https://github.com/dani-8/devgarden/blob/main/backend/src/db/starTree.ts): `backend/src/db/starTree.ts`

### Other components

- **Gardener**
- **Supabase**
- **GitHub OAuth/API**
- **Gemini**

## Connections

- Gardener → App shell: opens
- App shell → Login UI: renders (evidence: `frontend/src/App.tsx`)
- App shell → Sidebar profile: renders (evidence: `frontend/src/App.tsx`)
- App shell → Game container: mounts (evidence: `frontend/src/App.tsx`)
- App shell → Chat and emotes: renders (evidence: `frontend/src/App.tsx`)
- App shell → Leaderboard: renders (evidence: `frontend/src/App.tsx`)
- App shell → Profile card: renders (evidence: `frontend/src/App.tsx`)
- Gardener → Login UI: signs in
- Login UI → Auth routes: starts OAuth
- Auth routes → GitHub integration: exchanges code (evidence: `backend/src/routes/authRoutes.ts`)
- GitHub integration → GitHub OAuth/API: requests stats
- Auth routes → Level calculation: calculates level (evidence: `backend/src/routes/authRoutes.ts`)
- Auth routes → User and sessions: saves user session (evidence: `backend/src/routes/authRoutes.ts`)
- Auth routes → App shell: returns session
- App shell → Challenge interface: offers challenges
- Challenge interface → Feature API: requests challenge
- Feature API → AI challenges: generates and verifies (evidence: `backend/src/routes/apiRoutes.ts`)
- AI challenges → Gemini: uses model
- Gardener → Game container: plays
- Game container → Cafe scene: hosts scene
- Cafe scene → Cafe furnishings: builds furnishings (evidence: `frontend/src/game/cafe/CafePropsManager.ts`)
- Cafe furnishings → Community wing: creates wing (evidence: `frontend/src/game/cafe/CafePropsManager.ts`)
- Cafe scene → Cafe interactions: handles interaction (evidence: `frontend/src/game/scenes/cafe/CafeInteractionManager.ts`)
- Game container → Garden scene: hosts garden
- Garden scene → Garden props: builds environment (evidence: `frontend/src/game/props/WorldPropsManager.ts`)
- Garden props → Sprout Tree: places tree
- Game container → Player rendering: renders avatars (evidence: `frontend/src/game/scenes/PlayerManager.ts`)
- App shell → Realtime client: connects multiplayer
- Realtime client → Realtime server: syncs realtime state
- Gardener → Chat and emotes: chats
- Gardener → Leaderboard: views rankings
- Gardener → Cafe boards: shares projects
- Gardener → Decor hotbar: customizes world
- Feature API → Community data: reads and writes (evidence: `backend/src/routes/apiRoutes.ts`)
- Feature API → Decorations: reads and writes (evidence: `backend/src/routes/apiRoutes.ts`)
- Feature API → User and sessions: reads users (evidence: `backend/src/routes/apiRoutes.ts`)
- Realtime server → Community data: handles cafe data
- Realtime server → Decorations: handles decor data
- Sprout Tree → Tree progression: persists growth
- Supabase client → Supabase: connects (evidence: `backend/src/db/client.ts`)
- User and sessions → Supabase client: uses client (evidence: `backend/src/db/index.ts`)
- Decorations → Supabase client: uses client (evidence: `backend/src/db/decorations.ts`)
