How swayamterode/portfolio works
Main Components
• Frontend/UI Layer:
• Located primarily in the "app" directory.
• Contains pages such as the homepage (app/page.tsx), about page (app/about/page.tsx), contact page (app/contact/page.tsx), tech stack page (app/tech-stack/page.tsx), and work page (app/work/page.tsx).
• Global application elements like app/layout.tsx, styling in app/globals.css, and providers in app/providers.tsx.
• Reusable UI elements and components in the "components" directory (e.g., Navbar, Footer, Hero, buttons, and animations).
• API/Backend Layer:
• Contains API endpoints under app/api (for instance, about-me, contact, hero, and tech-stack endpoints).
• These endpoints handle client requests for dynamic content and interactions like contact form submissions or fetching data for the hero section.
• Business Logic/Service Layer:
• Modules in "lib", including database connections (lib/db.ts) and modal definitions, which separate business logic from presentation and API endpoints.
• External configurations in "config" (e.g., config/nodemailer.ts for handling email sending).
• Data & Constants:
• "constants" directory for static data such as project details and portfolio-specific information.
• "utils" directory for shared utilities like API response handling (utils/ApiResponse.ts), toast notifications (utils/Toastify.ts), and social links.
• Public Assets & Animation Files:
Relationships and Interactions
• The Frontend pages use components to present content and interact with API endpoints for dynamic features.
• API endpoints serve data requests from the frontend and interact with underlying business logic (via lib modules) and database (MongoDB via lib/db.ts).
• Utility and constant modules provide support across components and endpoints ensuring consistent data and behavior.
• External services (such as email via nodemailer) are integrated within the API endpoints to handle tasks like sending messages from the contact form.
Architectural Patterns and Design Principles
• File-based Routing (Next.js): Pages and API endpoints are automatically mapped from specific file and directory paths.
• Component-based Architecture: Reusable UI components are abstracted in the components directory, which enhances maintainability.
• Separation of Concerns: Clear boundaries exist between UI (app, components), backend/API (app/api), business logic (lib, config), and static assets (public).
• Responsive & Modern Design: Use of Tailwind CSS for styling and responsive layout, with capabilities for dark mode.
• Integration of Third-Party Libraries: ThreeJS for animations; nodemailer for email functionality; and MongoDB for data persistence.
Relevant Technologies and Frameworks
• Next.js for server-side rendering and routing.
• Tailwind CSS for styling and responsive design.
• ThreeJS for animations and 3D model rendering.
• MongoDB as the database.
• Node environment with configurations in .env.sample and next.config.js.
• Utility libraries and components for enhanced user interactions (like Toast notifications, theme switching).