# moolakarapasanga/smartsunil architecture

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

- Interactive diagram: https://gitdiagram.com/moolakarapasanga/smartsunil
- Repository: https://github.com/moolakarapasanga/smartsunil

## Overview

#### Purpose and runtime

A Next.js TypeScript security-research publishing site. It serves a portfolio/home experience plus an MDX-backed cybersecurity blog organized by category. The application runs on the Next.js server/runtime and is built/deployed through standard `next build` / `next start` commands.

Core application shell and global document behavior originate in:
- `app/layout.tsx`
- `app/page.tsx`
- `app/globals.css`

#### Route layer and entry points

The App Router defines public pages for the home, portfolio, blog index, post detail, category archives, sign-in, and a specialized birthday page. Dynamic route segments turn requested slugs/categories into content queries.

Primary routes:
- `app/blog/page.tsx`
- `app/blog/[slug]/page.tsx`
- `app/category/[category]/page.tsx`

Supporting platform routes provide error/not-found handling and crawler metadata:
- `app/error.tsx`
- `app/not-found.tsx`
- `app/sitemap.ts`

#### Content repository and publication model

Posts are filesystem-managed MDX documents under `content/posts/<category>/<slug>.mdx`; frontmatter supplies post metadata. This is a content-at-build/request boundary rather than a database or CMS integration. Adding a post requires only creating an MDX file, with no component registration.

Representative content and category partitioning:
- `content/posts/android/android-ssl-pinning.mdx`
- `content/posts/ai-security/understanding-prompt-injection.mdx`
- `content/posts/web/http-request-smuggling.mdx`

#### Content discovery, metadata, and rendering pipeline

Blog pages use library code to enumerate post files, parse metadata/content, resolve a post slug, and derive category listings. MDX is then rendered with a controlled component map, allowing article authors to use site-native callouts, code blocks, commands, and HTTP request/response displays.

Pipeline boundaries:
1. Route receives slug/category.
2. Content access layer reads and resolves MDX/frontmatter.
3. Blog UI composes article chrome/navigation.
4. MDX renderer maps article markup to approved React components.

Key paths:
- `lib/posts.ts`
- `lib/mdx.ts`
- `components/mdx/MDXComponents.tsx`

#### Blog presentation architecture

The blog layout separates reusable article cards/shell/navigation from route-specific data loading. Detail pages can provide sidebar and table-of-contents structures around rendered article content, while list/category pages reuse cards.

Key components:
- `components/blog/BlogShell.tsx`
- `components/blog/BlogCard.tsx`
- `components/blog/TableOfContents.tsx`

Categories are governed by shared configuration and library access rather than duplicated route constants:
- `config/categories.ts`
- `lib/categories.ts`
- `types/blog.ts`

#### Shared site chrome and interactive client features

A shared chrome layer supplies header, footer, responsive navigation, and likely wraps route content consistently. Home-specific sections are isolated from the blog system. Client interactions include theme switching, copy controls, logout, and birthday audio playback.

Key paths:
- `components/layout/SiteChrome.tsx`
- `components/layout/Header.tsx`
- `components/home/Hero.tsx`

#### Authentication boundary and external dependencies

Authentication is represented by login/logout route handlers and a sign-in page; the tree does not expose the backing identity provider, session store, or database. Environment configuration is expected via `.env.example`, making credentials/service selection deployment-provided rather than content-layer-owned.

Auth endpoints and consumer UI:
- `app/api/login/route.ts`
- `app/api/logout/route.ts`
- `app/sign-in/page.tsx`

There is no visible persistent data store, external CMS, or separate backend service in the repository tree; filesystem MDX is the primary content source.

