How longhainguyen/mobile works
Main Components
• Client (Mobile Application):
• User Interface components (various screens/pages like Home, Login, Register, Account, Post, Search, Location, Inform, etc.).
• API layer which is organized in the “client/api” folder containing endpoints for auth, post, comments, search, etc.
• State management through Redux.
• Navigation & Route management.
• Configurations for themes, fonts, and request handling.
• Static assets (images, fonts, videos) and reusable components (alerts, buttons, modals, etc.).
• Server (Backend Application):
• Server Bootstrapping (main.ts, Nest CLI config).
• Core modules:
• Auth Module: Handles authentication (login, register, forgot password) with controllers, DTOs, guards, and strategies (access token strategy using JWT).
• Post Module: Handles creation, editing, and interactions (comments, likes, sharing) for posts.
• User Module: Manages user profiles, following, and user-specific actions.
• Gateway Module: Likely used for real-time notifications, which may involve WebSocket integration.
• Configurations: Database configuration via TypeORM (typeorm.config.ts), JWT settings, Cloudinary configuration (for image and video storage).
• Entities: Defined inside “server/src/entities” representing Comment, Image, Like, Notification, Post, Profile, User, and Video.
• Shared Services: For common functions such as bcrypt hashing and integrations with third-party services (Cloudinary).
• Pipes and Guards: For input validation and authentication flow during API calls.
Relationships and Interactions
• The Client communicates with the Server using RESTful API calls defined in the “client/api” folder.
• The API endpoints in the Server map to the various domain areas:
• Authentication triggers the Auth Module controllers.
• Post creation, editing, and feed retrieval are processed by the Post Module.
• User management (registration, profile updates, following, etc.) is handled by the User Module.
• Real-time interactions (notifications, chat feedback, etc.) are facilitated through the Gateway Module.
• All server modules typically interact with a centralized database via TypeORM with entities modeling the social network objects.
• External integrations such as Cloudinary are used for handling media uploads.
Architectural Patterns and Design Principles
• The project follows a modular design (typical of NestJS) where each functional domain (auth, post, user, gateway) is encapsulated within its own module.
• Use of DTOs and guards in the server promotes clean API design and secure access control.
• Use of Redux in the client indicates unidirectional data flow, helping to manage state changes predictably.
• Separation of concerns is evident with a distinct front-end and back-end stack.
• Real-Time communication hints towards a layered approach where a dedicated gateway module handles persistent connections (possibly via websockets).
Technologies, Frameworks, and Libraries
• Client: React/React Native, Redux, Tailwind CSS (tailwind.config.js), and other UI libraries for components.
• Server: NestJS, TypeORM, JWT for authentication, Cloudinary for media storage, and associated testing frameworks (Jest for tests as seen in spec files).
• Additional integrations: Various utilities and configuration modules that ensure the communication between these layers is seamless.
Final Touches
• Use a diagramming tool that allows you to easily adjust and add components as the system evolves.