# balchaki/ecopulse architecture

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

- Interactive diagram: https://gitdiagram.com/balchaki/ecopulse
- Repository: https://github.com/balchaki/ecopulse

## Overview

##### Project Type and Purpose
- This is a Next.js web application (React-based) that uses the App Router (located under src/app) to serve a small marketing site with “about,” “contact,” and “solutions” pages.
- It is primarily a front-end application that relies on Next.js for server-side rendering (SSR) or static site generation (SSG), delivered via a Node.js server or Vercel CDN.

##### File Structure Analysis
- Top-Level Files/Dirs
- next.config.ts – Next.js configuration (routing, builds)
- package.json / package-lock.json – dependencies and scripts
- public/ – static assets (images, fonts) served directly by the CDN/server
- src/app/ – Next.js App Router directory containing page segments and layout.tsx
- tsconfig.json – TypeScript compiler options
- Patterns & Conventions
- App Router → each folder under src/app represents a route
- CSS Modules → page.module.css next to each page.tsx for scoped styling
- Component library under src/components/ui for reusable UI cards, links

##### README Insights
- Bootstrapped with create-next-app
- Uses next/font for font optimization
- Deployed/optimized for Vercel

##### Main Components
A. Client (Web Browser)
– Initiates HTTP(S) requests for pages and assets
B. Next.js Server / Vercel CDN
– SSR/SSG pipeline:
- Route resolution (src/app/*)
- Data fetching (if any) and rendering pages to HTML
- CSS & JS bundling via Webpack/RSC
– Serves static assets from public/
C. React Component Tree
– Layout.tsx (global layout)
– Navbar & Footer (persistent UI)
– Page-specific components (e.g., card-solutions.tsx under src/components/ui)
D. Styling Layer
– CSS Modules for scoped styles
– globals.css for application-wide styles
E. Build & Configuration
– next.config.ts defines custom routing or build options
– ESLint config (eslint.config.mjs) for linting rules

##### Relationships and Data Flows
- Browser → HTTP GET → Next.js Server/CDN
- Next.js
- Matches route via App Router (app/layout.tsx → page.tsx)
- Executes server-side code, compiles React to HTML
- Bundles client JS (hydration) and CSS
- Browser receives HTML + CSS + JS → React hydrates components
- Browser requests additional assets from public/ (images, font files)

##### Architectural Patterns & Design Principles
- Component-based architecture (React)
- Folder-per-route convention (Next.js App Router)
- Separation of concerns:
- Routing and data fetching in app/
- Presentational components in components/ui/
- Global vs modular CSS
- SSR/SSG for performance and SEO

##### Technologies & Frameworks
- Next.js (App Router)
- React & React Server Components
- TypeScript
- CSS Modules & global CSS
- Vercel (deployment/CDN)
- next/font for font optimization

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph "Client Layer"
        Browser["Web Browser"]:::client
    end

    %% Server & CDN Layer
    subgraph "Server Layer"
        NextServer["Next.js Server / Vercel CDN"]:::server
        RouteResolver["App Router (src/app/)"]:::server
        BuildPipeline["SSR/SSG Pipeline"]:::server
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        Layout["Global Layout\n(src/app/layout.tsx)"]:::ui
        subgraph "Pages"
            HomePage["Home Page\n(src/app/page.tsx)"]:::ui
            AboutPage["About Page\n(src/app/about/page.tsx)"]:::ui
            ContactPage["Contact Page\n(src/app/contact/page.tsx)"]:::ui
            SolutionsPage["Solutions Page\n(src/app/solutions/page.tsx)"]:::ui
        end
        subgraph "UI Components"
            Navbar["Navbar\n(src/components/navbar.tsx)"]:::ui
            Footer["Footer\n(src/components/Footer.tsx)"]:::ui
            CardSolutions["Solution Card\n(src/components/ui/card-solutions.tsx)"]:::ui
            GenericCard["Generic Card\n(src/components/ui/card.tsx)"]:::ui
            NavbarLink["Navbar Link\n(src/components/ui/navbar-link.tsx)"]:::ui
        end
    end

    %% Styling Layer
    subgraph "Styling Layer"
        GlobalCSS["globals.css\n(src/app/globals.css)"]:::css
        CSSModules["CSS Modules\n(page.module.css)"]:::css
    end

    %% Assets Layer
    subgraph "Assets Layer"
        PublicAssets["Static Assets\n(public/)"]:::assets
    end

    %% Config Layer
    subgraph "Config & Tooling"
        NextConfig["next.config.ts"]:::config
        ESLint["eslint.config.mjs"]:::config
        TSConfig["tsconfig.json"]:::config
    end

    %% Flows
    Browser -->|"HTTP GET Request"| NextServer
    NextServer -->|“match route”| RouteResolver
    RouteResolver -->|“invoke layout → page”| BuildPipeline
    BuildPipeline -->|“renders HTML/CSS/JS”| Browser
    Browser -->|"hydrate React"| Layout
    Layout --> HomePage
    Layout --> AboutPage
    Layout --> ContactPage
    Layout --> SolutionsPage
    HomePage --> Navbar
    AboutPage --> Navbar
    ContactPage --> Navbar
    SolutionsPage --> Navbar
    HomePage --> Footer
    AboutPage --> Footer
    ContactPage --> Footer
    SolutionsPage --> Footer
    HomePage --> CardSolutions
    SolutionsPage --> CardSolutions
    HomePage --> GenericCard
    HomePage --> NavbarLink
    Browser -->|"fetch assets"| PublicAssets

    %% Config flows
    NextConfig -.-> NextServer
    ESLint -.-> BuildPipeline
    TSConfig -.-> BuildPipeline

    %% Styling relations
    GlobalCSS -->|“global styles”| Layout
    CSSModules -->|“scoped styles”| HomePage
    CSSModules -->|“scoped styles”| AboutPage
    CSSModules -->|“scoped styles”| ContactPage
    CSSModules -->|“scoped styles”| SolutionsPage

    %% Click Events
    click NextConfig "https://github.com/balchaki/ecopulse/blob/main/next.config.ts"
    click ESLint "https://github.com/balchaki/ecopulse/blob/main/eslint.config.mjs"
    click GlobalCSS "https://github.com/balchaki/ecopulse/blob/main/src/app/globals.css"
    click RouteResolver "https://github.com/balchaki/ecopulse/tree/main/src/app/"
    click Layout "https://github.com/balchaki/ecopulse/blob/main/src/app/layout.tsx"
    click HomePage "https://github.com/balchaki/ecopulse/blob/main/src/app/page.tsx"
    click HomePage "https://github.com/balchaki/ecopulse/blob/main/src/app/page.module.css"
    click AboutPage "https://github.com/balchaki/ecopulse/blob/main/src/app/about/page.tsx"
    click AboutPage "https://github.com/balchaki/ecopulse/blob/main/src/app/about/page.module.css"
    click ContactPage "https://github.com/balchaki/ecopulse/blob/main/src/app/contact/page.tsx"
    click ContactPage "https://github.com/balchaki/ecopulse/blob/main/src/app/contact/page.module.css"
    click SolutionsPage "https://github.com/balchaki/ecopulse/blob/main/src/app/solutions/page.tsx"
    click SolutionsPage "https://github.com/balchaki/ecopulse/blob/main/src/app/solutions/page.module.css"
    click Navbar "https://github.com/balchaki/ecopulse/blob/main/src/components/navbar.tsx"
    click Footer "https://github.com/balchaki/ecopulse/blob/main/src/components/Footer.tsx"
    click CardSolutions "https://github.com/balchaki/ecopulse/blob/main/src/components/ui/card-solutions.tsx"
    click GenericCard "https://github.com/balchaki/ecopulse/blob/main/src/components/ui/card.tsx"
    click NavbarLink "https://github.com/balchaki/ecopulse/blob/main/src/components/ui/navbar-link.tsx"
    click PublicAssets "https://github.com/balchaki/ecopulse/tree/main/public/"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#0366D6,stroke-width:1px
    classDef server fill:#DFFFE0,stroke:#28A745,stroke-width:1px
    classDef ui fill:#F2F2F2,stroke:#666666,stroke-width:1px
    classDef assets fill:#FFF4E6,stroke:#FF8C00,stroke-width:1px
    classDef css fill:#FEF9C3,stroke:#E0A800,stroke-width:1px
    classDef config fill:#FDE2E4,stroke:#D6336C,stroke-width:1px
```
