How czerny40/fitness-web-app works
Project Type and Purpose
• This is a full-stack web application aimed at providing a comprehensive health and fitness management platform. It includes user management, Q&A, workout routines, partner matching, diet recommendation, real-time chat, and several other features.
• The README makes it clear that the project integrates a Spring Boot main backend with additional Python-based FastAPI and Flask servers for specialized functionality (partner matching and diet recommendation, respectively).
Analyzing the File Structure
• The top-level directories and files (e.g., src/main/java, src/main/resources) show that the project follows a standard Spring Boot (Java) structure.
• Inside the Java package (com.mysite.sbb), there are several domain-specific packages such as answer, chat, food, question, user, workout_tab, and custom modules like FitnessSearch and UserMatching. This indicates an MVC pattern usage with controllers, services, repositories, and domain models.
• The presence of configuration files (SecurityConfig, WebSocketConfig) and the Gradle build files reinforces the use of Spring Boot and its modular nature.
• The additional folders for static resources (CSS, JS, images, fonts) and templates (Thymeleaf HTML files) indicate a rich client-side layer integrated with server-side rendering.
Key Components in the System
a. Client (Web):
• Web UI built with HTML/CSS/JavaScript and Thymeleaf templates, providing pages for login, signup, Q&A, workout routines, diet recommendations, and live chat.
b. Main Backend – Spring Boot Server:
• Handles core business logic, user authentication (including OAuth2), and serves as the REST API for the client.
• Contains separate modules for handling answers, questions, messaging, chat (WebSocket), workout management, and more.
• Uses Spring Data JPA for persistence with a MySQL database.
c. External/Additional Servers:
• FastAPI Server: Dedicated to the exercise partner matching functionality.
• Flask Server: Manages customized diet recommendations integrating with an external nutrition database.
d. Database:
• MySQL is used by the main Spring Boot application and likely by the additional servers as well.
e. Security and Communication:
• Spring Security with OAuth2.0 for authentication.
• WebSocket configured via STOMP for real-time chat.
• Data encryption (AES) is handled in messaging, and BCrypt is used for password encoding.
Relationships and Interactions
• The client communicates with the Spring Boot backend using HTTP/REST for standard page rendering, CRUD operations, and API calls.
• The Spring Boot server interacts with:
– A MySQL database (persistence layer) to store various data (users, Q&A posts, workout routines, etc.).
– FastAPI server via HTTP/REST for partner matching requests.
– Flask server via HTTP/REST to get dietary recommendations.
• WebSocket connections are used to establish real-time chat sessions between clients and the server.
• Security components (filters and OAuth2 integrations) interact with the main backend to ensure secure access.
Architectural Patterns and Technologies Highlight
• MVC (Model-View-Controller) is adopted in many modules (e.g., question, answer, user modules).
• Microservices/Distributed integration pattern where the main Spring Boot server acts as an orchestrator that communicates with specialized Python-based services.
• Use of RESTful API design between components.
• Security is enforced using Spring Security and OAuth2.
• Real-time functionality provided by WebSocket with STOMP.
Final Detailed Steps for the Principal Software Engineer
• Branch out from the Spring Boot backend to the separate FastAPI and Flask servers to indicate inter-service communication.
– How the client makes REST calls and WebSocket connections,
– How the backend communicates with both the database and external services.
• Connections (e.g., API calls to FastAPI/Flask, security modules, and data encryption utilities) are annotated.