# okeson453/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/okeson453/portfolio
- Repository: https://github.com/okeson453/portfolio

## Overview

#### Purpose and Runtime
Okeson is a cybersecurity-focused professional portfolio with public content, interactive security tools, user accounts, and blog administration. It runs as a Next.js 15 App Router application using React 19, TypeScript, Tailwind CSS, and server/API routes. Primary entry points are `app/layout.tsx`, `app/page.tsx`, and `middleware.ts`.

#### Public Site and Content Delivery
Public routes render portfolio sections, projects, experience, skills, legal pages, and contact content. The home page composes reusable presentation components; dedicated routes support project and blog detail pages. Blog content includes local MDX posts and route-based views.
- `app/page.tsx`
- `app/projects/[slug]/page.tsx`
- `app/blog/[slug]/page.tsx`

SEO/discovery are first-class route outputs through sitemaps, robots, RSS, and dynamic Open Graph image endpoints.
- `app/sitemap.ts`
- `app/feed.xml/route.ts`
- `app/api/og/blog/route.tsx`

#### Authentication, Accounts, and Protected Areas
Authentication is implemented through route handlers for registration, login, logout, JWT refresh, session lookup, email/password recovery, email verification, device management, and two-factor verification. Client account state and settings UI are separated into hooks and route pages. Middleware is the likely request-level boundary for route protection/security policy.
- `app/api/auth/login/route.ts`
- `app/api/auth/refresh/route.ts`
- `app/settings/security/two-factor/page.tsx`

Authenticated experiences include the user dashboard plus admin and dashboard-admin views.
- `app/dashboard/page.tsx`
- `app/admin/layout.tsx`
- `app/admin/blog/page.tsx`

#### Persistence and Operational APIs
Prisma defines the relational persistence model, migrations, and seed process; local database startup is encapsulated in a script. API handlers form the server boundary for account, comments, contact, search, feature flags, metrics, health, and chat operations.
- `prisma/schema.prisma`
- `prisma/migrations/add_refresh_token_model/migration.sql`
- `scripts/db-up.sh`

Email-related flows include contact delivery and blog subscriptions/history/scheduling. Resend is the declared production email provider; scheduled publishing is exposed through a cron route.
- `app/api/contact/route.ts`
- `app/api/blog/subscribe/route.ts`
- `app/api/cron/blog-publish/route.ts`

#### Interactive Client Features
Client-side components provide security scanning, password assessment, chat, comments, search, command palette, offline behavior, theme control, and settings forms. Shared hooks encapsulate client state such as auth, realtime behavior, feature flags, uploads, and two-factor flows.
- `components/SecurityScanner.tsx`
- `components/SecurityChatWidget.tsx`
- `hooks/useAuth.ts`

The root UI composes shared navigation, global UI, providers, and progressive/deferred sections, preserving server rendering where possible and isolating interactive behavior.
- `components/Navigation.tsx`
- `components/GlobalUIComponents.tsx`
- `components/providers/ClientInitializer.tsx`

#### Security, Reliability, and Observability Boundaries
Security-related providers and UI surface CSP nonce handling, client security initialization, security status, threat intelligence, and compliance indicators. Sentry client/server configuration supports error monitoring. Health and metrics routes provide operational integration points.
- `components/providers/CSPNonceProvider.tsx`
- `components/security/ThreatIntelligenceFeed.tsx`
- `app/api/health/route.ts`

#### Deployment and Delivery
The primary deployment target is Vercel, with repository workflows also covering CI/CD, E2E, Lighthouse, and optional Netlify deployment. A service worker and offline page support PWA/offline behavior. Environment configuration includes app URL, Resend credentials, and JWT secrets.
- `vercel.json`
- `.github/workflows/deploy-vercel.yml`
- `public/sw.js`

