How mvazquezmartin/portfolio_vsc works
Main Components Identification
• Client-Side (Frontend):
• HTML/CSS/SASS Layout: The root HTML file, SASS styles, and assets (CSS files like dracula.css, main styles, PDFs, audio, fonts, etc.).
• JavaScript Components: Numerous custom components under src/public/js/components (account management, chat, bookmarks, GitHub, playground, file explorer, responsive scripts, etc.). These modules interact with UI elements and make API calls to the backend.
• Server-Side (Backend):
• API Server: The Express app defined in src/index.js that wires together controllers, middleware (e.g., for authentication and file uploads), and routers (in src/router/index.js).
• Controllers: Located in src/controller – handling requests for chat, CRUD, GitHub, messages, and more.
• Service Layer: In src/service, including cache.service.js and item/message services to implement business logic.
• Data Access Objects (DAO): Multiple DAO implementations (e.g., file system, localStorage, MongoDB) in src/dao to support the Strategy Pattern for CRUD operations. This includes caching submodules (file-based JSON caches for Github and YouTube) and the strategy pattern implementation (e.g., src/dao/crud.stratagy.js).
• Configuration: In src/config, various config files for API keys (e.g., apiGoogle.js), application settings, DB configuration, and Socket settings.
• Middleware: e.g., authenticateAPI.middleware.js and upload.middleware.js to regulate API access and file uploads.
Relationships and Interactions
• The Frontend makes HTTP (and possibly WebSocket) calls to the backend API endpoints.
• Controllers map incoming HTTP requests to the corresponding service logic.
• The Service layer orchestrates business logic, handling tasks like caching (via cache.service.js) and executing CRUD operations.
• The DAO layer, organized using the Strategy Pattern, facilitates switching between different data persistence mechanisms (file system, localStorage, and MongoDB) during runtime.
• External APIs (GitHub and YouTube) are integrated via dedicated controllers and are optimized by caching responses in JSON files (located under src/dao/cache/file).
• Socket configurations indicate the project accommodates real-time communication (e.g., for chat features).
Architectural Patterns and Technical Stack
• MVC-Like Approach: Controllers (handling HTTP requests), Services (business logic), and DAOs (data persistence) suggest a clean separation of concerns.
• Strategy Pattern: Used in the CRUD operations, allowing runtime interchangeability of data persistence methods.
• Caching Mechanism: Implemented to overcome external API call limitations, using file-based JSON cache stores that update periodically.
• Frontend Component-Based Architecture: Even though this project avoids frameworks like React, it manually implements modular components that are organized by feature in the file structure.
Relevant Technologies and Frameworks
• Node.js and Express for server-side logic.
• Mongoose (and MongoDB) for one of the persistence layers.
• Socket.io for real-time communications.
• SASS and vanilla JavaScript (with custom components and helper libraries like SweetAlert2, HighlightJs, and MarkedJs) on the client side.
• External API integrations (GitHub and YouTube Data V3).
Elements
• Components and Modules:
• Frontend: UI layer, JS components (e.g., chat, bookmarks, GitHub), assets (CSS, fonts, images).
• Backend: Express server, Router, Controllers, Middleware, Service Layer, DAO Layer (with caches and persistence strategies), Config modules.
• External Services: GitHub API, YouTube API.
• Data Flows:
• Caching flows and how cached data is served (e.g., from file-based JSON caches).
• Bidirectional data flow for WebSocket communications.
• Labels:
• Clearly name each component (like “Chat Controller”, “Cache Service”, “MongoDB DAO”, “Express Router”, etc.) along with brief descriptions if necessary.