# sultandevts/frontend_ssr_page_router_news_portal architecture

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

- Interactive diagram: https://gitdiagram.com/sultandevts/frontend_ssr_page_router_news_portal
- Repository: https://github.com/sultandevts/frontend_ssr_page_router_news_portal

## Overview

#### Purpose and runtime
This is a Next.js TypeScript news-portal frontend using the Pages Router and server-side rendering patterns. It renders a home feed, article pages, category listings, SEO endpoints, and fallback/error pages. Application-wide initialization and document markup are defined in `src/pages/_app.tsx`, `src/pages/_document.tsx`, and `src/pages/_error.tsx`.

#### Route entry points
The primary public routes are the home page (`src/pages/index.tsx`), dynamic article route (`src/pages/berita/[slug].tsx`), and dynamic category route (`src/pages/kategori/[slug].tsx`). Non-content routes include not-found handling in `src/pages/404.tsx` plus crawler-facing `src/pages/robots.ts` and `src/pages/sitemap.ts`.

#### Data boundary
`src/lib/api.ts` is the central API boundary for page data and likely isolates upstream content-service access from route rendering. Dynamic route parameters from article and category pages drive content retrieval; returned data is passed into server-rendered presentation components. Shared domain constants reside in `src/lib/constants.ts`.

#### Article rendering pipeline
Article routes compose article metadata/header, body, engagement controls, related content, comments, and inline monetization. The central presentation layer is split across `src/components/article/ArticleHeader.tsx`, `src/components/article/ArticleContent.tsx`, and `src/components/article/RelatedArticles.tsx`. Browser-only interaction is explicitly isolated in `src/components/article/LikeButton.client.tsx` and `src/components/article/ShareButton.client.tsx`.

#### Feed and category browsing
Reusable article-card rendering supports home and category feeds through `src/components/article/ArticleCard.tsx`. Category pages add category context, client-side filtering, and pagination through `src/components/category/CategoryHeader.tsx`, `src/components/category/FilterBar.client.tsx`, and `src/components/category/Pagination.tsx`. This separates initial route rendering from interactive refinement.

#### Shared shell, interaction, and SEO
The site shell is provided by `src/components/layout/Header.tsx`, `src/components/layout/NavMenu.tsx`, and `src/components/layout/Footer.tsx`; mobile navigation and search are client components in `src/components/layout/MobileNav.client.tsx` and `src/components/layout/SearchBar.client.tsx`. Structured-data output is centralized in `src/components/ui/JsonLd.tsx`, while global styling is loaded from `src/styles/globals.css`.

#### External integrations and client-only boundaries
Advertising is encapsulated behind client-side ad slot components, including `src/components/ads/AdSlot.client.tsx`, `src/components/ads/AdArticleMid.client.tsx`, and `src/components/ads/AdStickyFooter.client.tsx`, keeping third-party browser ad behavior outside server-rendered content components. Comment submission is similarly browser-bound in `src/components/comment/CommentForm.client.tsx`, with rendering coordinated by `src/components/comment/CommentSection.tsx`.

