How saran-ex/baymax-bloom works
1. Top-level shape
- This is a two-part repo: a React/Vite frontend at the root and a separate Node backend under backend/.
- The app is structured like a single-page experience with a distinct API service for conversation/AI features.
2. Frontend runtime
- The frontend is built with TypeScript + React + Vite.
- Entry points are src/main.tsx and src/App.tsx, with route/page organization under src/pages/.
- Pages include HomePage, LoginPage, Index, and NotFound, suggesting client-side navigation and a fallback route.
3. UI composition layer
- The visual system is heavily componentized:
- Custom scene/character components: BaymaxScene.tsx, BaymaxFace.tsx, NavLink.tsx
- A large src/components/ui/ library of shadcn-style primitives (button, dialog, sheet, tabs, toast, etc.)
- This indicates the UI is assembled from reusable primitives rather than a monolithic page implementation.
4. Presentation and animation assets
- Static assets live in public/, including public/videos/baymax-bg.mp4.
- The naming of Baymax* components and the video asset suggests the frontend includes a character-driven or animated landing experience as part of the user interface.
5. Frontend state and utility boundaries
- Shared client helpers live in src/lib/utils.ts.
- Cross-cutting hooks are isolated in src/hooks/, including mobile detection and toast state.
- This separates reusable UI behavior from the page and component layers.
6. Backend service boundary
- The backend is isolated in backend/ and likely runs as a separate Express-style API server.
- backend/server.js and backend/src/app.js imply a conventional server bootstrap + app composition split.
- This backend is the boundary for server-side integration work rather than general page rendering.
7. Chat/conversation API subsystem
- The backend’s main domain appears to be chat:
- src/routes/chatRoutes.js
- src/controllers/chatController.js
- src/prompts/
- This suggests a request flow of: client submits message → route/controller handles it → prompt logic is assembled → AI response is returned.
8. LLM integration
- backend/src/config/gemini.js is the key integration point for Google Gemini or a Gemini-compatible API.
- Prompts are separated into stellaPrompt.js and conversationTopics.js, which indicates prompt engineering is treated as application logic, not embedded directly in the controller.
- The backend is therefore acting as an LLM orchestration layer between the UI and the model API.
9. Backend support concerns
- backend/src/utils/logger.js indicates centralized server logging.
- backend/.env shows the backend relies on environment-based configuration, likely for API keys and runtime settings.
- This keeps secrets and provider configuration out of the frontend bundle.
10. Data flow across the system
- The likely end-to-end path is:
- User interacts with the frontend character/chat UI
- Frontend sends a request to the backend chat route
- The controller builds or selects a prompt context
- The Gemini config/client sends the model request
- The backend returns the generated response
- The UI renders the response and any associated visual feedback
- The main architectural boundary is browser UI vs. server-side AI orchestration.
11. Tooling and build system
- Frontend tooling: Vite, TypeScript, Tailwind CSS, shadcn-ui.
- Testing: Vitest with setup files under src/test/.
- Code quality/configuration is managed through eslint.config.js, tailwind.config.ts, and multiple tsconfig files.
- This supports a modern frontend build pipeline with separate app/node TypeScript configurations.
12. Repository-level implications for diagramming
- A good architecture diagram should show:
- A React frontend consuming local UI components and static assets
- A Node/Express backend API
- A distinct chat/LLM integration path through Gemini
- Prompt assets and logging as backend support modules
- The diagram should emphasize that the backend is not a generic CRUD service; it is specifically an AI chat orchestration service behind the frontend.
Main entry points: App.tsx App · chatController.js Chat Controller · Index.tsx Pages · HomePage.tsx Home
Components 20
Frontend
React/Vite single-page app and UI system
- Entry · Starts the React app
src/main.tsx - App · Top-level client composition
src/App.tsx - Pages · Client-side page views
src/pages/Index.tsx - Home · Primary landing experience
src/pages/HomePage.tsx - Login · Sign-in flow
src/pages/LoginPage.tsx - Not Found · 404 route handler
src/pages/NotFound.tsx - Baymax Scene · Character-driven visual scene
src/components/BaymaxScene.tsx - Baymax Face · Character facial presentation
src/components/BaymaxFace.tsx - Nav Link · Reusable navigation element
src/components/NavLink.tsx - UI Primitives · Reusable component kit
src/components/ui/button.tsx - Hooks · Shared client behavior
src/hooks/use-mobile.tsx - Utils · Shared frontend utilities
src/lib/utils.ts - Video Asset · Background animation media
public/videos/baymax-bg.mp4
Backend
Node API and LLM orchestration
- Server · Backend process entry
backend/server.js - API App · Builds the backend application
backend/src/app.js - Chat Routes · Chat endpoint wiring
backend/src/routes/chatRoutes.js - Chat Controller · Handles chat requests
backend/src/controllers/chatController.js - Gemini Client · Model provider integration
backend/src/config/gemini.js - Prompts · System and topic prompts
backend/src/prompts/stellaPrompt.js - Logger · Centralized backend logging
backend/src/utils/logger.js
Connections 19
- Entry → App: mounts · Bootstraps the root app
- App → Pages: navigates · Selects page views
- Pages → Home: includes · Landing route
- Pages → Login: includes · Auth route
- Pages → Not Found: includes · Fallback route
- Home → Baymax Scene: uses · Composes the character scene
- Baymax Scene → Baymax Face: renders · Character face component
- Home → Nav Link: uses · Navigation links
- Home → UI Primitives: builds with · Uses shared UI primitives
- App → Hooks: uses · Shared client behavior
- App → Utils: uses · Utility helpers
- Baymax Scene → Video Asset: plays · Background media asset
- Server → API App: starts · Loads backend app
- API App → Chat Routes: registers · Attaches chat routes
- Chat Routes → Chat Controller: dispatches · Forwards chat requests
- Chat Controller → Prompts: assembles · Builds prompt context
- Chat Controller → Gemini Client: calls · Invokes the model provider
- Chat Controller → Logger: logs · Records server activity
- App → Chat Controller: requests AI · Frontend chat flow reaches backend API