# kimurash/nextjs-portfolio architecture

> Architecture diagram of the GitHub repository kimurash/nextjs-portfolio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kimurash/nextjs-portfolio
- Repository: https://github.com/kimurash/nextjs-portfolio

## Overview

##### Project type and purpose
- This is a personal portfolio website built with Next.js (using the App Router) and Tailwind CSS, written in TypeScript.
- It serves static and dynamic pages (About, Skills, Products, Contact, Resume) and exposes a single API endpoint for the contact form that integrates with external services (reCAPTCHA, Resend).

##### File structure
- Top-level “app” folder: Next.js App Router pages and layouts.
- app/layout.tsx, globals.css – global layout and styles
- app/about, app/skills, app/products, app/contact – page directories each with page.tsx, components, constants, hooks, types.
- app/api – serverless API route(s) for contact form.
- “components” folder: shared UI and layout components (Header, Footer, Buttons, Forms, Inputs).
- “lib” folder: utility functions and Zod schemas for validation.
- “public” folder: static assets (images for products, certifications, skills, resume).
- Config and dev tooling: next.config.ts, postcss.config.mjs, biome.json, pnpm-lock.yaml.
- Empty placeholder directories for services, stores, hooks, tests, types (ready for future expansion).

##### README for stack and behavior
- Next.js with Turbopack for dev, SSR/SSG at build time, environment variables for contact.
- Tailwind CSS for styling, Biome for linting/formatting.
- Resend API and reCAPTCHA for contact-form handling.
- Hosted on Vercel.

a. Main components
1. Browser / Client: React UI rendered by Next.js (hybrid SSR/SSG).
2. Next.js Application (hosted on Vercel):
- App Router pages & layouts
- Shared UI components
- API Route (contacts)
3. Static Assets CDN: images, CSS, JS bundles (served by Vercel).
4. External Services:
- Google reCAPTCHA (verification)
- Resend Email API (sending contact emails)

b. Relationships & data flow
- User → HTTP GET → Next.js (SSR/SSG) → HTML/CSS/JS → Browser
- On Contact form submit:
Browser → API Route (/api/contact)
→ Validate reCAPTCHA → Validate payload via Zod schemas → Call Resend API → Return success/failure to Browser

c. Architectural patterns & design principles
- Component-based UI (atomic/shared UI + layout + page-specific components)
- App Router (file-based routing)
- Utility abstraction in “lib” (schemas, utils) for shared logic
- Serverless functions for backend logic (zero-server maintenance)
- CDNs and edge hosting via Vercel for performance

