# nomangazi/nextjs-noman-blog architecture

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

- Interactive diagram: https://gitdiagram.com/nomangazi/nextjs-noman-blog
- Repository: https://github.com/nomangazi/nextjs-noman-blog

## Overview

##### Main Components

a. Frontend Layer:
- Pages (home-page.tsx)
- Components (navbar)
- Assets (images, styles)
- Utils

b. Next.js App Router Layer:
- Root Layout (layout.tsx)
- Page Components (page.tsx)
- API Routes (/api/blog)

c. Database Layer:
- Drizzle ORM
- Migration System
- Schema Definitions

##### Component Relationships

- Client → App Router: User interactions and page requests
- App Router → API Routes: Internal API calls
- API Routes → Database: Data operations through Drizzle ORM
- App Router → Database: Direct database queries from server components

##### Architectural Patterns to Highlight

a. Next.js App Router Pattern:
- Hierarchy of layouts and pages
- Server and client components
- API routes structure

b. Data Flow:
- How data flows from the database through the API to the client
- Server-side rendering paths
- Client-side navigation patterns

##### Technical Stack Indicators

- Next.js (Framework)
- React (UI Library)
- Drizzle (ORM)
- Tailwind CSS (Styling)
- TypeScript (Programming Language)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        FC["Client-Side Components"]
        FC --> Pages["Pages"]:::frontend
        FC --> Components["Components"]:::frontend
        FC --> Assets["Assets"]:::frontend
        FC --> Utils["Utils"]:::frontend
        FC --> Styles["Styles"]:::frontend
        
        Components --> Navbar["Navbar Component"]:::frontend
    end

    subgraph "Next.js App Router Layer"
        AR["App Router"]
        AR --> RootLayout["Root Layout"]:::server
        AR --> PageComponent["Page Component"]:::server
        AR --> APIRoutes["API Routes"]:::server
    end

    subgraph "Database Layer"
        DB["Database"]
        DB --> DrizzleORM["Drizzle ORM"]:::database
        DB --> Migrations["Migration System"]:::database
        DB --> Schema["Schema Definitions"]:::database
    end

    subgraph "Configuration"
        Config["Configuration Files"]
        Config --> NextConfig["Next.js Config"]:::config
        Config --> TSConfig["TypeScript Config"]:::config
        Config --> TailwindConfig["Tailwind Config"]:::config
        Config --> DrizzleConfig["Drizzle Config"]:::config
    end

    FC --> AR
    AR --> APIRoutes
    APIRoutes --> DB
    AR --> DB

    click Pages "https://github.com/nomangazi/nextjs-noman-blog/tree/main/src/client/pages/"
    click Components "https://github.com/nomangazi/nextjs-noman-blog/tree/main/src/client/components/"
    click Assets "https://github.com/nomangazi/nextjs-noman-blog/tree/main/src/client/assets/"
    click Utils "https://github.com/nomangazi/nextjs-noman-blog/tree/main/src/client/utils/"
    click Styles "https://github.com/nomangazi/nextjs-noman-blog/tree/main/src/client/assets/styles/"
    click RootLayout "https://github.com/nomangazi/nextjs-noman-blog/blob/main/src/app/layout.tsx"
    click PageComponent "https://github.com/nomangazi/nextjs-noman-blog/blob/main/src/app/page.tsx"
    click APIRoutes "https://github.com/nomangazi/nextjs-noman-blog/blob/main/src/app/api/blog/route.tsx"
    click DrizzleORM "https://github.com/nomangazi/nextjs-noman-blog/blob/main/src/drizzle/db.ts"
    click Schema "https://github.com/nomangazi/nextjs-noman-blog/blob/main/src/drizzle/schema.ts"
    click Migrations "https://github.com/nomangazi/nextjs-noman-blog/tree/main/src/drizzle/migrations/"
    click NextConfig "https://github.com/nomangazi/nextjs-noman-blog/blob/main/next.config.mjs"
    click TSConfig "https://github.com/nomangazi/nextjs-noman-blog/blob/main/tsconfig.json"
    click TailwindConfig "https://github.com/nomangazi/nextjs-noman-blog/blob/main/tailwind.config.ts"
    click DrizzleConfig "https://github.com/nomangazi/nextjs-noman-blog/blob/main/drizzle.config.ts"
    click Navbar "https://github.com/nomangazi/nextjs-noman-blog/blob/main/src/client/components/navbar/header_navbar.tsx"

    classDef frontend fill:#2563eb,color:white
    classDef server fill:#16a34a,color:white
    classDef database fill:#ea580c,color:white
    classDef config fill:#6b7280,color:white

    subgraph Legend
        L1["Frontend Components"]:::frontend
        L2["Server Components"]:::server
        L3["Database Components"]:::database
        L4["Configuration Files"]:::config
    end
```
