# alex-guoba/golangnextjstemplate architecture

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

- Interactive diagram: https://gitdiagram.com/alex-guoba/golangnextjstemplate
- Repository: https://github.com/alex-guoba/golangnextjstemplate

## Overview

GolangNextFullStack is a blog-style full-stack template: visitors browse paginated articles and tags in a Next.js frontend, which fetches the Go API; the API exposes article and tag CRUD backed by MySQL. The backend separates HTTP routing, service/domain logic, and persistence, with article-tag associations represented in the domain. The README documents capabilities beyond sampled implementation excerpts. Dashed links indicate likely runtime relationships not shown in the supplied evidence; unsampled details are not inferred as confirmed calls.

Main entry points: [`backend/internal/domain/article.go`](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/domain/article.go) (Article domain), [`web/src/app/article/all/page.tsx`](https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/app/article/all/page.tsx) (Article listing), [`web/src/app/article/tags/page.tsx`](https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/app/article/tags/page.tsx) (Tag listing), [`backend/server/api/router.go`](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/server/api/router.go) (API router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web frontend"]
  node_article_page["Article listing<br/>[page.tsx]"]
  node_tag_page["Tag listing<br/>[page.tsx]"]
  node_article_fetch["Content fetch client<br/>[articles.ts]"]
  node_article_ui["Article list and paging<br/>[article-list.tsx]"]
  node_tag_ui["Tag list<br/>[tag-list.tsx]"]
end

subgraph group_api["HTTP API"]
  node_api_router["API router<br/>[router.go]"]
  node_article_handler["Article endpoints<br/>[article.go]"]
  node_tag_handler["Tag endpoints<br/>[tag.go]"]
  node_server["HTTP server<br/>[server.go]"]
end

subgraph group_domain["Content domain"]
  node_article_service["Article service<br/>[article.go]"]
  node_tag_service["Tag service<br/>[tag.go]"]
  node_article_domain["Article domain<br/>[article.go]"]
  node_tag_domain["Tag domain<br/>[tag.go]"]
end

subgraph group_data["Persistence"]
  node_article_dao["Article persistence<br/>[article.go]"]
  node_tag_dao["Tag persistence<br/>[tag.go]"]
  node_relation_dao["Article-tag links<br/>[article_tag.go]"]
  node_db_engine["MySQL connection<br/>[engine.go]"]
end

node_visitor(("Visitor"))
node_mysql[("MySQL database")]

node_visitor -->|"views"| node_article_page
node_visitor -->|"views"| node_tag_page
node_article_page -->|"fetches articles"| node_article_fetch
node_tag_page -->|"fetches tags"| node_article_fetch
node_article_page -->|"renders"| node_article_ui
node_tag_page -->|"renders"| node_tag_ui
node_article_fetch -->|"requests API"| node_server
node_server -->|"registers routes"| node_api_router
node_api_router -->|"routes articles"| node_article_handler
node_api_router -->|"routes tags"| node_tag_handler
node_article_handler -.->|"delegates"| node_article_service
node_tag_handler -.->|"delegates"| node_tag_service
node_article_service -.->|"uses domain"| node_article_domain
node_tag_service -.->|"uses domain"| node_tag_domain
node_article_domain -->|"queries and writes"| node_article_dao
node_article_domain -->|"loads tags"| node_tag_dao
node_article_domain -->|"loads associations"| node_relation_dao
node_db_engine -->|"opens connection"| node_mysql
node_server -->|"starts database"| node_db_engine

click node_article_page "https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/app/article/all/page.tsx"
click node_tag_page "https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/app/article/tags/page.tsx"
click node_article_fetch "https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/api/articles.ts"
click node_article_ui "https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/components/article/article-list.tsx"
click node_tag_ui "https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/components/article/tag-list.tsx"
click node_api_router "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/server/api/router.go"
click node_article_handler "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/server/api/v1/article.go"
click node_tag_handler "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/server/api/v1/tag.go"
click node_server "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/server/server.go"
click node_article_service "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/service/article.go"
click node_tag_service "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/service/tag.go"
click node_article_domain "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/domain/article.go"
click node_tag_domain "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/domain/tag.go"
click node_article_dao "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/dao/article.go"
click node_tag_dao "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/dao/tag.go"
click node_relation_dao "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/dao/article_tag.go"
click node_db_engine "https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/dao/engine.go"

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_article_page,node_tag_page,node_article_fetch,node_article_ui,node_tag_ui toneBlue
class node_api_router,node_article_handler,node_tag_handler,node_server,node_mysql toneAmber
class node_article_service,node_tag_service,node_article_domain,node_tag_domain toneMint
class node_article_dao,node_tag_dao,node_relation_dao,node_db_engine toneRose
class node_visitor toneIndigo
```

## Components

### Web frontend

- [Article listing](https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/app/article/all/page.tsx): `web/src/app/article/all/page.tsx`
- [Tag listing](https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/app/article/tags/page.tsx): `web/src/app/article/tags/page.tsx`
- [Content fetch client](https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/api/articles.ts): `web/src/api/articles.ts`
- [Article list and paging](https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/components/article/article-list.tsx): `web/src/components/article/article-list.tsx`
- [Tag list](https://github.com/alex-guoba/golangnextjstemplate/blob/main/web/src/components/article/tag-list.tsx): `web/src/components/article/tag-list.tsx`

### HTTP API

- [API router](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/server/api/router.go): `backend/server/api/router.go`
- [Article endpoints](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/server/api/v1/article.go): `backend/server/api/v1/article.go`
- [Tag endpoints](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/server/api/v1/tag.go): `backend/server/api/v1/tag.go`
- [HTTP server](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/server/server.go): `backend/server/server.go`

### Content domain

- [Article service](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/service/article.go): `backend/internal/service/article.go`
- [Tag service](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/service/tag.go): `backend/internal/service/tag.go`
- [Article domain](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/domain/article.go): `backend/internal/domain/article.go`
- [Tag domain](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/domain/tag.go): `backend/internal/domain/tag.go`

### Persistence

- [Article persistence](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/dao/article.go): `backend/internal/dao/article.go`
- [Tag persistence](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/dao/tag.go): `backend/internal/dao/tag.go`
- [Article-tag links](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/dao/article_tag.go): `backend/internal/dao/article_tag.go`
- [MySQL connection](https://github.com/alex-guoba/golangnextjstemplate/blob/main/backend/internal/dao/engine.go): `backend/internal/dao/engine.go`

### Other components

- **Visitor**
- **MySQL database**

## Connections

- Visitor → Article listing: views
- Visitor → Tag listing: views
- Article listing → Content fetch client: fetches articles (evidence: `web/src/app/article/all/page.tsx`)
- Tag listing → Content fetch client: fetches tags (evidence: `web/src/app/article/tags/page.tsx`)
- Article listing → Article list and paging: renders
- Tag listing → Tag list: renders
- Content fetch client → HTTP server: requests API
- HTTP server → API router: registers routes (evidence: `backend/server/server.go`)
- API router → Article endpoints: routes articles (evidence: `backend/server/api/router.go`)
- API router → Tag endpoints: routes tags (evidence: `backend/server/api/router.go`)
- Article endpoints → Article service: delegates
- Tag endpoints → Tag service: delegates
- Article service → Article domain: uses domain
- Tag service → Tag domain: uses domain
- Article domain → Article persistence: queries and writes (evidence: `backend/internal/domain/article.go`)
- Article domain → Tag persistence: loads tags (evidence: `backend/internal/domain/article.go`)
- Article domain → Article-tag links: loads associations (evidence: `backend/internal/domain/article.go`)
- MySQL connection → MySQL database: opens connection (evidence: `backend/internal/dao/engine.go`)
- HTTP server → MySQL connection: starts database
