How code4life-labs/dongnai-travel works
Main Components
• UI / Presentation Layer:
– Screens: Organized under the app/screens folder (e.g., HomeScreen, BlogsScreen, MapScreen, ChatBotScreen, etc.)
– Navigators: Under app/navigations, showing navigation groups (auth, home, blogs, chatbot, explore, etc.)
– Components: Reusable UI components (buttons, headers, lists, charts, etc.) in app/components.
– Assets & Animations: Illustrate the media resources (images, animations, fonts) that enrich the UI.
• State Management & Business Logic:
– Redux Store: Representing overall state management with slices (blogs, user, notifications, settings, theme, etc.) in app/redux.
– Custom Hooks and HOCs: Found under app/customHooks and app/hocs, illustrate how UI components tap into business logic.
– Global styles and utilities (in app/globals and app/utilities).
• API Integration Layer:
– REST APIs: Highlight the axios-based modules in app/apis/axios that handle blog CRUD operations, class-related APIs, and others. Clearly denote endpoints such as blog/get, blog/post, and blog/delete.
– Authorized API Instances: Note the use of authorizedAxiosInstance (in app/axios) to manage secure API calls.
• Shared/Reusable Libraries:
• External Services / Back-End Integration:
– External APIs: Represent services such as Google API, Cloudinary, and GPT integrations (for the Travel Bot functionality).
– Databases: Although not directly in the file tree (backend isn’t part of this codebase), note the integration with MongoDB as mentioned in the README.
Relationships & Interactions
• UI Components and Screens:
• Navigation Layer:
• Redux & Custom Hooks:
– Illustrate the flow of data from components → custom hooks/Redux actions → API integration, and then the Redux state updates reflecting on the UI.
• API Modules:
– Show connections between the mobile code (axios modules and socket modules) and the external backend services.
• Shared Libraries:
– Place these as utility blocks that connect with various UI components (for example, the “mark-format” library used in blog text formatting).
Architectural Patterns & Design Principles
• Component-Based Architecture: With a clear separation between reusable UI components and screen containers.
• Separation of Concerns: Distinct directories for navigators, state (Redux), API integrations, hooks, and utilities.
• Data Flow: Unidirectional data flow through Redux, integrating with asynchronous interactions via axios and real-time socket communications.
• Modularization: The API folder is neatly organized by domain (blog, class, etc.), while the libraries folder highlights separate concerns (formatting, mappings, charting).