How blackhat955/wellness-tracking works
Project Type and Purpose
• From the file tree and README, this is a React single-page application (SPA) written in JavaScript, built and served by Node.js (npm start).
• The application, “WellnessTrackingSystem,” provides user authentication (login, registration, password reset, OTP), user and admin dashboards, workout plan browsing, chat-bot support, and analytics (line bars, donuts, class graphs).
File Structure Analysis
• Top Level
• public/ : static HTML (index.html) and meta files (manifest.json, robots.txt).
• src/ : all React code – entry point (index.js, App.js), global styles (index.css, App.css), and Web Vitals/test setups.
• src/components/ : reusable UI components grouped by feature (authentication flows, navigation bars, charts, cards, chatbot).
• src/pages/ : route-level containers that assemble components into full screens (loginPage, registrationPage, adminPage, userProfile, workoutPlans, etc.).
• src/assets/ : static images and professional’s data.
• src/connection.js : likely API client setup (Axios or fetch wrapper).
Architectural Patterns & Tech Stack
• Component-based front-end (React) with React Router for page navigation.
• CSS modules or scoped styles alongside each component/page.
• A single HTTP API layer (connection.js) for communicating with a back-end server (not in repo).
• Charts and visualizations (Linebar, Donut, ClassGraph) as domain-specific child components.
• State management is likely local to components or via context/hooks (no redux folder).
Main Components
a. Client-Side React SPA
• Entry & Routing: index.js → App.js → React Router → src/pages
• UI Components: grouped into Authentication, Navigation, Dashboard, Analytics, Chatbot, Cards
• Static Assets: images, manifest, robots.txt
b. API Layer
• connection.js: HTTP client configured with base URL, interceptors for auth token
c. External Services (not in repo but implied)
• Authentication Service (e.g., /auth/login, /auth/register, /auth/otp)
• Data Service / RESTful Endpoints (e.g., /users, /workouts, /analytics)
d. Database
• Underlying persistent store (e.g., MongoDB, PostgreSQL) accessed by back end
e. Hosting & CDN
• Node.js process hosting the SPA (Heroku, Vercel, AWS S3 + CloudFront)
Relationships and Data Flows
• Browser → React SPA: initial page load (HTTP GET)
• SPA → API Server: REST calls via connection.js for authentication, data fetch, analytics
• API Server → Database: queries and mutations
• SPA ←→ External Services: (e.g., OAuth provider, email/OTP service, analytics)
Architectural Patterns & Principles
• Layered Architecture:
• Presentation Layer (React UI)
• API Client Layer (connection.js)
• Service Layer (Back-end controllers & business logic)
• Persistence Layer (Database)
• Component Reuse & Separation of Concerns: UI split into pages vs. reusable components
• Single Responsibility: each page/component handles one feature (e.g., register.js, chat.js)
• Scalability: adding new features by dropping in new components/pages