# sultandevts/frontend_ssr_news_portal architecture

> Architecture diagram of the GitHub repository sultandevts/frontend_ssr_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_news_portal
- Repository: https://github.com/sultandevts/frontend_ssr_news_portal

## Overview

#### Purpose and entry points
This is a Next.js, TypeScript news/content site organized with the App Router. It serves a homepage, article detail pages, and category listing pages, with SEO endpoints and site-wide layout handling.

- `app/page.tsx`
- `app/berita/[slug]/page.tsx`
- `app/kategori/[slug]/page.tsx`
- `app/layout.tsx`

#### Route and rendering layer
`app/layout.tsx` establishes the shared application shell; route-level pages render the major content views. Dynamic `[slug]` segments represent article and category identifiers. Framework error and missing-page boundaries are explicitly provided.

- `app/error.tsx`
- `app/not-found.tsx`
- `app/berita/[slug]/page.tsx`
- `app/kategori/[slug]/page.tsx`

#### Content/API boundary
`lib/api.ts` is the central boundary for obtaining news, article, or category data. Page routes and server-rendered content components should depend on this layer rather than embedding backend access directly. `.env` likely supplies deployment-specific API or service configuration.

- `lib/api.ts`
- `lib/constants.ts`
- `.env`

#### Article presentation pipeline
An article route is composed from focused article components: metadata/header, body content, category identification, related content, and client-side social/engagement actions. This separates server-renderable article structure from browser-interactive controls.

- `components/article/ArticleHeader.tsx`
- `components/article/ArticleContent.tsx`
- `components/article/RelatedArticles.tsx`
- `components/article/LikeButton.client.tsx`
- `components/article/ShareButton.client.tsx`

#### Category and feed experience
Category pages provide category context, filtering, paginated article discovery, and reusable article cards. Filtering is explicitly client-side, while pagination and card rendering form the feed/listing layer shared with content discovery surfaces.

- `components/category/CategoryHeader.tsx`
- `components/category/FilterBar.client.tsx`
- `components/category/Pagination.tsx`
- `components/article/ArticleCard.tsx`

#### Engagement and monetization boundaries
Comments are isolated into a section, list, and browser-side submission form, allowing interactive submission without making article rendering wholly client-side. Advertising is similarly isolated behind client components and slot abstractions, supporting placement-specific inventory without coupling ad runtime logic to page content.

- `components/comment/CommentSection.tsx`
- `components/comment/CommentForm.client.tsx`
- `components/ads/AdSlot.client.tsx`
- `components/ads/AdArticleMid.client.tsx`
- `components/ads/AdStickyFooter.client.tsx`

#### Shared UX and SEO infrastructure
Shared navigation, search, and responsive mobile controls live in the layout component family. Search is client-side. SEO is exposed through Next route metadata endpoints for crawler directives and sitemap generation; JSON-LD supports structured-data insertion.

- `components/layout/Header.tsx`
- `components/layout/SearchBar.client.tsx`
- `components/layout/MobileNav.client.tsx`
- `app/robots.ts`
- `app/sitemap.ts`
- `components/ui/JsonLd.tsx`