Main entry points: [`src/lib/api.ts`](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/lib/api.ts) (Content API), [`src/components/article/ArticleContent.tsx`](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/article/ArticleContent.tsx) (Article presentation), [`src/components/layout/Header.tsx`](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/layout/Header.tsx) (Site shell), [`src/pages/berita/[slug].tsx`](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/berita/%5Bslug%5D.tsx) (Article route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routes["Pages Router"]
  node_app["App initialization<br/>Next.js app wrapper<br/>[_app.tsx]"]
  node_document["Document markup<br/>Next.js document<br/>[_document.tsx]"]
  node_error["Error fallback<br/>error page<br/>[_error.tsx]"]
  node_home["Home feed<br/>page route<br/>[index.tsx]"]
  node_article_route["Article route<br/>dynamic page route<br/>[&#91;slug&#93;.tsx]"]
  node_category_route["Category route<br/>dynamic page route<br/>[&#91;slug&#93;.tsx]"]
  node_not_found["Not found<br/>404 page<br/>[404.tsx]"]
end

subgraph group_data["Data &amp; SEO"]
  node_api{{"Content API<br/>data boundary<br/>[api.ts]"}}
  node_constants["Domain constants<br/>shared constants<br/>[constants.ts]"]
  node_crawler_routes["Crawler endpoints<br/>robots and sitemap routes"]
  node_jsonld["Structured data<br/>SEO component<br/>[JsonLd.tsx]"]
end

subgraph group_presentation["Shared Presentation"]
  node_shell["Site shell<br/>layout components<br/>[Header.tsx]"]
  node_article_view["Article presentation<br/>article components<br/>[ArticleContent.tsx]"]
  node_article_cards["Article cards<br/>feed component<br/>[ArticleCard.tsx]"]
  node_category_view["Category presentation<br/>category components<br/>[CategoryHeader.tsx]"]
  node_global_styles["Global styles<br/>stylesheet<br/>[globals.css]"]
end

subgraph group_interactive["Client Integrations"]
  node_article_actions["Article actions<br/>client components"]
  node_category_filter["Feed filtering<br/>client component"]
  node_mobile_search["Mobile nav &amp; search<br/>client components"]
  node_ads["Ad slots<br/>client ad components<br/>[AdSlot.client.tsx]"]
  node_comments["Comments<br/>comment components<br/>[CommentSection.tsx]"]
end

node_app -->|"wraps"| node_shell
node_app -->|"loads"| node_global_styles
node_home -->|"loads feed"| node_api
node_home -->|"renders"| node_article_cards
node_article_route -->|"loads by slug"| node_api
node_article_route -->|"renders"| node_article_view
node_article_route -->|"emits"| node_jsonld
node_article_view -.->|"uses"| node_article_actions
node_article_view -.->|"embeds"| node_ads
node_article_view -->|"includes"| node_comments
node_category_route -->|"loads by slug"| node_api
node_category_route -->|"renders"| node_category_view
node_category_route -->|"renders feed"| node_article_cards
node_category_view -.->|"enables"| node_category_filter
node_shell -.->|"uses"| node_mobile_search
node_crawler_routes -->|"derives content metadata"| node_api
node_api -->|"uses"| node_constants
node_error -->|"uses"| node_shell
node_not_found -->|"uses"| node_shell

click node_app "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/_app.tsx"
click node_document "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/_document.tsx"
click node_error "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/_error.tsx"
click node_home "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/index.tsx"
click node_article_route "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/berita/%5Bslug%5D.tsx"
click node_category_route "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/kategori/%5Bslug%5D.tsx"
click node_not_found "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/404.tsx"
click node_api "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/lib/api.ts"
click node_constants "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/lib/constants.ts"
click node_shell "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/layout/Header.tsx"
click node_article_view "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/article/ArticleContent.tsx"
click node_article_cards "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/article/ArticleCard.tsx"
click node_category_view "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/category/CategoryHeader.tsx"
click node_jsonld "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/ui/JsonLd.tsx"
click node_global_styles "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/styles/globals.css"
click node_article_actions "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/article/LikeButton.client.tsx"
click node_category_filter "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/category/FilterBar.client.tsx"
click node_mobile_search "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/layout/MobileNav.client.tsx"
click node_ads "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/ads/AdSlot.client.tsx"
click node_comments "https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/comment/CommentSection.tsx"

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_app,node_document,node_error,node_home,node_article_route,node_category_route,node_not_found toneBlue
class node_api,node_constants,node_crawler_routes,node_jsonld toneAmber
class node_shell,node_article_view,node_article_cards,node_category_view,node_global_styles toneMint
class node_article_actions,node_category_filter,node_mobile_search,node_ads,node_comments toneRose
```

## Components

### Pages Router

Server-rendered route entry points and framework fallbacks.

- [App initialization](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/_app.tsx): Next.js app wrapper · `src/pages/_app.tsx`
- [Document markup](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/_document.tsx): Next.js document · `src/pages/_document.tsx`
- [Error fallback](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/_error.tsx): error page · `src/pages/_error.tsx`
- [Home feed](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/index.tsx): page route · `src/pages/index.tsx`
- [Article route](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/berita/%5Bslug%5D.tsx): dynamic page route · Resolves article content from the slug. · `src/pages/berita/[slug].tsx`
- [Category route](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/kategori/%5Bslug%5D.tsx): dynamic page route · Resolves category feed data from the slug. · `src/pages/kategori/[slug].tsx`
- [Not found](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/pages/404.tsx): 404 page · `src/pages/404.tsx`

### Data & SEO

Content-access boundary and crawler metadata endpoints.

- [Content API](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/lib/api.ts): data boundary · Isolates upstream content-service access. · `src/lib/api.ts`
- [Domain constants](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/lib/constants.ts): shared constants · `src/lib/constants.ts`
- **Crawler endpoints**: robots and sitemap routes
- [Structured data](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/ui/JsonLd.tsx): SEO component · `src/components/ui/JsonLd.tsx`

### Shared Presentation

Shell and reusable article rendering.

- [Site shell](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/layout/Header.tsx): layout components · Header, navigation menu, and footer. · `src/components/layout/Header.tsx`
- [Article presentation](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/article/ArticleContent.tsx): article components · Header, body, and related-article composition. · `src/components/article/ArticleContent.tsx`
- [Article cards](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/article/ArticleCard.tsx): feed component · Reusable cards for home and category feeds. · `src/components/article/ArticleCard.tsx`
- [Category presentation](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/category/CategoryHeader.tsx): category components · Category heading and pagination. · `src/components/category/CategoryHeader.tsx`
- [Global styles](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/styles/globals.css): stylesheet · `src/styles/globals.css`

### Client Integrations

Browser-only controls and third-party integrations.

- [Article actions](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/article/LikeButton.client.tsx): client components · Browser-only like and share controls. · `src/components/article/LikeButton.client.tsx`
- [Feed filtering](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/category/FilterBar.client.tsx): client component · Client-side category refinement. · `src/components/category/FilterBar.client.tsx`
- [Mobile nav & search](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/layout/MobileNav.client.tsx): client components · Browser-only mobile navigation and search. · `src/components/layout/MobileNav.client.tsx`
- [Ad slots](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/ads/AdSlot.client.tsx): client ad components · Encapsulates third-party browser advertising. · `src/components/ads/AdSlot.client.tsx`
- [Comments](https://github.com/sultandevts/frontend_ssr_page_router_news_portal/blob/main/src/components/comment/CommentSection.tsx): comment components · Server-rendered section with browser-only submission. · `src/components/comment/CommentSection.tsx`

## Connections

- App initialization → Site shell: wraps
- App initialization → Global styles: loads
- Home feed → Content API: loads feed
- Home feed → Article cards: renders
- Article route → Content API: loads by slug
- Article route → Article presentation: renders
- Article route → Structured data: emits
- Article presentation → Article actions: uses
- Article presentation → Ad slots: embeds
- Article presentation → Comments: includes
- Category route → Content API: loads by slug
- Category route → Category presentation: renders
- Category route → Article cards: renders feed
- Category presentation → Feed filtering: enables
- Site shell → Mobile nav & search: uses
- Crawler endpoints → Content API: derives content metadata
- Content API → Domain constants: uses
- Error fallback → Site shell: uses
- Not found → Site shell: uses
