How rajdip019/booklee works
Main Components
• Frontend UI Layer:
– Represented by the “pages” directory and its many view components (e.g., pages/index.js, pages/aboutus, pages/browsebooks, etc.).
– Client-side components (under pages/components) such as Navbar, Footer, various ProductCards, modals, and interactive maps.
– Navigation pages for authentication (pages/auth), profile management (pages/profile), book listing (pages/ListBookForSelling, pages/ListBookForDonating), search functionalities, etc.
• Backend API Layer:
– API endpoints located under “pages/api” handle functionalities including authentication (pages/api/auth/[...nextauth].js), book operations (add, delete, edit for donatebook, sellbook, etc.), user operations, reporting issues, handling contact and messages.
– Specialized endpoints for filtering, email notifications, and integration with third-party services.
• Database Layer:
– The “database” directory includes connection logic (connectionDB.js) and models stored in “database/models” for different entities such as users, books (donatebook, donatedbook, sellbook, soldbook) and donation proofs.
• Authentication & External Services:
– Third-party authentication is enabled (Google, Twitter, Github) integrated via NextAuth.
– There might also be integrations for sending emails and showing interactive maps (for NGO locations) as described in the README.
• Configuration & Environment:
– Files like .env.example, next.config.js, and package.json indicate environmental setups and project configurations.
– Build and deployment configurations are managed via GitHub Actions workflow files found under .github/workflows.
Relationships and Interactions
• The Frontend interacts with the Backend via API calls, both for reading data (browsing books, profiles) and for creating/modifying resources (listing books for sale/donation, managing orders, generating invoices).
• The Authentication component is integrated into both the frontend and the backend (using pages/api/auth) to manage user sessions and data.
• The Database layer supports CRUD operations for the business models. The API routes use these models to fetch and update data.
• External services (OAuth providers for authentication, email services for notifications, and mapping services for NGO locations) have defined entry points in the application.
Architectural Patterns and Technologies
• Next.js for the full-stack approach which combines server-side rendering, static generation, and API routes.
• MVC-like separation:
– “Models” under the database directory represent the Data Model,
– “Views” are the pages/components that the user interacts with,
– “Controllers” are the API endpoints that manage business logic.
• Use of modular design by separating functionalities into logical directories (e.g., pages for routing, components for UI elements, helpers for utility functions).
• Authentication is managed using NextAuth which provides middleware and session management with a focus on OAuth flows.
Final Checklist
– Include clearly labeled components: Frontend UI (pages & components), Backend API (API routes), Database (models), Authentication (NextAuth), and External Services.
– Be detailed: Capture every key module (e.g., separate endpoints for donate vs. sell functionality, admin panels, favorites, messaging, etc.) without overcomplicating the layout.