Main entry points: [`app/berita/[slug]/page.tsx`](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/berita/%5Bslug%5D/page.tsx) (Article page [slug]), [`lib/api.ts`](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/lib/api.ts) (Content API), [`app/kategori/[slug]/page.tsx`](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/kategori/%5Bslug%5D/page.tsx) (Category page [slug]), [`app/layout.tsx`](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/layout.tsx) (Root layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routes["App Router"]
  node_root_layout["Root layout<br/>Next layout<br/>[layout.tsx]"]
  node_home_page["Homepage<br/>route page<br/>[page.tsx]"]
  node_article_page["Article page &#91;slug&#93;<br/>dynamic route<br/>[page.tsx]"]
  node_category_page["Category page &#91;slug&#93;<br/>dynamic route<br/>[page.tsx]"]
  node_route_boundaries["Error &amp; not-found<br/>route boundaries<br/>[error.tsx]"]
end

subgraph group_content["Content boundary"]
  node_api{{"Content API<br/>data access<br/>[api.ts]"}}
  node_api_config["API configuration<br/>environment<br/>[.env]"]
end

subgraph group_article["Article experience"]
  node_article_view["Article structure<br/>article components<br/>[ArticleHeader.tsx]"]
  node_related_articles["Related articles<br/>article component"]
  node_article_actions["Like &amp; share controls<br/>client components"]
  node_comments["Comments<br/>comment components<br/>[CommentSection.tsx]"]
  node_article_ads["Article ad slots<br/>client ad components"]
end

subgraph group_discovery["Category &amp; discovery"]
  node_category_context["Category header<br/>category component<br/>[CategoryHeader.tsx]"]
  node_feed_controls["Filter &amp; pagination<br/>feed controls"]
  node_article_cards["Article cards<br/>feed component<br/>[ArticleCard.tsx]"]
end

subgraph group_shared["Shared UX &amp; SEO"]
  node_site_navigation["Header &amp; navigation<br/>layout components<br/>[Header.tsx]"]
  node_seo_endpoints["Robots &amp; sitemap<br/>SEO routes<br/>[robots.ts]"]
  node_jsonld["JSON-LD<br/>structured data<br/>[JsonLd.tsx]"]
  node_footer_ad["Sticky footer ad<br/>client ad component"]
end

node_api_config -.->|"configures"| node_api
node_root_layout -->|"renders"| node_site_navigation
node_root_layout -->|"places"| node_footer_ad
node_root_layout -->|"wraps routes with"| node_route_boundaries
node_home_page -->|"loads content"| node_api
node_home_page -->|"renders feed"| node_article_cards
node_article_page -->|"loads article"| node_api
node_article_page -->|"composes"| node_article_view
node_article_page -->|"includes"| node_related_articles
node_article_page -->|"includes"| node_article_actions
node_article_page -->|"includes"| node_comments
node_article_page -->|"places"| node_article_ads
node_article_page -->|"adds metadata"| node_jsonld
node_category_page -->|"loads category feed"| node_api
node_category_page -->|"renders"| node_category_context
node_category_page -->|"uses"| node_feed_controls
node_category_page -->|"renders"| node_article_cards
node_feed_controls -->|"filters and pages"| node_article_cards
node_seo_endpoints -.->|"sources URLs"| node_api

click node_root_layout "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/layout.tsx"
click node_home_page "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/page.tsx"
click node_article_page "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/berita/%5Bslug%5D/page.tsx"
click node_category_page "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/kategori/%5Bslug%5D/page.tsx"
click node_route_boundaries "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/error.tsx"
click node_api "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/lib/api.ts"
click node_api_config "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/.env"
click node_article_view "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/article/ArticleHeader.tsx"
click node_related_articles "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/article/RelatedArticles.tsx"
click node_article_actions "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/article/LikeButton.client.tsx"
click node_comments "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/comment/CommentSection.tsx"
click node_article_ads "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/ads/AdArticleMid.client.tsx"
click node_category_context "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/category/CategoryHeader.tsx"
click node_feed_controls "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/category/FilterBar.client.tsx"
click node_article_cards "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/article/ArticleCard.tsx"
click node_site_navigation "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/layout/Header.tsx"
click node_seo_endpoints "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/robots.ts"
click node_jsonld "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/ui/JsonLd.tsx"
click node_footer_ad "https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/ads/AdStickyFooter.client.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_root_layout,node_home_page,node_article_page,node_category_page,node_route_boundaries toneBlue
class node_api,node_api_config toneAmber
class node_article_view,node_related_articles,node_article_actions,node_comments,node_article_ads toneMint
class node_category_context,node_feed_controls,node_article_cards toneRose
class node_site_navigation,node_seo_endpoints,node_jsonld,node_footer_ad toneIndigo
```

## Components

### App Router

Server-rendered pages and framework boundaries.

- [Root layout](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/layout.tsx): Next layout · Establishes the shared application shell. · `app/layout.tsx`
- [Homepage](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/page.tsx): route page · `app/page.tsx`
- [Article page [slug]](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/berita/%5Bslug%5D/page.tsx): dynamic route · `app/berita/[slug]/page.tsx`
- [Category page [slug]](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/kategori/%5Bslug%5D/page.tsx): dynamic route · `app/kategori/[slug]/page.tsx`
- [Error & not-found](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/error.tsx): route boundaries · Framework error and missing-page handling. · `app/error.tsx`

### Content boundary

Shared data access and deployment configuration.

- [Content API](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/lib/api.ts): data access · Central source for news, article, and category data. · `lib/api.ts`
- [API configuration](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/.env): environment · Deployment-specific service settings. · `.env`

### Article experience

Article rendering and interactive engagement.

- [Article structure](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/article/ArticleHeader.tsx): article components · Header and body server-rendered article presentation. · `components/article/ArticleHeader.tsx`
- [Related articles](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/article/RelatedArticles.tsx): article component · `components/article/RelatedArticles.tsx`
- [Like & share controls](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/article/LikeButton.client.tsx): client components · Browser-interactive social actions. · `components/article/LikeButton.client.tsx`
- [Comments](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/comment/CommentSection.tsx): comment components · Section and client-side submission form. · `components/comment/CommentSection.tsx`
- [Article ad slots](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/ads/AdArticleMid.client.tsx): client ad components · Mid-article and sticky inventory placements. · `components/ads/AdArticleMid.client.tsx`

### Category & discovery

Listing, filtering, and feed components.

- [Category header](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/category/CategoryHeader.tsx): category component · `components/category/CategoryHeader.tsx`
- [Filter & pagination](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/category/FilterBar.client.tsx): feed controls · Client filtering and paginated discovery. · `components/category/FilterBar.client.tsx`
- [Article cards](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/article/ArticleCard.tsx): feed component · Reusable article listing presentation. · `components/article/ArticleCard.tsx`

### Shared UX & SEO

Site shell, navigation, and crawler endpoints.

- [Header & navigation](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/layout/Header.tsx): layout components · Includes client search and mobile navigation. · `components/layout/Header.tsx`
- [Robots & sitemap](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/app/robots.ts): SEO routes · Crawler directives and sitemap generation. · `app/robots.ts`
- [JSON-LD](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/ui/JsonLd.tsx): structured data · Injects structured metadata. · `components/ui/JsonLd.tsx`
- [Sticky footer ad](https://github.com/sultandevts/frontend_ssr_news_portal/blob/main/components/ads/AdStickyFooter.client.tsx): client ad component · `components/ads/AdStickyFooter.client.tsx`

## Connections

- API configuration → Content API: configures
- Root layout → Header & navigation: renders
- Root layout → Sticky footer ad: places
- Root layout → Error & not-found: wraps routes with
- Homepage → Content API: loads content
- Homepage → Article cards: renders feed
- Article page [slug] → Content API: loads article
- Article page [slug] → Article structure: composes
- Article page [slug] → Related articles: includes
- Article page [slug] → Like & share controls: includes
- Article page [slug] → Comments: includes
- Article page [slug] → Article ad slots: places
- Article page [slug] → JSON-LD: adds metadata
- Category page [slug] → Content API: loads category feed
- Category page [slug] → Category header: renders
- Category page [slug] → Filter & pagination: uses
- Category page [slug] → Article cards: renders
- Filter & pagination → Article cards: filters and pages
- Robots & sitemap → Content API: sources URLs
