# maruhxn/grinergy-web architecture

> Architecture diagram of the GitHub repository maruhxn/grinergy-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maruhxn/grinergy-web
- Repository: https://github.com/maruhxn/grinergy-web

## Overview

Grinergy is a Next.js corporate site for product and company information, news, notices, and contact details, with an administration area for managing content. Visitors browse public pages and paginated news or notices; administrators sign in and maintain those records. The sampled code shows public news and notice data access, a Prisma database client, and an R2-backed download route. The README documents MongoDB, Cloudflare R2, caching, validation, and JWT login; unsampled admin and file-management details are represented at their existing directory paths, with uncertain wiring omitted.

Main entry points: [`src/libs/db.ts`](https://github.com/maruhxn/grinergy-web/blob/main/src/libs/db.ts) (MongoDB), [`src/libs/db-actions/news.ts`](https://github.com/maruhxn/grinergy-web/blob/main/src/libs/db-actions/news.ts) (News data access), [`src/libs/db-actions/notice.ts`](https://github.com/maruhxn/grinergy-web/blob/main/src/libs/db-actions/notice.ts) (Notice data access), [`src/app/(admin)/admin/login/actions.ts`](https://github.com/maruhxn/grinergy-web/blob/main/src/app/(admin)/admin/login/actions.ts) (Admin login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public website"]
  node_company["Company pages"]
  node_home["Home page<br/>[page.tsx]"]
  node_product["Product page<br/>[page.tsx]"]
  node_news_page["News listing<br/>[page.tsx]"]
  node_notice_page["Notice pages"]
  node_contact["Contact page<br/>[page.tsx]"]
  node_investors["Investor page<br/>[page.tsx]"]
  node_product_visuals["Product visuals<br/>[CircleModel.tsx]"]
end

subgraph group_admin["Content administration"]
  node_news_admin["News management"]
  node_notice_admin["Notice management"]
  node_admin_login["Admin login<br/>[actions.ts]"]
end

subgraph group_content["Content and persistence"]
  node_news_data["News data access<br/>[news.ts]"]
  node_notice_data["Notice data access<br/>[notice.ts]"]
  node_database[("MongoDB<br/>[db.ts]")]
  node_news_api["News API<br/>[route.ts]"]
  node_notice_api["Notice API<br/>[route.ts]"]
end

subgraph group_platform["Files and operations"]
  node_download_api["Download route<br/>[route.ts]"]
  node_r2[("Cloudflare R2")]
  node_errors["Error handling<br/>[error-handler.ts]"]
  node_slack["Slack alerts"]
end

node_visitor(("Visitor"))

node_visitor -->|"visits"| node_home
node_visitor -.->|"visits"| node_company
node_visitor -->|"visits"| node_product
node_visitor -->|"browses"| node_news_page
node_visitor -->|"browses"| node_notice_page
node_visitor -->|"visits"| node_contact
node_visitor -.->|"visits"| node_investors
node_product -->|"renders"| node_product_visuals
node_news_page -->|"queries"| node_news_data
node_notice_page -->|"queries"| node_notice_data
node_news_data -->|"queries"| node_database
node_notice_data -->|"queries"| node_database
node_news_api -->|"reads"| node_database
node_notice_api -->|"reads"| node_database
node_news_admin -.->|"manages"| node_news_data
node_notice_admin -.->|"manages"| node_notice_data
node_admin_login -.->|"unlocks"| node_news_admin
node_admin_login -.->|"unlocks"| node_notice_admin
node_download_api -->|"fetches file"| node_r2
node_errors -->|"reports errors"| node_slack

click node_company "https://github.com/maruhxn/grinergy-web/tree/main/src/app/(client)/about"
click node_home "https://github.com/maruhxn/grinergy-web/blob/main/src/app/(client)/(home)/page.tsx"
click node_product "https://github.com/maruhxn/grinergy-web/blob/main/src/app/(client)/product/page.tsx"
click node_news_page "https://github.com/maruhxn/grinergy-web/blob/main/src/app/(client)/news/page.tsx"
click node_notice_page "https://github.com/maruhxn/grinergy-web/tree/main/src/app/(client)/notice"
click node_contact "https://github.com/maruhxn/grinergy-web/blob/main/src/app/(client)/contact/page.tsx"
click node_investors "https://github.com/maruhxn/grinergy-web/blob/main/src/app/(client)/investors/page.tsx"
click node_product_visuals "https://github.com/maruhxn/grinergy-web/blob/main/src/components/CircleModel.tsx"
click node_news_admin "https://github.com/maruhxn/grinergy-web/tree/main/src/app/(admin)/admin/(isAdmin)/news"
click node_notice_admin "https://github.com/maruhxn/grinergy-web/tree/main/src/app/(admin)/admin/(isAdmin)/notice"
click node_admin_login "https://github.com/maruhxn/grinergy-web/blob/main/src/app/(admin)/admin/login/actions.ts"
click node_news_data "https://github.com/maruhxn/grinergy-web/blob/main/src/libs/db-actions/news.ts"
click node_notice_data "https://github.com/maruhxn/grinergy-web/blob/main/src/libs/db-actions/notice.ts"
click node_database "https://github.com/maruhxn/grinergy-web/blob/main/src/libs/db.ts"
click node_news_api "https://github.com/maruhxn/grinergy-web/blob/main/src/app/api/news/%5BnewsId%5D/route.ts"
click node_notice_api "https://github.com/maruhxn/grinergy-web/blob/main/src/app/api/notice/%5BnoticeId%5D/route.ts"
click node_download_api "https://github.com/maruhxn/grinergy-web/blob/main/src/app/api/download/route.ts"
click node_errors "https://github.com/maruhxn/grinergy-web/blob/main/src/libs/error-handler.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_company,node_home,node_product,node_news_page,node_notice_page,node_contact,node_investors,node_product_visuals toneBlue
class node_news_admin,node_notice_admin,node_admin_login toneAmber
class node_news_data,node_notice_data,node_database,node_news_api,node_notice_api toneMint
class node_download_api,node_r2,node_errors,node_slack toneRose
class node_visitor toneIndigo
```

## Components

### Public website

- [Company pages](https://github.com/maruhxn/grinergy-web/tree/main/src/app/(client)/about): `src/app/(client)/about`
- [Home page](https://github.com/maruhxn/grinergy-web/blob/main/src/app/(client)/(home)/page.tsx): `src/app/(client)/(home)/page.tsx`
- [Product page](https://github.com/maruhxn/grinergy-web/blob/main/src/app/(client)/product/page.tsx): `src/app/(client)/product/page.tsx`
- [News listing](https://github.com/maruhxn/grinergy-web/blob/main/src/app/(client)/news/page.tsx): `src/app/(client)/news/page.tsx`
- [Notice pages](https://github.com/maruhxn/grinergy-web/tree/main/src/app/(client)/notice): `src/app/(client)/notice`
- [Contact page](https://github.com/maruhxn/grinergy-web/blob/main/src/app/(client)/contact/page.tsx): `src/app/(client)/contact/page.tsx`
- [Investor page](https://github.com/maruhxn/grinergy-web/blob/main/src/app/(client)/investors/page.tsx): `src/app/(client)/investors/page.tsx`
- [Product visuals](https://github.com/maruhxn/grinergy-web/blob/main/src/components/CircleModel.tsx): `src/components/CircleModel.tsx`

### Content administration

- [News management](https://github.com/maruhxn/grinergy-web/tree/main/src/app/(admin)/admin/(isAdmin)/news): `src/app/(admin)/admin/(isAdmin)/news`
- [Notice management](https://github.com/maruhxn/grinergy-web/tree/main/src/app/(admin)/admin/(isAdmin)/notice): `src/app/(admin)/admin/(isAdmin)/notice`
- [Admin login](https://github.com/maruhxn/grinergy-web/blob/main/src/app/(admin)/admin/login/actions.ts): `src/app/(admin)/admin/login/actions.ts`

### Content and persistence

- [News data access](https://github.com/maruhxn/grinergy-web/blob/main/src/libs/db-actions/news.ts): `src/libs/db-actions/news.ts`
- [Notice data access](https://github.com/maruhxn/grinergy-web/blob/main/src/libs/db-actions/notice.ts): `src/libs/db-actions/notice.ts`
- [MongoDB](https://github.com/maruhxn/grinergy-web/blob/main/src/libs/db.ts): `src/libs/db.ts`
- [News API](https://github.com/maruhxn/grinergy-web/blob/main/src/app/api/news/%5BnewsId%5D/route.ts): `src/app/api/news/[newsId]/route.ts`
- [Notice API](https://github.com/maruhxn/grinergy-web/blob/main/src/app/api/notice/%5BnoticeId%5D/route.ts): `src/app/api/notice/[noticeId]/route.ts`

### Files and operations

- [Download route](https://github.com/maruhxn/grinergy-web/blob/main/src/app/api/download/route.ts): `src/app/api/download/route.ts`
- **Cloudflare R2**
- [Error handling](https://github.com/maruhxn/grinergy-web/blob/main/src/libs/error-handler.ts): `src/libs/error-handler.ts`
- **Slack alerts**

### Other components

- **Visitor**

## Connections

- Visitor → Home page: visits (evidence: `src/app/(client)/(home)/page.tsx`)
- Visitor → Company pages: visits
- Visitor → Product page: visits (evidence: `src/app/(client)/product/page.tsx`)
- Visitor → News listing: browses (evidence: `src/app/(client)/news/page.tsx`)
- Visitor → Notice pages: browses (evidence: `src/app/(client)/notice/page.tsx`)
- Visitor → Contact page: visits (evidence: `src/app/(client)/contact/page.tsx`)
- Visitor → Investor page: visits
- Product page → Product visuals: renders (evidence: `src/app/(client)/product/page.tsx`)
- News listing → News data access: queries (evidence: `src/app/(client)/news/page.tsx`)
- Notice pages → Notice data access: queries (evidence: `src/app/(client)/notice/page.tsx`)
- News data access → MongoDB: queries (evidence: `src/libs/db-actions/news.ts`)
- Notice data access → MongoDB: queries (evidence: `src/libs/db-actions/notice.ts`)
- News API → MongoDB: reads (evidence: `src/app/api/news/[newsId]/route.ts`)
- Notice API → MongoDB: reads (evidence: `src/app/api/notice/[noticeId]/route.ts`)
- News management → News data access: manages
- Notice management → Notice data access: manages
- Admin login → News management: unlocks (evidence: `README.md`)
- Admin login → Notice management: unlocks (evidence: `README.md`)
- Download route → Cloudflare R2: fetches file (evidence: `src/app/api/download/route.ts`)
- Error handling → Slack alerts: reports errors (evidence: `src/libs/error-handler.ts`)
