How briansittmann/caloria_sdk53 works
Project Type and Purpose
• This is a mobile full-stack application (“CalorIA”) built with React Native (Expo SDK 53) for nutritional coaching.
• Its purpose is to let users log meals, automatically calculate macronutrients, receive AI-driven recommendations, and sync data in real time with a Spring Boot backend.
File Structure
– Top level
• app.json, package.json, App.js / index.js (entry points)
• assets/ (static images/fonts)
– src/
• components/ (reusable UI: buttons, cards, spinners)
• screens/ (full-screen views: Home, Login, ProfileWizard, Diary, Recipes, Modals)
• navigation/ (navigators & stacks for onboarding, auth, main app flow)
• context/ (React Contexts: AuthContext, MacrosContext for global state)
• services/ (API clients: authService, foodService, macrosService, recipeService, registerService)
• config/api.js (base URLs, endpoints)
– Configuration files for Expo, ESLint/.gitignore, node modules, etc.
README for Additional Insights
• Confirms React Native + Expo front end, Axios for HTTP calls, React Navigation for routing, Context API for state.
• Notes real-time sync with a Spring Boot backend that handles authentication, data storage, business logic, and AI food analysis.
Diagramming the Architecture
a. Main Components
• Mobile App (React Native)
– UI Layer: screens & components
– State Layer: React Contexts
– Networking Layer: services using Axios → REST API
• Backend (Spring Boot)
– Authentication Service
– Macronutrient Analysis & Business Logic
– Data Layer (e.g., PostgreSQL / MongoDB)
• External AI Service (could be a third-party or custom microservice for food image/ingredient analysis)
• Persistent Storage (Database)
b. Relationships & Interactions
• UI triggers actions → Context updates state → calls service → Axios HTTP request → Spring Boot REST endpoint → database or AI service → response back to app → Context updates UI.
• Auth flow: Login/RegisterScreen → authService → token stored in AuthContext → used in headers for protected routes.
• Navigation flows between welcome, auth wizards, and main app screens.
c. Architectural Patterns & Principles
• Layered architecture (Presentation, State, Network, Backend services, Data)
• Separation of concerns: components vs. screens vs. services vs. context
• Single source of truth for global state (Context API)
• Declarative UI with React Native
d. Key Technologies & Libraries
• Frontend: React Native (Expo), React Navigation, Context API, Axios
• Backend: Spring Boot (REST), Database (SQL/NoSQL)
• External Services: AI/ML food analysis