Main entry points: [`app/layout.tsx`](https://github.com/moolakarapasanga/smartsunil/blob/main/app/layout.tsx) (App shell), [`app/blog/[slug]/page.tsx`](https://github.com/moolakarapasanga/smartsunil/blob/main/app/blog/%5Bslug%5D/page.tsx) (Post detail), [`lib/posts.ts`](https://github.com/moolakarapasanga/smartsunil/blob/main/lib/posts.ts) (Post discovery), [`app/blog/page.tsx`](https://github.com/moolakarapasanga/smartsunil/blob/main/app/blog/page.tsx) (Blog index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Next.js application"]
  node_next_runtime{{"Next.js runtime"}}
  node_app_shell["App shell<br/>root layout<br/>[layout.tsx]"]
  node_home["Home page<br/>route<br/>[page.tsx]"]
  node_blog_index["Blog index<br/>route<br/>[page.tsx]"]
  node_post_route["Post detail<br/>dynamic route<br/>[page.tsx]"]
  node_category_route["Category archive<br/>dynamic route<br/>[page.tsx]"]
  node_platform_routes["Error and crawler routes<br/>platform routes<br/>[error.tsx]"]
end

subgraph group_content["MDX publishing"]
  node_post_repository["Filesystem MDX posts<br/>content source"]
  node_post_access["Post discovery<br/>content library<br/>[posts.ts]"]
  node_category_model["Category model<br/>configuration and library<br/>[categories.ts]"]
  node_mdx_renderer["MDX renderer<br/>rendering library<br/>[mdx.ts]"]
end

subgraph group_ui["Presentation"]
  node_site_chrome["Site chrome<br/>shared layout<br/>[SiteChrome.tsx]"]
  node_home_sections["Home sections<br/>home UI<br/>[Hero.tsx]"]
  node_blog_shell["Blog shell<br/>blog UI<br/>[BlogShell.tsx]"]
  node_blog_cards["Blog cards<br/>blog UI<br/>[BlogCard.tsx]"]
  node_mdx_components["MDX component map<br/>MDX UI<br/>[MDXComponents.tsx]"]
end

subgraph group_auth["Authentication"]
  node_sign_in["Sign-in page<br/>route<br/>[page.tsx]"]
  node_login_api["Login endpoint<br/>route handler<br/>[route.ts]"]
  node_logout_api["Logout endpoint<br/>route handler<br/>[route.ts]"]
end

node_next_runtime -->|"serves"| node_app_shell
node_app_shell -->|"wraps"| node_site_chrome
node_app_shell -->|"hosts"| node_home
node_app_shell -->|"hosts"| node_blog_index
node_app_shell -->|"hosts"| node_post_route
node_app_shell -->|"hosts"| node_category_route
node_home -->|"composes"| node_home_sections
node_blog_index -->|"lists posts"| node_post_access
node_blog_index -->|"renders"| node_blog_cards
node_post_route -->|"resolves slug"| node_post_access
node_category_route -->|"lists category posts"| node_post_access
node_category_route -->|"validates category"| node_category_model
node_post_access -->|"reads MDX and frontmatter"| node_post_repository
node_post_route -->|"composes article"| node_blog_shell
node_post_route -->|"renders content"| node_mdx_renderer
node_mdx_renderer -->|"maps markup to"| node_mdx_components
node_sign_in -->|"submits credentials"| node_login_api
node_site_chrome -->|"logs out through"| node_logout_api
node_next_runtime -->|"handles"| node_platform_routes

click node_app_shell "https://github.com/moolakarapasanga/smartsunil/blob/main/app/layout.tsx"
click node_home "https://github.com/moolakarapasanga/smartsunil/blob/main/app/page.tsx"
click node_blog_index "https://github.com/moolakarapasanga/smartsunil/blob/main/app/blog/page.tsx"
click node_post_route "https://github.com/moolakarapasanga/smartsunil/blob/main/app/blog/%5Bslug%5D/page.tsx"
click node_category_route "https://github.com/moolakarapasanga/smartsunil/blob/main/app/category/%5Bcategory%5D/page.tsx"
click node_platform_routes "https://github.com/moolakarapasanga/smartsunil/blob/main/app/error.tsx"
click node_post_repository "https://github.com/moolakarapasanga/smartsunil/blob/main/content/posts/android/android-ssl-pinning.mdx"
click node_post_access "https://github.com/moolakarapasanga/smartsunil/blob/main/lib/posts.ts"
click node_category_model "https://github.com/moolakarapasanga/smartsunil/blob/main/config/categories.ts"
click node_mdx_renderer "https://github.com/moolakarapasanga/smartsunil/blob/main/lib/mdx.ts"
click node_site_chrome "https://github.com/moolakarapasanga/smartsunil/blob/main/components/layout/SiteChrome.tsx"
click node_home_sections "https://github.com/moolakarapasanga/smartsunil/blob/main/components/home/Hero.tsx"
click node_blog_shell "https://github.com/moolakarapasanga/smartsunil/blob/main/components/blog/BlogShell.tsx"
click node_blog_cards "https://github.com/moolakarapasanga/smartsunil/blob/main/components/blog/BlogCard.tsx"
click node_mdx_components "https://github.com/moolakarapasanga/smartsunil/blob/main/components/mdx/MDXComponents.tsx"
click node_sign_in "https://github.com/moolakarapasanga/smartsunil/blob/main/app/sign-in/page.tsx"
click node_login_api "https://github.com/moolakarapasanga/smartsunil/blob/main/app/api/login/route.ts"
click node_logout_api "https://github.com/moolakarapasanga/smartsunil/blob/main/app/api/logout/route.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_next_runtime,node_app_shell,node_home,node_blog_index,node_post_route,node_category_route,node_platform_routes toneBlue
class node_post_repository,node_post_access,node_category_model,node_mdx_renderer toneAmber
class node_site_chrome,node_home_sections,node_blog_shell,node_blog_cards,node_mdx_components toneMint
class node_sign_in,node_login_api,node_logout_api toneRose
```

## Components

### Next.js application

- **Next.js runtime**: runtime · Builds and serves the App Router application.
- [App shell](https://github.com/moolakarapasanga/smartsunil/blob/main/app/layout.tsx): root layout · Global document structure and styles. · `app/layout.tsx`
- [Home page](https://github.com/moolakarapasanga/smartsunil/blob/main/app/page.tsx): route · `app/page.tsx`
- [Blog index](https://github.com/moolakarapasanga/smartsunil/blob/main/app/blog/page.tsx): route · `app/blog/page.tsx`
- [Post detail](https://github.com/moolakarapasanga/smartsunil/blob/main/app/blog/%5Bslug%5D/page.tsx): dynamic route · Resolves a requested post slug. · `app/blog/[slug]/page.tsx`
- [Category archive](https://github.com/moolakarapasanga/smartsunil/blob/main/app/category/%5Bcategory%5D/page.tsx): dynamic route · Resolves a requested category. · `app/category/[category]/page.tsx`
- [Error and crawler routes](https://github.com/moolakarapasanga/smartsunil/blob/main/app/error.tsx): platform routes · Error, not-found, and sitemap handling. · `app/error.tsx`

### MDX publishing

- [Filesystem MDX posts](https://github.com/moolakarapasanga/smartsunil/blob/main/content/posts/android/android-ssl-pinning.mdx): content source · Category-partitioned MDX documents with frontmatter. · `content/posts/android/android-ssl-pinning.mdx`
- [Post discovery](https://github.com/moolakarapasanga/smartsunil/blob/main/lib/posts.ts): content library · Enumerates, parses, and resolves post content. · `lib/posts.ts`
- [Category model](https://github.com/moolakarapasanga/smartsunil/blob/main/config/categories.ts): configuration and library · Shared category definitions and lookup access. · `config/categories.ts`
- [MDX renderer](https://github.com/moolakarapasanga/smartsunil/blob/main/lib/mdx.ts): rendering library · Renders MDX through an approved component map. · `lib/mdx.ts`

### Presentation

- [Site chrome](https://github.com/moolakarapasanga/smartsunil/blob/main/components/layout/SiteChrome.tsx): shared layout · Shared header, footer, and responsive navigation. · `components/layout/SiteChrome.tsx`
- [Home sections](https://github.com/moolakarapasanga/smartsunil/blob/main/components/home/Hero.tsx): home UI · `components/home/Hero.tsx`
- [Blog shell](https://github.com/moolakarapasanga/smartsunil/blob/main/components/blog/BlogShell.tsx): blog UI · Article chrome and navigation composition. · `components/blog/BlogShell.tsx`
- [Blog cards](https://github.com/moolakarapasanga/smartsunil/blob/main/components/blog/BlogCard.tsx): blog UI · Reusable post previews for listing pages. · `components/blog/BlogCard.tsx`
- [MDX component map](https://github.com/moolakarapasanga/smartsunil/blob/main/components/mdx/MDXComponents.tsx): MDX UI · Site-native callouts, code, commands, and HTTP displays. · `components/mdx/MDXComponents.tsx`

### Authentication

- [Sign-in page](https://github.com/moolakarapasanga/smartsunil/blob/main/app/sign-in/page.tsx): route · `app/sign-in/page.tsx`
- [Login endpoint](https://github.com/moolakarapasanga/smartsunil/blob/main/app/api/login/route.ts): route handler · Identity provider and session backing are deployment-provided. · `app/api/login/route.ts`
- [Logout endpoint](https://github.com/moolakarapasanga/smartsunil/blob/main/app/api/logout/route.ts): route handler · `app/api/logout/route.ts`

## Connections

- Next.js runtime → App shell: serves
- App shell → Site chrome: wraps
- App shell → Home page: hosts
- App shell → Blog index: hosts
- App shell → Post detail: hosts
- App shell → Category archive: hosts
- Home page → Home sections: composes
- Blog index → Post discovery: lists posts
- Blog index → Blog cards: renders
- Post detail → Post discovery: resolves slug
- Category archive → Post discovery: lists category posts
- Category archive → Category model: validates category
- Post discovery → Filesystem MDX posts: reads MDX and frontmatter
- Post detail → Blog shell: composes article
- Post detail → MDX renderer: renders content
- MDX renderer → MDX component map: maps markup to
- Sign-in page → Login endpoint: submits credentials
- Site chrome → Logout endpoint: logs out through
- Next.js runtime → Error and crawler routes: handles
