# aryan570/ghiblily architecture

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

- Interactive diagram: https://gitdiagram.com/aryan570/ghiblily
- Repository: https://github.com/aryan570/ghiblily

## Overview

##### Project type and purpose
- This is a full-stack, single-page (React/Next.js) portfolio website with a blog feature and a small backend API layer.
- Purpose: serve a Ghibli-inspired portfolio (static & dynamic content), play background audio (Howler.js), animate UI (GSAP), and manage blog posts stored in MongoDB.

##### File structure
- Top-level config: next.config.ts, eslint.config.mjs, postcss.config.mjs, tsconfig.json – these configure Next.js, linting, CSS, TS.
- `src/app`: Next.js App Router directory.
- Static pages: layout.tsx, page.tsx, globals.css.
- Dynamic routes under `blogs/[slug]` & API routes under `api/*`.
- `src/components`: React UI components (Banner, Footer, Skills, etc.), plus a CSS module for animations.
- `src/lib/mongodb.ts`: MongoDB client setup.
- `public`: static assets (rosso.mp3).
- package.json lists dependencies: next, react, mongodb, howler, gsap, etc.

##### Insights from README
- Tech stack: Next.js (React + server components), TypeScript, MongoDB, Howler.js (audio), GSAP (animations), Vercel (hosting).
- New blog section for dynamic content.

##### Main components & interactions
a. Frontend (Next.js)
- Static pages (About, Projects, Skills, Contact, etc.)
- Dynamic blog pages (`/blogs/[slug]`)
- UI animation layer (GSAP)
- Audio player (Howler.js)
b. Backend/API (Next.js API Routes)
- `/api/add_blog`: write new blog posts
- `/api/blog`, `/api/blog/[slug]`: read posts
- `/api/blog_metadata`: fetch list of posts
- `/api/mail`: contact form
c. Database
- MongoDB (hosted externally or via Atlas)
- Collections: blogs, metadata, potentially messages.
d. Hosting & CDN
- Vercel (build & serve Next.js, edge caching).
e. External services
- MongoDB Atlas
- (Optional) Email service via `/api/mail`.

##### Architectural patterns & design principles
- Server Components vs Client Components (Next.js App Router)
- Layered separation: Presentation (components/pages) → API layer → Persistence (MongoDB)
- Edge/SSR: Next.js pre-renders static pages; API routes run as serverless functions.
- Micro-services style: each API route is its own lambda.

