How hoa-nguyen-bk/the_flying_bookstore_front_end works
Project Type and Purpose
• This is a full-stack web application built with Next.js, designed to serve both end users (bookstore visitors) and administrators (dashboard for managing book posts, orders, vouchers, etc.).
• The README and file structure also indicate that there is a separate backend (a Java/Gradle-based service deployed via Docker) which exposes API endpoints and handles core business logic, such as authentication, order processing, payment handling (with integration to external payment services like VNPay), and other services.
Main Components
a. Frontend Application (Next.js):
– Represent the Next.js server that handles rendering, routing, and client-side logic.
– Highlight key subdomains within the frontend:
• User-Facing Sections: Home page, search, detail pages, cart, checkout.
• Authentication Components: Login and sign-up flows.
• Policy pages, informational pages (privacy policies, book condition guides), and error-handling.
• Admin/Manager Section: Pages for managing posts, orders (both customer and seller orders), vouchers, profiles, etc.
– Include supporting client-side layers such as components (UI controls, forms, modals), hooks (for state and API calls), utilities (theme, config), and assets.
b. Backend API Service:
– Represent the Java-based backend service that the instructions indicate must be cloned and run separately.
– This component handles business logic, data persistence, authentication (possibly via endpoints like “/api/auth/loginService.tsx” and “/api/auth/registerService.tsx”), order management, and payment processing.
– Use Docker (as indicated by the local YAML configuration for containers, volumes, and images) as the deployment container and include a Gradle build process that produces the backend artifact.
c. External Services:
– Payment Gateway: Highlight integration with VNPay (as mentioned in the README for test payment data).
– Other potential external integrations (if applicable) like image services or voucher processing.
d. Data Stores:
– Although not directly visible in the file tree, show that the backend logically connects to a database system for storing books, orders, vouchers, and user profiles.
Relationships and Interactions
• Communication via API calls from the Next.js app to the backend service (Java/Gradle) for authentication, CRUD operations on books/posts, order creation, and payment.
• Calls or integrations from the backend to the External Payment Gateway.
• If applicable, indicate asynchronous operations or error-handling flows (for example, handling network errors via the “handleError” service in the API layer).
Important Architectural Patterns
• Next.js Routing and Folder-Based Dynamic Routing: This is evident in the file paths under src/app where various routes (e.g., nested folders for authentication and manager domains) clearly follow a modular scheme.
• Separation of Concerns (Frontend vs. Backend): The clear division between the client code (Next.js, components, hooks) and the backend service (Java, Docker, Gradle build).
• MVC/Layers within Frontend: Although Next.js abstracts much of this, the presence of organized components, hooks, and API services hints at an underlying model–view–controller (or component-driven) design.
• Modular services in the backend API: Each functionality such as authentication, checkout, book creation (in src/api/create) is encapsulated as separate modules/services.