How bamiseomolaso/portfoliowebsite works
Project Type & Purpose
• This is a full-stack, modern, responsive portfolio website built with Next.js that showcases a professional’s expertise.
• It integrates a blog, portfolio sections with tag filtering, an admin dashboard, and robust features such as newsletter subscription, email authentication, performance monitoring, and security measures (e.g., rate limiting, reCAPTCHA, sanitization).
• External systems like Supabase (for database and authentication), Resend (for email notifications), Upstash Redis (for rate limiting), and Google reCAPTCHA (for form protection) are core to its operation.
File Structure
• The top-level structure includes configuration files (.babelrc, eslint, prettier, etc.), a public folder for static assets (including the PDF CV), and a robust “src” directory which houses the application’s code.
• The “src/app” directory (using Next.js App Router) is segmented into multiple areas: pages for about, blog, contact, admin, newsletter, portfolio, and privacy-policy.
• The “src/app/api” folder contains key API routes, e.g., for contact forms, newsletter subscriptions, performance monitoring, subscriber/export endpoints, and email authentication.
• Additional directories such as “components”, “lib”, “types”, and “database” illustrate how the project modularizes reusable elements, utility functions (security, rate limiting, caching), and the database schema.
• There is also support for server-side scripts and Supabase migrations (in the “supabase” folder) that define and manage the back-end database schemas.
Main Components & Their Relationships
a. Frontend:
• Next.js Application:
• Containing page components (e.g., home, about, blog, portfolio, contact) and layout components (Navbar, Footer, global layout).
• Admin dashboard pages in “src/app/admin” manage newsletters, performance, projects, and email authentication.
• Client-Side Components:
• Shared components such as ContactForm, Newsletter, CookieConsent, ErrorBoundary, etc.
• Integration with libraries like Framer Motion for animations and Tailwind CSS for styling.
b. Backend/API:
• API Routes:
• Located under “src/app/api”, these include endpoints to handle contact requests, email authentication, newsletter subscriptions and distribution, performance data collection, and subscriber management.
• Each API route may involve middleware for rate limiting, IP/security checks, and input sanitization.
• Utility Libraries:
• Functions in “src/lib” manage core logic for email sending (using Resend), security tasks, rate limiting (using Upstash Redis), Supabase client interactions, caching, and sanitization.
c. External Services:
• Supabase:
• Provides the database (with migrations detailed in the “supabase/migrations” folder) and authentication services.
• Resend:
• Handles email notifications and sending functions (code found in lib/resend.ts).
• Upstash Redis:
• Implements rate limiting policies for API calls.
• Google reCAPTCHA:
• Secures forms (as indicated in the README and environment configuration).
d. Database:
• Managed by Supabase with a schema SQL file in “src/database/schema.sql” and explicit migration files in the “supabase/migrations” folder.
• Supports tables for newsletters, subscribers, performance metrics, and security improvements.
Architectural Patterns / Design Principles
• Modular Design: Separation of concerns between client components, API endpoints, and backend libraries.
• API-driven Communication: The frontend communicates with the backend through well-defined API routes.
• Security & Performance: Emphasis on input sanitization, cookie management, rate limiting, and security middleware.
• Organized Folder Structure: Clear categorization which separates presentation (pages and components), logic (lib and hooks), types, and static assets.
• Utilization of modern React/Next.js capabilities and CSS frameworks for a responsive, dynamic user experience.