How lounguyen68/socially-app works
Main Components
• Mobile Application Framework:
• Overall app as a React Native mobile application.
• Native Android layer (contained in the “android” folder) that wraps the React Native code and handles native functionalities.
• User Interface Layer:
• Entry point file (App.tsx) that bootstraps the React Native app.
• UI components (found in the src/components directory) that include reusable building blocks (e.g., Avatar, Button, Header, etc.).
• Screen components (under src/screens such as login.screen.tsx, home.screen.tsx, conversation-detail.screen.tsx, etc.) that represent the distinct views of the application.
• Navigation modules (stored in src/navigation) that organize the app’s routing (e.g., auth.navigition.tsx, home.navigation.tsx, etc.).
• State Management and Context:
• Redux store and slices (found in src/redux, including chatRoomSlice.ts, conversationsSlice.ts, userSlice.ts) which manage global state.
• React Contexts (in src/context) such as Notification, Popup, Services, and Socket, managing side effects and global services.
• Business and API Integration Layer:
• API layer with endpoints (src/api) for actions like login, registration, creating conversations/messages, and refreshing tokens.
• Services layer (under src/services) that includes HTTP, chat, notification, storage, and upload services to encapsulate business logic and API communication.
• Helpers and constants (in src/helpers and src/constants) that assist with utility functions and configuration data.
Relationships and Data Flow
• User signaling via UI components (screens and components) triggers navigation events and Redux actions.
• Navigation components direct users through authentication, conversation, and profile flows.
• Redux and Context providers manage global state and side effects (such as real-time updates via sockets).
• API service calls (located in src/api and wrapped by services in src/services) facilitate data exchange with backend systems.
• The native integration on Android bridges the React Native app and native platform features (as seen in the android folder).
Architectural Patterns and Design Principles
• Modularization: The project is split into clear domains (UI, navigation, API, services, state management, etc.).
• Separation of Concerns: Each folder (components, screens, services, etc.) handles a specific responsibility.
• Unidirectional Data Flow: Data flows from UI components triggering actions, managed by Redux, and results from API calls update state that is reflected in the UI.
• Integration of Native and JavaScript Layers: The Android folder exists for handling native build configurations and platform-specific integrations.
Relevant Technologies and Frameworks
• React Native framework driving the mobile application.
• TypeScript for type checking (as indicated by .tsx and .ts files) and improved developer experience.
• Redux for state management.
• React Navigation for screen routing.
• Various API libraries (likely Axios or Fetch, wrapped within the services) for networking.
• Integration with native Android (with Gradle build files and Kotlin source files).
• From the UI to the navigation layer and state management.
• From Redux/contexts to API services.
• Between API services and external backend systems.
• A different style for business logic (Redux, Context, Services).
• Connectors or notes highlighting key patterns (separation of concerns, modularization, unidirectional data flow).
• The native Android container integrating React Native.
• The React Native front-end divided into components, screens, and navigation.
• State management via Redux and context providers.
• API and services layers handling communications with external systems.