How iamvatsal/book-notes-webapp works
Project Overview
• This is a full-stack web application designed to manage book notes. It uses Node.js with Express on the backend, EJS for templating on the frontend, PostgreSQL as its database, and integrates authentication (both local and Google OAuth) using Passport.js.
• The application follows a loosely MVC-like pattern with clear separation between routing, controller (business logic), view (EJS templates), and static assets.
Main Components
a. Client/Browser Layer:
• Web Browser (User Interface): Representing how users interact with the application via HTML/CSS/JavaScript and EJS-rendered pages.
b. Server/Application Layer:
• Main Server (index.js): The central entry point for the Node.js/Express application.
• Controller Layer: Represent the controllers (books.controller.js, login.controller.js, etc.) that process the business logic and interact with both views and the database.
• Views Layer: Indicate the EJS templates in the views folder, outlining the rendering of pages for the client.
• Authentication Module: Highlight Passport.js usage for both local strategy and Google OAuth integration. This can be depicted as a subcomponent that intercepts requests (particularly those routed for login, signup, and logout).
c. Data/Database Layer:
• SQL Queries: A note or smaller component showing that queries.sql is used for the initial setup of these tables.
Relationships and Interactions
• The Routing Layer to the Controller Layer, which handles the logic.
• The Controllers to the Database Layer to perform CRUD operations.
• Also, illustrate that the Views are rendered by the controllers before sending HTML back to the client.
Architectural Patterns and Design Principles
• Separation of concerns (routing, control logic, presentation).
• Layered architecture where the presentation layer (views and static assets) is kept distinct from application logic (controllers/routes) and data access (PostgreSQL via db.js).
• Authentication as a cross-cutting concern managed via Passport.js.
Technologies and Frameworks
• Node.js with Express.js on the backend.
• PostgreSQL as the relational database.
• EJS templating for dynamic HTML.
• Static assets managed under the public directory.
• Passport.js for authentication.
• Additional libraries like Bootstrap for UI enhancement can also be indicated in the frontend section.