How juancomparan/diabetesapp works
Project Overview and Type
• DiabetesApp is a mobile application focused on providing quick, accessible, and informative content about diabetes, including educational information, diet recommendations, treatments, and diagnostic guidelines.
• The project is structured as a full-stack application with two main parts: a mobile frontend built using React Native (with Expo) and a backend service built using Node.js with Express and SQLite as the database.
File Structure
a. Frontend (DiabetesAppFrontEnd):
• Contains mobile app assets, configuration files (app.json, babel.config.js, etc.) and source code primarily found in the "app/src" directory.
• The "app/src" subdirectories include:
• auth: Screens and components related to user authentication, diagnosis, and information pages (like Login, Registro, VerificationCode, ChatBot, etc.).
• components: Reusable UI components (InputComponent, OptionInputComponent, TopBar, TablaDieta) that form the building blocks of the mobile interface.
• home: Screens for general entry points (ForgetPassword, Welcome, etc.).
• Assets such as fonts and images are organized under an assets directory.
b. Backend (DiabetesAppBackEnd):
• Uses Express with the main application logic starting in “src/app.js” and “src/server.js” where the server is initialized.
• Folders include:
• controller: Contains controllers such as authController.js that handle business logic.
• routes: Defines API endpoints (e.g., authRoutes.js).
• middlewares: Houses middleware such as authValidator.js, ensuring security and validation.
• db: Connection logic to SQLite (db.js).
• Additional configuration files include a Dockerfile and .dockerignore, indicating containerization support.
Key Architectural Components
a. Mobile Frontend:
• User Interface (React Native screens) organized into authentication, home, and informational content.
• Input components and navigation routing (e.g., using Root Stack for screen transitions).
b. Backend Server:
• Express server handling HTTP requests from the mobile app.
• Routing layer, controllers, and middlewares for processing business logic and validation.
• Database layer interfacing with SQLite.
c. Communication Between Frontend and Backend:
• API calls from React Native app (via endpoints defined in authRoutes.js and others).
d. Containerization:
Important Architectural Patterns and Principles
• Separation of Concerns: Clear division between frontend (client-side) and backend (server-side) functionalities.
• API Layer: The mobile app communicates with the backend through RESTful API endpoints.
• Modularity & Reusability: Both frontend and backend are broken into modular components (controllers, routes, middleware for backend; separate screens and UI components for frontend).
• Possibly MVC-esque pattern in the backend where controllers, routes, and database management are distinctly separated.