Main entry points: [`app/layout.tsx`](https://github.com/okeson453/portfolio/blob/main/app/layout.tsx) (App shell & home), [`prisma/schema.prisma`](https://github.com/okeson453/portfolio/blob/main/prisma/schema.prisma) (Prisma data layer), [`middleware.ts`](https://github.com/okeson453/portfolio/blob/main/middleware.ts) (Request security boundary), [`app/api/health/route.ts`](https://github.com/okeson453/portfolio/blob/main/app/api/health/route.ts) (Operational APIs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client Experience"]
  node_browser(("Browser / PWA<br/>client runtime<br/>[sw.js]"))
  node_interactive["Interactive features<br/>client components"]
  node_client_init["Client initialization<br/>provider"]
end

subgraph group_app["Next.js Application"]
  node_app_shell["App shell &amp; home<br/>App Router UI<br/>[layout.tsx]"]
  node_public_routes["Public content routes<br/>route pages<br/>[page.tsx]"]
  node_discovery["SEO &amp; discovery outputs<br/>route outputs<br/>[sitemap.ts]"]
  node_middleware{{"Request security boundary<br/>middleware<br/>[middleware.ts]"}}
  node_auth_api["Authentication API<br/>route handlers<br/>[route.ts]"]
  node_protected_ui["Dashboard &amp; admin<br/>protected routes<br/>[layout.tsx]"]
  node_operational_api["Operational APIs<br/>route handlers<br/>[route.ts]"]
  node_email_jobs["Email &amp; publishing jobs<br/>route handlers<br/>[route.ts]"]
end

subgraph group_data["Data &amp; External Services"]
  node_prisma["Prisma data layer<br/>ORM &amp; schema<br/>[schema.prisma]"]
  node_database[("Relational database<br/>persistence")]
  node_resend["Resend<br/>email provider"]
end

subgraph group_delivery["Delivery &amp; Operations"]
  node_observability["Monitoring &amp; health<br/>observability"]
  node_vercel["Vercel deployment<br/>hosting platform<br/>[vercel.json]"]
  node_ci["CI/CD workflow<br/>GitHub Actions<br/>[deploy-vercel.yml]"]
end

node_browser -->|"requests"| node_middleware
node_middleware -->|"allows public routes"| node_app_shell
node_middleware -->|"auth requests"| node_auth_api
node_middleware -->|"guards access"| node_protected_ui
node_app_shell -->|"links to content"| node_public_routes
node_app_shell -->|"hydrates providers"| node_client_init
node_client_init -->|"enables"| node_interactive
node_interactive -->|"uses"| node_operational_api
node_interactive -->|"account state"| node_auth_api
node_auth_api -->|"reads and writes"| node_prisma
node_protected_ui -->|"manages content and accounts"| node_prisma
node_operational_api -->|"persists application data"| node_prisma
node_prisma -->|"queries"| node_database
node_email_jobs -->|"loads subscriptions and posts"| node_prisma
node_email_jobs -->|"sends email"| node_resend
node_operational_api -->|"delivers contact mail"| node_resend
node_app_shell -.->|"publishes discovery metadata"| node_discovery
node_operational_api -->|"health and metrics"| node_observability
node_ci -->|"deploys"| node_vercel
node_vercel -.->|"hosts"| node_app_shell

click node_browser "https://github.com/okeson453/portfolio/blob/main/public/sw.js"
click node_interactive "https://github.com/okeson453/portfolio/blob/main/components/SecurityScanner.tsx"
click node_client_init "https://github.com/okeson453/portfolio/blob/main/components/providers/ClientInitializer.tsx"
click node_app_shell "https://github.com/okeson453/portfolio/blob/main/app/layout.tsx"
click node_public_routes "https://github.com/okeson453/portfolio/blob/main/app/blog/%5Bslug%5D/page.tsx"
click node_discovery "https://github.com/okeson453/portfolio/blob/main/app/sitemap.ts"
click node_middleware "https://github.com/okeson453/portfolio/blob/main/middleware.ts"
click node_auth_api "https://github.com/okeson453/portfolio/blob/main/app/api/auth/login/route.ts"
click node_protected_ui "https://github.com/okeson453/portfolio/blob/main/app/admin/layout.tsx"
click node_operational_api "https://github.com/okeson453/portfolio/blob/main/app/api/health/route.ts"
click node_email_jobs "https://github.com/okeson453/portfolio/blob/main/app/api/cron/blog-publish/route.ts"
click node_prisma "https://github.com/okeson453/portfolio/blob/main/prisma/schema.prisma"
click node_vercel "https://github.com/okeson453/portfolio/blob/main/vercel.json"
click node_ci "https://github.com/okeson453/portfolio/blob/main/.github/workflows/deploy-vercel.yml"

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_browser,node_interactive,node_client_init toneBlue
class node_app_shell,node_public_routes,node_discovery,node_middleware,node_auth_api,node_protected_ui,node_operational_api,node_email_jobs toneAmber
class node_prisma,node_database,node_resend toneMint
class node_observability,node_vercel,node_ci toneRose
```

## Components

### Client Experience

- [Browser / PWA](https://github.com/okeson453/portfolio/blob/main/public/sw.js): client runtime · Offline-capable public and authenticated experience. · `public/sw.js`
- [Interactive features](https://github.com/okeson453/portfolio/blob/main/components/SecurityScanner.tsx): client components · Security tools, chat, comments, search, and settings UI. · `components/SecurityScanner.tsx`
- [Client initialization](https://github.com/okeson453/portfolio/blob/main/components/providers/ClientInitializer.tsx): provider · Bootstraps client-side global behavior and providers. · `components/providers/ClientInitializer.tsx`

### Next.js Application

- [App shell & home](https://github.com/okeson453/portfolio/blob/main/app/layout.tsx): App Router UI · Root layout and composed public portfolio experience. · `app/layout.tsx`
- [Public content routes](https://github.com/okeson453/portfolio/blob/main/app/blog/%5Bslug%5D/page.tsx): route pages · Project and MDX-backed blog detail views. · `app/blog/[slug]/page.tsx`
- [SEO & discovery outputs](https://github.com/okeson453/portfolio/blob/main/app/sitemap.ts): route outputs · Sitemap, RSS, and dynamic social images. · `app/sitemap.ts`
- [Request security boundary](https://github.com/okeson453/portfolio/blob/main/middleware.ts): middleware · Applies route protection and request-level security policy. · `middleware.ts`
- [Authentication API](https://github.com/okeson453/portfolio/blob/main/app/api/auth/login/route.ts): route handlers · Login, registration, sessions, refresh, recovery, verification, and 2FA. · `app/api/auth/login/route.ts`
- [Dashboard & admin](https://github.com/okeson453/portfolio/blob/main/app/admin/layout.tsx): protected routes · User dashboard, account settings, and blog administration. · `app/admin/layout.tsx`
- [Operational APIs](https://github.com/okeson453/portfolio/blob/main/app/api/health/route.ts): route handlers · Contact, comments, search, flags, metrics, health, and chat. · `app/api/health/route.ts`
- [Email & publishing jobs](https://github.com/okeson453/portfolio/blob/main/app/api/cron/blog-publish/route.ts): route handlers · Subscriptions and scheduled blog publishing. · `app/api/cron/blog-publish/route.ts`

### Data & External Services

- [Prisma data layer](https://github.com/okeson453/portfolio/blob/main/prisma/schema.prisma): ORM & schema · Relational models, migrations, and seeded persistence. · `prisma/schema.prisma`
- **Relational database**: persistence
- **Resend**: email provider · Production email delivery provider.

### Delivery & Operations

- **Monitoring & health**: observability · Sentry error monitoring plus health and metrics integration.
- [Vercel deployment](https://github.com/okeson453/portfolio/blob/main/vercel.json): hosting platform · Primary production deployment target. · `vercel.json`
- [CI/CD workflow](https://github.com/okeson453/portfolio/blob/main/.github/workflows/deploy-vercel.yml): GitHub Actions · Build and deployment automation. · `.github/workflows/deploy-vercel.yml`

## Connections

- Browser / PWA → Request security boundary: requests
- Request security boundary → App shell & home: allows public routes
- Request security boundary → Authentication API: auth requests
- Request security boundary → Dashboard & admin: guards access
- App shell & home → Public content routes: links to content
- App shell & home → Client initialization: hydrates providers
- Client initialization → Interactive features: enables
- Interactive features → Operational APIs: uses
- Interactive features → Authentication API: account state
- Authentication API → Prisma data layer: reads and writes
- Dashboard & admin → Prisma data layer: manages content and accounts
- Operational APIs → Prisma data layer: persists application data
- Prisma data layer → Relational database: queries
- Email & publishing jobs → Prisma data layer: loads subscriptions and posts
- Email & publishing jobs → Resend: sends email
- Operational APIs → Resend: delivers contact mail
- App shell & home → SEO & discovery outputs: publishes discovery metadata
- Operational APIs → Monitoring & health: health and metrics
- CI/CD workflow → Vercel deployment: deploys
- Vercel deployment → App shell & home: hosts
