# avniproject/avni-website architecture

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

- Interactive diagram: https://gitdiagram.com/avniproject/avni-website
- Repository: https://github.com/avniproject/avni-website

## Overview

This project is a static website built with GatsbyJS that serves as a content-rich site for publishing blogs, case studies, and other informational pages. It is deployed on Netlify and uses Markdown files to generate pages via Gatsby’s build process. Additionally, there are serverless Lambda functions and CMS integration for previewing content, which further impact its overall architecture.

##### Main Components
a. Frontend (Static Site Generator):
- Gatsby Build Process: Illustrate the core role of the gatsby-config.js and gatsby-node.js files that define how pages and templates are created.
- Source Content: Show the separation between Markdown pages (located in src/pages) and React components/templates (found under src/components and src/templates) that render the pages.
- Image and Static Assets: Represent assets (images, styles, etc.) held in both src/img and static directories.
b. Content Management and Blog System:
- Markdown Content: Indicate that blog posts, case studies, and other pages are written in Markdown and stored as files under src/pages (or a dedicated folder like src/blog).
- CMS Integration: Denote the Netlify CMS (static/admin with its config.yml) and preview templates inside src/cms, which allow non-developer contributions and live previews.
c. Serverless Functions:
- Lambda Functions: Include the lambda directories (both in the root and under src/lambda) representing serverless endpoints (for example, the hello.js functions) that might handle API requests or dynamic functionality.
d. Deployment and DevOps:
- Netlify Deployment: Represent the netlify.toml file which configures deployment, along with continuous integration via GitHub (see .github folder templates for issues and pull requests).
- Build & Dependency Management: Note the Makefile, package.json, and related configuration files that manage dependency installation and build scripts.

##### Relationships and Interactions
- Data Flow: Begin with “Developer/Content Editor” updating Markdown files and/or CMS configuration.
- The Gatsby build process ingests this content (via GraphQL queries) and generates static HTML/CSS/JS.
- The static assets, React components, and templates combine to render the final pages.
- Serverless Lambda functions, when triggered (for example, via API calls or specific requests), interact with the site as needed.
- The Netlify deployment process takes the generated site and publishes it live, with the CDN delivering the static assets.
- The Netlify CMS provides an admin interface (located in static/admin) which interacts with content files and preview templates.

##### Architectural Patterns/Design Principles
- Separation of Concerns: Clear division between content (Markdown, CMS), presentation (React components, templates), and backend functionality (serverless functions).
- Static Site Generation: Use of Gatsby’s pre-rendering mechanism to optimize performance.
- Modular Design: Organized folder structure that encapsulates components, utilities, and templates separately.

##### Relevant Technologies and Frameworks
- GatsbyJS (static site generator, React-based components)
- Netlify (hosting and serverless functions)
- Markdown for content creation
- Node.js (via npm scripts, lambda functions)
- GitHub for version control and community collaboration (including CI/CD with Netlify)

## Diagram (Mermaid)

```mermaid
graph TD

  %% External Actors
  Dev["Developer/Content Editor"]:::external
  Users["User Requests"]:::external

  %% Content Management Subgraph
  subgraph "Content & CMS"
    CM["Markdown Content (src/pages)"]:::content
    Blog["Blog/Case Studies Content"]:::content
    CMS_Code["CMS Preview Templates"]:::cms
    CMS_Admin["Netlify CMS Admin"]:::cms
  end

  %% Build Process Subgraph
  subgraph "Build Process"
    GatsbyBuild["Gatsby Build Process"]:::build
    ReactComp["React Components & Templates"]:::build
    StaticAssets["Static Assets"]:::build
  end

  %% Deployment & CI/CD Subgraph
  subgraph "Deployment & CI/CD"
    StaticOut["Generated Static Site"]:::frontend
    NetlifyDeploy["Netlify Deployment"]:::deployment
    BuildDep["Build & Dependency Management"]:::dependency
    CICD["CI/CD & Repository"]:::ci
  end

  %% Serverless Functions
  Lambda["Serverless Lambda Functions"]:::serverless

  %% Relationships
  Dev -->|"updates"| CM
  Dev -->|"updates"| CMS_Admin

  CM -->|"feeds"| GatsbyBuild
  Blog -->|"feeds"| GatsbyBuild
  CMS_Code -->|"supplies"| GatsbyBuild
  CMS_Admin -->|"supplies"| GatsbyBuild
  ReactComp -->|"contributes to"| GatsbyBuild
  StaticAssets -->|"supplies"| GatsbyBuild

  GatsbyBuild -->|"generates"| StaticOut
  StaticOut -->|"deployed via"| NetlifyDeploy
  BuildDep -->|"supports"| GatsbyBuild
  BuildDep -->|"supports"| NetlifyDeploy
  CICD -->|"triggers"| NetlifyDeploy

  Users -->|"requests"| NetlifyDeploy
  NetlifyDeploy -->|"API calls"| Lambda

  %% Additional content flow from Developer to Blog Content
  Dev -->|"updates"| Blog

  %% Styles
  classDef external fill:#fce4d6, stroke:#d35400, stroke-width:2px;
  classDef content fill:#d5f5e3, stroke:#27ae60, stroke-width:2px;
  classDef cms fill:#fcf3cf, stroke:#f1c40f, stroke-width:2px;
  classDef build fill:#d6eaf8, stroke:#2980b9, stroke-width:2px;
  classDef frontend fill:#e8daef, stroke:#8e44ad, stroke-width:2px;
  classDef deployment fill:#fdebd0, stroke:#e67e22, stroke-width:2px;
  classDef serverless fill:#fadbd8, stroke:#c0392b, stroke-width:2px;
  classDef dependency fill:#e8f8f5, stroke:#16a085, stroke-width:2px;
  classDef ci fill:#ebedef, stroke:#566573, stroke-width:2px;

  %% Click Events for component mapping
  click GatsbyBuild "https://github.com/avniproject/avni-website/blob/master/gatsby-config.js"
  click GatsbyBuild "https://github.com/avniproject/avni-website/blob/master/gatsby-node.js"

  click CM "https://github.com/avniproject/avni-website/tree/master/src/pages"
  click Blog "https://github.com/avniproject/avni-website/tree/master/src/pages/blog"
  click Blog "https://github.com/avniproject/avni-website/tree/master/src/pages/case-studies"

  click ReactComp "https://github.com/avniproject/avni-website/tree/master/src/components"
  click ReactComp "https://github.com/avniproject/avni-website/tree/master/src/templates"

  click StaticAssets "https://github.com/avniproject/avni-website/tree/master/src/img"
  click StaticAssets "https://github.com/avniproject/avni-website/tree/master/static"

  click CMS_Code "https://github.com/avniproject/avni-website/tree/master/src/cms"
  click CMS_Code "https://github.com/avniproject/avni-website/tree/master/src/cms/preview-templates"

  click CMS_Admin "https://github.com/avniproject/avni-website/tree/master/static/admin"
  click CMS_Admin "https://github.com/avniproject/avni-website/blob/master/static/admin/config.yml"

  click Lambda "https://github.com/avniproject/avni-website/tree/master/lambda"
  click Lambda "https://github.com/avniproject/avni-website/tree/master/src/lambda"

  click NetlifyDeploy "https://github.com/avniproject/avni-website/blob/master/netlify.toml"

  click BuildDep "https://github.com/avniproject/avni-website/tree/master/Makefile"
  click BuildDep "https://github.com/avniproject/avni-website/blob/master/package.json"

  click CICD "https://github.com/avniproject/avni-website/blob/master/.github"
```
