How letrungviet2005/vietnamjourney-fe works
Main Components
• Frontend Client:
• Built using React (the Create React App framework is used, as seen in “src” and “public”).
• Contains multiple pages (e.g., “ChienDich” for campaigns, “CongDong” for community posts, “Messenger” for chat, “TrangChu” for the home page, etc.), images, videos, and other static assets.
• Likely uses React Router for navigation among pages.
• Backend Server:
• Implemented in PHP, organized under the “Server” directory.
• Submodules include “ChienDich” (managing campaigns), “CongDong” (community posts), “TaiKhoan” (account related actions), and “User” (user interactions like comments, likes, and posting).
• Includes endpoints for CRUD operations on campaigns, posts, and user accounts.
• Contains common utility files such as “db_connect.php” suggesting a database integration.
• Database (Assumed):
• Although not explicitly shown in the file tree, the existence of “db_connect.php” implies there is a relational database (likely MySQL) on the backend to store and retrieve data supporting the functionalities.
Relationships and Interactions
• The Client (React front-end) communicates with the PHP backend by making HTTP/REST API calls to the various PHP endpoints.
• Each module in the “Server” (i.e., ChienDich, CongDong, TaiKhoan, User) provides specific functionalities. For example:
• Campaign-related pages in the frontend will send requests to PHP files like “CreateCampaign.php”, “UpdateCampaign.php”, “GetCampaign.php”, etc.
• User-related actions (comments, likes, following) on the client will interact with the corresponding PHP endpoint handlers.
• The backend interactions include data fetching, processing, and returning JSON responses (as seen from “text.json” and the PHP scripts’ naming patterns) that the frontend uses to update the UI.
• The database layer (though not shown in detail) sits behind the PHP modules and handles persistent storage for campaigns, users, comments, and other data.
Architectural Patterns and Design Principles
• Modularity & Separation of Concerns:
• The backend is organized by business domains (campaigns, community posts, user accounts), which makes it easier to manage and scale individual functionalities.
• The frontend is component-based (organized in “src/component”, “src/pages”) letting you apply separation between views, navigation (Navbar, Footer), and utilities (Cookies, ScrollToTop).
• API-driven Communication:
• Asset Management:
• The “public” folder holds static files (HTML, manifest, robots.txt, sample JSON for units, etc.) that are served by the client application.
Design Elements
• React <--> PHP endpoints (HTTP requests/responses)
• PHP endpoints <--> Database (data read/write operations)