d. Key technologies & frameworks
- Next.js (App Router, SSR & SSG)
- React + TypeScript
- Tailwind CSS
- Biome (linter/formatter)
- Zod (runtime schema validation)
- Resend (email)
- reCAPTCHA (bot protection)
- Vercel (hosting/CDN)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client
    Browser["Browser / Client"]:::client

    %% Next.js App
    subgraph "Next.js Application" 
        direction TB

        %% App Router & Pages
        subgraph "App Router & Pages" 
            direction TB
            layout["Global Layout & Styles"]:::frontend
            home["Home Page (app/page.tsx)"]:::frontend
            about["About Page"]:::frontend
            aboutSections["About Sections"]:::frontend
            skills["Skills Page"]:::frontend
            products["Products Page"]:::frontend
            contact["Contact Page"]:::frontend
        end

        %% Shared UI & Layout Components
        subgraph "Shared Components" 
            direction TB
            sharedLayout["Layout Components"]:::frontend
            uiPrimitives["UI Primitives"]:::frontend
        end

        %% API Routes
        subgraph "API Routes (Serverless)" 
            direction TB
            apiRoutes["/api/contact"]:::backend
        end

        %% Utility Layer
        subgraph "Utility Layer" 
            direction TB
            libSchemas["Zod Schemas"]:::utility
            libUtils["Utility Functions"]:::utility
        end

    end

    %% CDN / Static Assets
    CDN["CDN / Static Assets"]:::static

    %% External Services
    recaptcha["Google reCAPTCHA"]:::external
    resend["Resend Email API"]:::external

    %% Hosting
    Vercel["Vercel Hosting & Edge CDN"]:::hosting

    %% Connections
    Browser -->|"HTTP GET /navigation"| layout
    layout --> home
    layout --> about
    about --> aboutSections
    layout --> skills
    skills -->|"uses components & types"| skills
    layout --> products
    products --> products
    layout --> contact
    Browser -->|"GET SSR/SSG"| Vercel
    Browser -->|"Static Assets"| CDN

    contact -->|"Submit Contact Form"| apiRoutes
    apiRoutes -->|"Validate reCAPTCHA"| recaptcha
    apiRoutes -->|"Validate payload"| libSchemas
    apiRoutes -->|"Send email"| resend
    apiRoutes -->|"Use helpers"| libUtils
    apiRoutes --> Browser

    Vercel --> CDN
    Vercel --> Browser

    %% Click Events
    click layout "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/layout.tsx"
    click globals "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/globals.css"
    click home "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/page.tsx"
    click about "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/about/page.tsx"
    click aboutSections "https://github.com/kimurash/nextjs-portfolio/tree/develop/app/about/_sections"
    click skills "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/skills/page.tsx"
    click skillsComponents "https://github.com/kimurash/nextjs-portfolio/tree/develop/app/skills/_components"
    click skillsConstants "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/skills/constants.ts"
    click skillsTypes "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/skills/types.ts"
    click products "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/products/page.tsx"
    click productsComponents "https://github.com/kimurash/nextjs-portfolio/tree/develop/app/products/_components"
    click productsHooks "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/products/_hooks/usePrevNextButtons.ts"
    click productsConstants "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/products/constants.ts"
    click productsTypes "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/products/types.ts"
    click contact "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/contact/page.tsx"
    click contactComponents "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/contact/_components/ContactForm.tsx"
    click contactEmailTemplate "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/contact/_components/ContactFormEmailTemplate.tsx"
    click contactActions "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/contact/actions.ts"
    click sharedLayout "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/layout/Header.tsx"
    click sharedFooter "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/layout/Footer.tsx"
    click sharedLogo "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/layout/Logo.tsx"
    click sharedNavHeader "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/layout/NavigationHeader.tsx"
    click sharedNavMenu "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/layout/NavigationMenu.tsx"
    click sharedNavDrawer "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/layout/NavigationMenuDrawer.tsx"
    click sharedNavOverlay "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/layout/NavigationMenuOverlay.tsx"
    click uiPrimitives "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/ui/button.tsx"
    click uiForm "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/ui/form.tsx"
    click uiInput "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/ui/input.tsx"
    click uiLabel "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/ui/label.tsx"
    click uiTextarea "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/ui/textarea.tsx"
    click uiSonner "https://github.com/kimurash/nextjs-portfolio/blob/develop/components/ui/sonner.tsx"
    click apiRoutes "https://github.com/kimurash/nextjs-portfolio/blob/develop/app/api/.gitkeep"
    click libSchemas "https://github.com/kimurash/nextjs-portfolio/blob/develop/lib/schemas.ts"
    click libUtils "https://github.com/kimurash/nextjs-portfolio/blob/develop/lib/utils.ts"
    click publicImages "https://github.com/kimurash/nextjs-portfolio/tree/develop/public/image"
    click nextConfig "https://github.com/kimurash/nextjs-portfolio/blob/develop/next.config.ts"
    click postcssConfig "https://github.com/kimurash/nextjs-portfolio/blob/develop/postcss.config.mjs"
    click biomeConfig "https://github.com/kimurash/nextjs-portfolio/blob/develop/biome.json"
    click tsconfig "https://github.com/kimurash/nextjs-portfolio/blob/develop/tsconfig.json"
    click lockfile "https://github.com/kimurash/nextjs-portfolio/blob/develop/pnpm-lock.yaml"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#0366D6,stroke-width:2px
    classDef frontend fill:#E8F4FF,stroke:#0B69A3,stroke-width:2px
    classDef backend fill:#E6FFEA,stroke:#27A844,stroke-width:2px
    classDef utility fill:#FFF7E6,stroke:#D97706,stroke-width:2px
    classDef external fill:#FFF4E5,stroke:#D97706,stroke-width:2px,stroke-dasharray: 5 5
    classDef static fill:#F3F4F6,stroke:#6B7280,stroke-width:2px
    classDef hosting fill:#F0FDF4,stroke:#10B981,stroke-width:2px
```
