How adala-wanyande/afya-one works
Project Type and Purpose
• Afya One is a full-stack, single-page health & fitness tracking application built with React on the front end, and Firebase services (Authentication, Firestore, Cloud Functions) as its back end.
• Its main purpose is to let users sign up/in, record workouts, nutrition, and weight entries, and view a dashboard with interactive charts and contribution graphs.
File Structure
• Top-level: package.json, public/ (static HTML, manifest, robots.txt), src/ (React code), firebase-config.js, src/functions/auth.js (Cloud Functions).
• src/components/ and src/pages/ reflect a component-driven UI organized by feature area (auth, dashboard, nutrition, training, user, weight, workout).
• src/lib/utils.js is a shared utility layer.
• Tailwind config, CSS input/output files, and component JSON hint at theming and design system usage.
README for Additional Insights
• Confirms technology stack: React, React Router, Tailwind CSS, Chart.js, react-github-contribution-calendar, Firebase Auth & Firestore.
Main Components & Interactions
a. Presentation Layer (Client/Browser)
• index.html → index.js → App.js → React Router → pages & UI components
• UI library: Tailwind CSS + custom components (buttons, alerts, table, calendar, nav menu, popover)
b. Service Layer (API/Business Logic)
• firebase-config.js orchestrates Auth, Firestore, Storage
c. Data Layer
• Collections: users, workouts, nutrition, weightEntries
d. External Libraries/Services
• Chart.js for charts
• react-github-contribution-calendar for contribution graph
e. Hosting & Delivery
• Static hosting (Firebase Hosting / any CDN) serving public/index.html and bundled JS/CSS
Architectural Patterns & Design Principles
• Component-driven UI: each feature under src/pages + reusable components in src/components/ui
• Separation of concerns: presentation (React), services (Firebase SDK), data storage (Firestore)
• Service abstraction: all Firebase calls centrally configured in firebase-config.js and wrapped by utility functions in src/lib/utils.js
• Responsive design with Tailwind CSS utility classes