##### Detail is key
- API endpoints and their function.
- Static asset delivery path (public folder → CDN → Browser).
- Server/client boundaries, and where server components render vs client scripts run.
- Build/deploy on Vercel as a final step: push → CI/CD → Live.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    subgraph "Browser Client"
        direction TB
        Browser["Browser Client"]:::external
    end

    %% CDN and Assets
    subgraph "Vercel CDN"
        direction TB
        CDN["Static Assets (rosso.mp3)"]:::external
    end

    %% Frontend Layer
    subgraph "Next.js Frontend" 
        direction TB
        Layout["Root Layout"]:::frontend
        GlobalsCss["globals.css"]:::frontend
        HomePage["Home Page"]:::frontend
        BlogsList["Blogs Listing Page"]:::frontend
        BlogDetail["Blog Detail Page"]:::frontend
        AddBlogPage["Add Blog Page"]:::frontend

        subgraph "UI Components"
            direction TB
            Banner["Banner"]:::frontend
            Footer["Footer"]:::frontend
            Skills["Skills"]:::frontend
            Projects["Projects"]:::frontend
            ContactComp["Contact"]:::frontend
            SmoothScroll["SmoothScroll"]:::frontend
            PlantAnim["plant-animation.module.css"]:::frontend
            Arc["Arc"]:::frontend
            CastleIntro["CastleIntro"]:::frontend
            Flower["Flower"]:::frontend
            Folio["Folio"]:::frontend
            MainComp["Main"]:::frontend
            TagSkill["TagSkill"]:::frontend
            Blogs3["Blogs3"]:::frontend
        end
    end

    %% API Layer
    subgraph "API Layer (Serverless Functions)"
        direction TB
        AddBlogApi["POST /api/add_blog"]:::backend
        BlogMetadataApi["GET /api/blog_metadata"]:::backend
        BlogApi["GET /api/blog"]:::backend
        BlogSlugApi["GET /api/blog/[slug]"]:::backend
        Blog3Api["GET /api/blog3"]:::backend
        MailApi["POST /api/mail"]:::backend
        LibMongodb["MongoDB Client Setup"]:::backend
    end

    %% Database and External
    subgraph "Persistence & Services"
        direction TB
        Mongo["MongoDB Atlas"]:::database
        EmailService["Email Service"]:::external
        VercelCI["Vercel CI/CD & Hosting"]:::external
    end

    %% Config Files
    subgraph "Project Configurations"
        direction TB
        NextConfig["next.config.ts"]:::external
        Tsconfig["tsconfig.json"]:::external
        ESLintConfig["eslint.config.mjs"]:::external
        PostCssConfig["postcss.config.mjs"]:::external
        PackageJson["package.json"]:::external
    end

    %% Connections
    Browser -->|"GET pages"| Layout
    Browser -->|"LOAD assets"| CDN
    Browser -->|"FETCH data"| AddBlogApi
    Browser -->|"FETCH data"| BlogMetadataApi
    Browser -->|"FETCH data"| BlogApi
    Browser -->|"FETCH data"| BlogSlugApi
    Browser -->|"FETCH data"| Blog3Api
    Browser -->|"SUBMIT form"| MailApi

    Layout --> GlobalsCss
    Layout --> HomePage
    Layout --> BlogsList
    Layout --> AddBlogPage
    BlogsList --> BlogDetail
    HomePage --> Banner
    HomePage --> Footer
    HomePage --> Skills
    HomePage --> Projects
    HomePage --> ContactComp
    HomePage --> SmoothScroll
    HomePage --> PlantAnim
    HomePage --> Arc
    HomePage --> CastleIntro
    HomePage --> Flower
    HomePage --> Folio
    HomePage --> MainComp
    HomePage --> TagSkill
    HomePage --> Blogs3

    AddBlogApi --> LibMongodb
    BlogMetadataApi --> LibMongodb
    BlogApi --> LibMongodb
    BlogSlugApi --> LibMongodb
    Blog3Api --> LibMongodb
    MailApi --> EmailService
    LibMongodb --> Mongo

    VercelCI --> Layout
    VercelCI --> AddBlogApi

    %% Click Events
    click Layout "https://github.com/aryan570/ghiblily/blob/main/src/app/layout.tsx"
    click GlobalsCss "https://github.com/aryan570/ghiblily/blob/main/src/app/globals.css"
    click HomePage "https://github.com/aryan570/ghiblily/blob/main/src/app/page.tsx"
    click BlogsList "https://github.com/aryan570/ghiblily/blob/main/src/app/blogs/page.tsx"
    click BlogDetail "https://github.com/aryan570/ghiblily/blob/main/src/app/blogs/[slug]/page.tsx"
    click AddBlogPage "https://github.com/aryan570/ghiblily/blob/main/src/app/add_blog/page.tsx"
    click Banner "https://github.com/aryan570/ghiblily/blob/main/src/components/Banner.tsx"
    click Footer "https://github.com/aryan570/ghiblily/blob/main/src/components/Footer.tsx"
    click Skills "https://github.com/aryan570/ghiblily/blob/main/src/components/Skills.tsx"
    click Projects "https://github.com/aryan570/ghiblily/blob/main/src/components/Projects.tsx"
    click ContactComp "https://github.com/aryan570/ghiblily/blob/main/src/components/Contact.tsx"
    click SmoothScroll "https://github.com/aryan570/ghiblily/blob/main/src/components/SmoothScroll.tsx"
    click PlantAnim "https://github.com/aryan570/ghiblily/blob/main/src/components/plant-animation.module.css"
    click Arc "https://github.com/aryan570/ghiblily/blob/main/src/components/Arc.tsx"
    click CastleIntro "https://github.com/aryan570/ghiblily/blob/main/src/components/CastleIntro.tsx"
    click Flower "https://github.com/aryan570/ghiblily/blob/main/src/components/Flower.tsx"
    click Folio "https://github.com/aryan570/ghiblily/blob/main/src/components/Folio.tsx"
    click MainComp "https://github.com/aryan570/ghiblily/blob/main/src/components/Main.tsx"
    click TagSkill "https://github.com/aryan570/ghiblily/blob/main/src/components/TagSkill.tsx"
    click Blogs3 "https://github.com/aryan570/ghiblily/blob/main/src/components/Blogs3.tsx"
    click AddBlogApi "https://github.com/aryan570/ghiblily/blob/main/src/app/api/add_blog/route.ts"
    click BlogMetadataApi "https://github.com/aryan570/ghiblily/blob/main/src/app/api/blog_metadata/route.ts"
    click BlogApi "https://github.com/aryan570/ghiblily/blob/main/src/app/api/blog/route.ts"
    click BlogSlugApi "https://github.com/aryan570/ghiblily/blob/main/src/app/api/blog/[slug]/route.ts"
    click Blog3Api "https://github.com/aryan570/ghiblily/blob/main/src/app/api/blog3/route.ts"
    click MailApi "https://github.com/aryan570/ghiblily/blob/main/src/app/api/mail/route.ts"
    click LibMongodb "https://github.com/aryan570/ghiblily/blob/main/src/lib/mongodb.ts"
    click CDN "https://github.com/aryan570/ghiblily/blob/main/public/rosso.mp3"
    click NextConfig "https://github.com/aryan570/ghiblily/blob/main/next.config.ts"
    click Tsconfig "https://github.com/aryan570/ghiblily/blob/main/tsconfig.json"
    click ESLintConfig "https://github.com/aryan570/ghiblily/blob/main/eslint.config.mjs"
    click PostCssConfig "https://github.com/aryan570/ghiblily/blob/main/postcss.config.mjs"
    click PackageJson "https://github.com/aryan570/ghiblily/blob/main/package.json"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085;
    classDef backend fill:#d4edda,stroke:#155724,color:#155724;
    classDef database fill:#fff3cd,stroke:#856404,color:#856404;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
```
