8000 GitHub - ahmadmdabit/ahmadmdabit.github.io: This is a personal portfolio website for Ahmet Fatihoglu, a Senior Software Developer and Architect. The website is a dynamic, data-driven single-page application built with a modern React and TypeScript stack. It features an integrated AI chat assistant that answers questions about Ahmet's professional background using document-based RAG. · GitHub
[go: up one dir, main page]

Skip to content

About

This is a personal portfolio website for Ahmet Fatihoglu, a Senior Software Developer and Architect. The website is a dynamic, data-driven single-page application built with a modern React and TypeScript stack. It features an integrated AI chat assistant that answers questions about Ahmet's professional background using document-based RAG.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Ahmet Fatihoglu's Personal Website

https://ahmadmdabit.github.io

Overview

This is a personal portfolio website for Ahmet Fatihoglu, a Senior Software Developer and Architect. The website is a dynamic, data-driven single-page application built with a modern React and TypeScript stack. It features an integrated AI chat assistant that answers questions about Ahmet's professional background using document-based retrieval augmented generation (RAG).

Architecture Overview

Architecture Diagrams

The following diagrams illustrate the key architectures and data flows. For the complete set of 15 detailed diagrams including component hierarchies, RAG workflow sequences, compaction workflows, routing structures, and security layers, see ARCHITECTURE-DIAGRAMS.md.

1. High-Level System Architecture

graph TB
    subgraph "Client (Browser)"
        UI["React 19 SPA\n+ CSP Meta Tag"]
        Router["React Router v7"]
        Theme["MUI Theme + Emotion"]
        I18n["i18next + react-i18next"]
    end

    subgraph "Data Layer"
        I18nData[["i18n JSON Files\nlocales/en, tr/translation.json"]]
        PublicData[["Public Markdown Files\ndata/Resume-*.md\nProjects-*.md\nFAQ-*.md"]]
        Assets[["Static Assets\nimages, fonts, PDFs"]]
    end

    subgraph "AI Chat System"
        ChatPopup["ChatPopup\nPresentational Wrapper"]
        Hooks["src/hooks/\n6 Custom Hooks"]
        Constants["src/constants/chat.ts\nLLM + Compaction Config"]
        MiniSearch[["MiniSearch Index\nBilingual EN + TR"]]
        PuterJS["heyputer/puter.js\nLLM Streaming"]
        DOMPurify["DOMPurify\nHardened Config"]
    end

    subgraph "External Services"
        GitHubPages["GitHub Pages\nDeployment"]
        PuterAPI["Puter.ai Cloud\nLLM Inference"]
    end

    UI --> Router
    UI --> Theme
    UI --> I18n
    I18n --> I18nData
    UI --> PublicData
    UI --> Assets

    ChatPopup --> Hooks
    Hooks --> MiniSearch
    Hooks --> PuterJS
    Hooks --> DOMPurify
    Hooks --> PublicData
    Hooks --> Constants
    PuterJS --> PuterAPI

    I18nData -.->|Hash-busted loading\nVITE_LOCALE_HASH| UI
    Assets -.->|Hash-busted loading\nVITE_ASSET_HASH| UI

    UI -->|Deploy| GitHubPages
Loading

2. Component Hierarchy (Atomic Design)

graph TD
    App["App.tsx\nOutlet + Loading + Footer"]
    Router["router.tsx\nRoutes Config"]

    subgraph "Pages"
        HomePage["HomePage.tsx"]
        PrivacyPage["PrivacyPage.tsx"]
        TermsOfServicePage["TermsOfServicePage.tsx"]
        ErrorPage["ErrorPage.tsx"]
    end

    subgraph "Molecules (Composite)"
        ActivityBar["ActivityBar\nNav + PersonPhoto + LangSelector + ChatBtn"]
        ChatPopup["ChatPopup\nPresentational Wrapper\n~220 LOC"]
        StatusBar["StatusBar\nPage + Name/Title + StatusIndicator"]
        LanguageSelector["LanguageSelector\nEN/TR Toggle"]
    end

    subgraph "Hooks (Chat Logic)"
        UseDocIdx["useDocumentIndex\nLoad + Chunk + Index"]
        UseSearch["useSearch\nGeneral + FAQ Search"]
        UseAutoScroll["useAutoScroll\nSmart Scroll"]
        UseCompact["useCompaction\nBackground Queue"]
        UseConv["useConversationHistory\nSend/Receive Stream"]
        UseKeys["useKeyboardShortcuts\nEsc/Enter/Focus"]
    end

    subgraph "Atoms (Primitive)"
        ActivityButton["ActivityButton"]
   
10000
     PersonPhoto["PersonPhoto"]
        ChatAssistantIcon["ChatAssistantIcon"]
        StatusIndicator["StatusIndicator"]
        CloseButton["CloseButton"]
        BoldedKeyword["BoldedKeyword"]
        AnimatedBadge["AnimatedBadge"]
        BoldedText["BoldedText"]
    end

    subgraph "Resume Sections"
        AboutSection["AboutSection"]
        SkillsSection["SkillsSection"]
        ExperienceSection["ExperienceSection"]
        ProjectsSection["ProjectsSection"]
        EducationSection["EducationSection"]
        CertificationsSection["CertificationsSection"]
        LanguagesSection["LanguagesSection"]
        ContactSection["ContactSection"]
    end

    subgraph "Resume Items"
        SummaryContent["SummaryContent"]
        CVDownloadSection["CVDownloadSection"]
        ExperienceItem["ExperienceItem"]
        ProjectCard["ProjectCard"]
        ContactList["ContactList"]
        ContactForm["ContactForm"]
        PrivacyAccordion["PrivacyAccordion"]
        AnimatedBadgeComponent["AnimatedBadgeComponent"]
    end

    %% Relationships
    main.tsx --> App
    App --> Router
    Router --> HomePage
    Router --> PrivacyPage
    Router --> TermsOfServicePage
    Router --> ErrorPage

    HomePage --> ActivityBar
    HomePage --> StatusBar
    HomePage --> ChatPopup
    HomePage --> Outlet

    Outlet --> AboutSection
    Outlet --> SkillsSection
    Outlet --> ExperienceSection
    Outlet --> ProjectsSection
    Outlet --> EducationSection
    Outlet --> CertificationsSection
    Outlet --> LanguagesSection
    Outlet --> ContactSection

    ActivityBar --> PersonPhoto
    ActivityBar --> ActivityButton
    ActivityBar --> LanguageSelector
    ActivityBar --> ChatAssistantIcon

    AboutSection --> SummaryContent
    AboutSection --> CVDownloadSection
    AboutSection --> AnimatedBadgeComponent
    AboutSection --> BoldedKeyword

    ExperienceSection --> ExperienceItem
    ProjectsSection --> ProjectCard
    ContactSection --> ContactList
    ContactSection --> ContactForm
    ContactSection --> PrivacyAccordion

    ChatPopup --> StatusIndicator
    ChatPopup --> CloseButton
    ChatPopup --> MarkdownRenderer["MarkdownRenderer Atom"]
    ChatPopup --> UseDocIdx
    ChatPopup --> UseSearch
    ChatPopup --> UseAutoScroll
    ChatPopup --> UseCompact
    ChatPopup --> UseConv
    ChatPopup --> UseKeys
Loading

3. Chat System - RAG Workflow (Query Flow & Tools)

flowchart TD
    UserMsg["User Sends Message"]

    UserMsg --> BuildContext["Build Initial Context\nLazy PII Hydration\nisContactInfoQuery check"]
    BuildContext --> PIICheck{"Contact Info\nRequested?"}
    PIICheck -->|Yes| FullResume["Full Resume\nw/ Email/Phone/Address"]
    PIICheck -->|No| SanitizedResume["Sanitized Resume\n[EMAIL REDACTED]\n[PHONE REDACTED]\n[ADDRESS REDACTED]"]

    FullResume --> InitialCtx["Initial Context:\nRESUME + ALL PROJECTS +\nFAQ Questions List Only"]
    SanitizedResume --> InitialCtx

    InitialCtx --> EmptyGuard{"Content\nLoaded?"}
    EmptyGuard -->|No| NoInfo["Return:\nnoRelevantInformationFound"]
    EmptyGuard -->|Yes| CallLLM["Call puter.ai.chat()\nStreaming + Tools"]

    CallLLM --> StreamLoop["Stream Response Loop"]
    StreamLoop --> ParseChunk["Parse Stream Chunk"]
    ParseChunk --> CheckType{"Chunk Type?"}

    CheckType -->|text| AppendText["Append to\nassistantText\nUpdate UI"]
    CheckType -->|usage| TrackUsage["Parse Usage\nprompt, completion,\ninput_cache_read"]
    CheckType -->|reasoning| DropReasoning["DROP - Prevent\nCoT Leakage"]
    CheckType -->|tool_use| CaptureTool["Capture expandSearch\nquery and searchType"]

    AppendText --> StreamLoop
    TrackUsage --> StreamLoop
    DropReasoning --> StreamLoop
    CaptureTool --> StreamLoop

    StreamLoop --> StreamEnd{"Stream\nComplete?"}
    StreamEnd -->|No| StreamLoop
    StreamEnd -->|Yes| ToolCheck{"Tool Call\nRequested?"}

    ToolCheck -->|No| PersistMsg["Persist to\napiHistoryRef\nUpdate Token Usage"]
    ToolCheck -->|Yes| ExecTool["Execute expandSearch"]

    ExecTool --> SearchType{"searchType?"}
    SearchType -->|broader| SearchFAQ["searchFAQ()\nDedicated FAQ Index\nfuzzy: 0.1, boost: 3x"]
    SearchType -->|crossLocale| SearchCross["performSearch()\nOther Locale Only\nfuzzy: 0.3, max: 8"]

    SearchFAQ --> FAQMatch{"FAQ\nMatched?"}
    FAQMatch -->|Yes| FAQResult["Return FAQ Q+A\nChunks"]
    FAQMatch -->|No| GeneralSearch["performSearch()\nGeneral MiniSearch\nfuzzy: 0.4, max: 10"]

    SearchCross --> CrossResult["Return Cross-Locale\nResults"]

    FAQResult --> BuildExpanded["Build Expanded Context"]
    GeneralSearch --> BuildExpanded
    CrossResult --> BuildExpanded

    BuildExpanded --> CallLLM2["Second puter.ai.chat()\nFollow-up with\nExpanded Context"]
    CallLLM2 --> StreamLoop2["Stream Final Response\nSame parsing logic"]
    StreamLoop2 --> PersistMsg

    PersistMsg --> CompactCheck["checkAndEnqueueCompaction\nREAL token usage:\nprompt + input_cache_read\n> 75% of active context?"]
    CompactCheck -->|Yes| EnqueueJob["Enqueue Compaction Job\nqueueMicrotask()"]
    CompactCheck -->|No| Ready["Ready for Next Turn"]

    EnqueueJob --> CompactionQueue["Compaction Queue\nSequential Processing"]
    CompactionQueue --> CompactProcess["compactHistoryWithLLM()\nPrompt: Extract facts\nPreserve specifics\nNo tables, no fabrication"]
    CompactProcess --> CompactSuccess{"Success?"}
    CompactSuccess -->|Yes| UpdateHistory["apiHistoryRef = \n[Summary System] +\nLast 2 Turns\nReset Token Usage"]
    CompactSuccess -->|No| RetryLogic["Exponential Backoff\n1s, 2s, 4s\nMax 3 Attempts"]
    RetryLogic -->|Retry| CompactionQueue
    RetryLogic -->|Max Retries| FallbackTrunc["Fallback:\nTruncate to\nLast 2 Turns"]

    UpdateHistory --> Ready
    FallbackTrunc --> Ready

    style UserMsg fill:#e1f5fe
    style Ready fill:#c8e6c9
    style NoInfo fill:#ffcdd2
    style DropReasoning fill:#fff3e0
    style EnqueueJob fill:#e8eaf6
    style CompactProcess fill:#e8eaf6
Loading

Technology Stack

  • Core Framework: React 19 with TypeScript
  • Build Tool: Vite with vite-tsconfig-paths for module aliasing
  • UI Library: Material-UI (MUI) v7 with Emotion for styling
  • Routing: React Router v7 with nested layouts and SPA navigation
  • State Management: Local component state managed by React Hooks (useState, useCallback, useEffect, useRef)
  • Internationalization: i18next with react-i18next and i18next-browser-languagedetector (EN/TR)
  • SEO: React 19 native <title>/<meta>/<link> hoisting (no react-helmet-async), JSON-LD structured data (WebSite, Person, BreadcrumbList), Open Graph + Twitter Cards, canonical URLs, path-prefixed hreflang (en/tr/x-default), robots.txt, sitemap.xml
  • Prerendering: gs-pro-cli --full-html for SPA route prerendering (20 routes: 10 en + 10 tr) — lightweight alternative to puppeteer/react-snap
  • AI Chat: @heyputer/puter.js for LLM inference with streaming, tool-calling, and abort controller support; automatic multi-model fallback via src/lib/ModelFallback.ts (pinned "known good" model, HTTP-200 error-body detection, free/paid interleaved attempt order)
  • Document Search: minisearch for full-text indexing and retrieval of resume/FAQ/project documents
  • Markdown Rendering: marked with dompurify for safe HTML rendering of AI responses (hardened config)
  • Styling: Custom scrollbar styling via src/index.css (cross-browser thin scrollbar); Design System: DESIGN.md (Google Design Token Spec v1 alpha) defining colors, typography, spacing, shapes, and component tokens with token references
  • Deployment: GitHub Pages via gh-pages

Main Modules and Responsibilities

The project follows an Atomic Design methodology:

  • src/data — Static data files and content modules:
    • pagesData.ts — Page metadata and navigation configuration
    • resumeData.ts (removed; content fully centralized in i18n JSON locale files)
    • Resume_EN_*.md (removed from src/assets/; single-source-of-truth is now public/data/Resume-EN.md)
  • src/ — Root level: App.tsx (layout with Outlet + loading state + footer with privacy/terms links), main.tsx (entry point with ThemeProvider), router.tsx (route config), theme/index.ts (MUI theme), index.css (global styles)
  • src/types — TypeScript interfaces for core data structures (ResumeData, Project, Experience, etc.) plus chat-specific types (Chat.types.ts: DocumentSource, Message, UsageInfo, CompactionJob, SearchIndex, FallbackModel, FallbackState, etc.). FallbackState is readonly at the type level — its pinnedIndex is mutated only inside ModelFallback.ts (single cast site), making the ownership contract compiler-enforced.
  • src/constants — Feature-specific constants extracted for reuse:
    • chat.ts — LLM model catalog (AvailableLLMModels: 20+ free/paid models with context window, isFree flag, and attempt order), default model constants (LLMModel, LLMModelContextWindow), compaction settings (CompactionThresholdRatio, CompactionMaxRetries, CompactionRetryBaseDelayMs), and DocumentSources (EN/TR markdown file paths)
  • src/lib — Framework-agnostic chat runtime utilities:
    • ModelFallback.ts — Automatic model fallback library shared by the chat stream and compaction paths. Owns all FallbackState mutation (pinModel / advancePinOnError); exports shared abort detection (isAbort) and pure, unit-testable classifiers (isModelError, isErrorShapedResponse, getAttemptOrder)
  • src/hooks — Custom React hooks encapsulating all chat subsystem logic, composed via a barrel export (hooks/index.ts):
    • useDocumentIndex — Loads, chunks, and indexes markdown documents (Resume, Projects, FAQ) into a bilingual MiniSearch index; also builds per-locale FAQ indexes
    • useSearch — General MiniSearch query with locale filtering + dedicated FAQ exact-match search against pre-built FAQ index
    • useAutoScroll — Smart auto-scroll with user-scroll-up detection and manual reset
    • useCompaction — Background conversation compaction with sequential queue, exponential backoff retry, abort support, and model-fallback-aware summarization (tracks the active fallback-pinned model, not static constants)
    • useConversationHistory — Full send/receive loop (streaming, tool calls, PII hydration, usage tracking, compaction triggering) with automatic multi-model fallback; exposes the live currentModel/contextWindow pair kept atomically in sync with the pinned model
    • useKeyboardShortcuts — Escape-to-close, Enter-to-send (IME-safe), auto-focus on mount
  • src/atoms — Smallest reusable components (e.g., ActivityButton, BoldedKeyword, StatusIndicator, CloseButton). Context-unaware, no business logic.
  • src/molecules — Compositions of atoms forming complex components:
    • ActivityBar — Navigation sidebar with NavLink routing
    • ChatPopup — Thin presentational wrapper for the AI-powered chat assistant; delegates all logic to the src/hooks subsystem (see Chat System below)
    • StatusBar — Bottom status bar showing page name and title, with responsive mobile/tablet support
  • src/components/resume — Main UI components organized into:
    • sections/ — AboutSection, SkillsSection, ExperienceSection, EducationSection, ContactSection, ProjectsSection, CertificationsSection
    • items/ — ProjectCard, ContactList, ContactForm, PrivacyAccordion, SummaryContent, CVDownloadSection
  • src/pages — Page components rendered via Router Outlet (HomePage, PrivacyPage + PrivacyContent/PrivacySections shared blocks, TermsOfServicePage, ErrorPage)
  • src/i18n — Internationalization configuration with locale JSON files (en/translation.json, tr/translation.json), schema validation, and asset hashing for cache busting. locales.ts provides SUPPORTED_LOCALES, DEFAULT_LOCALE, isLocale(), and extractLocaleFromPath() helpers.
  • src/seo — SEO module with shared types (types.ts: LooseT), constants (constants.ts: SITE_URL, OG_IMAGE, getOgImage()), per-route meta builders (pageMeta.ts: PAGE_META registry, buildFullMeta(), routeKeyFromPath()), and JSON-LD structured data (JsonLd.tsx: WebSite + Person + BreadcrumbList schemas).
  • public/robots.txt — Crawl rules referencing the sitemap.
  • public/sitemap.xml — 20 URLs (10 en + 10 tr) with lastmod/changefreq/priority.
  • scripts/prerender.mjs — SPA prerenderer using gs-pro-cli --full-html to capture document.documentElement.outerHTML for each route. Spawns vite.js directly (no .cmd shim) via promisify-child-process (eager-promise guards, SIGTERM + taskkill tree-kill shutdown). Parallel workers (CPU count − 1) with per-route watchdog, retry, mtime freshness guard, graceful SIGINT/SIGTERM shutdown, and a post-run CDP tab sweep. Configurable via GS_PRO_CLI env var.
  • scripts/update-sitemap.mjs — Build step refreshing <lastmod> to today for all non-yearly URLs (yearly privacy/terms entries keep real content-change dates).
  • public/data — Markdown documents served as data sources for the AI chat:
    • Resume-EN.md / Resume-TR.md — Structured resume content
    • Projects-EN.md / Projects-TR.md — Detailed project descriptions
    • FAQ-EN.md / FAQ-TR.md — 110 interview questions with answers and alternative phrasings (10 per question)
    • Resume-EN.pdf / Resume-TR.pdf — Downloadable PDF resumes
    • Resume-EN.txt / Resume-TR.txt — Plain-text resume versions

Data Flow

Resume Rendering

  1. All resume content is defined in i18n translation JSON files (EN/TR).
  2. Components use useTranslation with returnObjects: true to fetch structured data.
  3. Content flows hierarchically: HomePage → Section components → Item components via props.

Chat System (RAG Workflow)

The chat assistant implements a Retrieval Augmented Generation workflow with production-grade reliability and advanced context management:

  1. Document Loading — On chat open, loadAndIndexDocuments() fetches markdown documents for both locales in parallel (Promise.all):

    • Resume (EN + TR) — Lazy PII hydration: PII (email, phone, address) only included when user explicitly asks for contact info; otherwise stripped before LLM context
    • Projects (EN + TR) — Split by headings (#, ##, ###)
    • FAQ with 110 questions + alternative phrasings (EN + TR) — One chunk per Q&A pair
  2. Chunking & Indexing — Documents are chunked with locale tags and merged into a single bilingual MiniSearch index (fuzzy 0.2, prefix matching, title boost 2×). Index built once on first open, persists for session lifetime. DocumentSources is immutable (as const); loaded content stored in loadedDocumentsRef per locale — no mutation of source config.

  3. Model Configuration & Automatic Fallback — src/constants/chat.ts defines AvailableLLMModels, a catalog of free and paid models (each with context window, isFree flag, and attempt order). src/lib/ModelFallback.ts routes every LLM call through a fallback loop instead of hardcoding a single model:

    • Attempt order — pinned ("known good") model first, then remaining models in a 2-free / 1-paid interleaved cadence, each tier sorted by order
    • Pinning — a model is pinned on the first provable success (first stream chunk / resolved completion); the UI's currentModel + contextWindow pair syncs atomically at that moment via onPin
    • Failure classification — isModelError() pattern-matches puter.js plain-object throws (rate limiting, upstream unavailability, model-not-found); auth errors and malformed requests fail fast without retrying
    • HTTP-200 error bodies — puter.js resolves (does not reject) some failed requests; isErrorShapedResponse() detects resolved error bodies and re-throws yielded ndjson error lines so they enter the same fallback path
    • Streaming safety — chatStreamWithFallback is an async generator that iterates inside the fallback loop: a model error before any visible text/tool output transparently advances to the next model; once output is visible, the error propagates (retrying would duplicate it)
    • Un-pinning — a model error on the pinned model advances the pin (advancePinOnError) so a persistently broken model is not retried first on every call
    • Abort handling — shared isAbort() checks the signal itself plus duck-typed name === "AbortError" (puter.js throws plain objects, not Error instances); user aborts never consume fallback attempts or the compaction retry queue
    • Chat and background compaction share one FallbackState (chat + compaction both use the "known good" model); its fields are readonly at the type level and mutated only inside the library
  4. Query Flow:

    • User message → Full resume + projects content for current locale as initial context (empty-context guard prevents LLM call if docs failed to load)
    • FAQ content provided as numbered question list only (answers not inline)
    • LLM receives system prompt + document context + full conversation history (no arbitrary turn trimming; compaction handles context limits) via puter.ai.chat()
    • If initial context insufficient, LLM calls expandSearch tool (validated at stream time)
    • Dedicated FAQ path: searchFAQ() searches FAQ chunks only (tight fuzzy 0.1, title boost 3×) before falling back to general MiniSearch
    • crossLocale searches only the other locale (not all locales)
    • Expanded results sent back to LLM for final streaming response
  5. Background Conversation Compaction — Non-blocking, queued compaction with exponential backoff:

    • Trigger: Real token usage (prompt + input_cache_read from completed turns) exceeds 75% of the active model's context window (fallback-aware, not a static constant)
    • Queue: Jobs enqueued with unique ID, attempt counter, timestamp; processed sequentially via queueMicrotask
    • Compaction: LLM summarizes full history preserving all specific details (experience, projects, skills, technologies) using strict constraints (no tables, zero fabrication, vertical bulleted lists)
    • Result: Compact history = [Conversation Summary] + last 2 turns; token usage ref reset using heuristic split (60% prompt / 40% cache)
    • Retry: Up to 3 attempts with exponential backoff (1s, 2s, 4s); on failure, fallback to simple truncation (last 2 turns)
    • UI: UsageIndicator shows real-time token counts (Prompt / Cache / Total / %), model badge, and "HistorySummarizing..." spinner pill during compaction
    • Abort: Active compaction aborted on unmount or new user message
  6. Token Usage Tracking — Parses usage events from Puter.js stream chunks (end of stream): { prompt, completion, input_cache_read }. Accumulated per turn; drives compaction threshold and usage indicator display.

  7. Streaming & Rendering — Responses stream in real-time with abort controller support. MarkdownRenderer uses hardened DOMPurify (forbids javascript: URIs, dangerous tags/attributes, allows target/rel).

  8. Session Persistence — Messages + API history persist across popup close/reopen and locale changes. API history excludes initial greeting to prevent language bias. Full page refresh clears session.

  9. System Prompt Rewrite — Strict constraints: Language Lock (respond in current message's language only), Zero Fabrication, No Tables, Conciseness. Tool Use & FAQ Protocol (Sufficient/FAQ Match/Insufficient/Empty Result). Capability & Evidence Discipline (explicit docs only, skill ≠ evidence). Meta-Request & Formatting Handling.

  10. Accessibility & UX:

    • Modal dialog with aria-modal="true", aria-hidden={!open}, Escape-to-close
    • Input disabled while closed; send button (IconButton) alongside Enter-to-send
    • IME composition support (won't send on Enter during composition)
    • Auto-scroll to bottom (behavior: "auto"), pauses when user scrolls up
    • Loading/indexing indicators
  11. Security & Privacy:

    • Lazy PII hydration: Contact info only injected when explicitly requested
    • Explicit chat consent: First message blocked until the user checks the Privacy Notice consent box (choice persisted in sessionStorage for the browsing session); consent gates the send button, Enter key, and global shortcuts
    • DOMPurify hardened config blocks XSS vectors
    • Tool call validation prevents malformed/partial stream chunks from crashing UI
    • Real token usage from provider — no heuristic estimation for compaction trigger

Key Technical Achievements

The codebase has been systematically engineered to deliver a production-grade, secure, and context-aware system. Below are the key engineering achievements validated in the latest releases:

Achievement Area Technical Implementation & Solution Impact & Verification
Deterministic Context Compaction Built a non-blocking queue system (queueMicrotask) executing background history compaction via LLM summarizing. Triggers at 75% of the active model's context window (fallback-aware). Includes exponential backoff retry policies. Eliminates token overflows and preserves exact, high-fidelity professional state without arbitrary turn-truncation.
Automatic Multi-Model Fallback Built src/lib/ModelFallback.ts: an async-generator streaming fallback across a 20+ model catalog (pinned "known good" model, 2-free/1-paid interleaved attempt order). Handles puter.js resolved HTTP-200 error bodies, yielded ndjson error lines, plain-object throws (duck-typed abort detection via shared isAbort), and un-pins broken models. FallbackState is readonly at the type level — mutation confined to the library. Survives per-model rate limits and outages transparently; compaction and chat share the last known-good model, and the UI's model/context-window badge stays atomically synced.
Bilingual RAG Workflow Implemented a single, unified MiniSearch index containing both English and Turkish documentation. Integrated a dual-mode expandSearch tool to trigger targeted FAQ or cross-locale search workflows. Enables instant, low-latency document and FAQ retrieval with seamless mid-conversation bilingual switching.
3-Tier Capability Validation Built a strict, structured logic chain: Tier 1 (Project/Job Experience), Tier 2 (Technical Skills list only), and Tier 3 (Not Mentioned fallback) to handle all capability questions. Eliminates LLM overclaiming and context-bleed, forcing verifiable project evidence mapping and preventing hallucinations.
Real-time Telemetry Tracking Intercepts native Puter.js stream chunks to parse actual provider-reported usages (prompt, completion, input_cache_read) directly in the client state. Replaces inaccurate heuristic token estimates with absolute, real-time context telemetry on a dynamic visual dashboard.
Privacy-First Data Isolation Engineered a lazy PII hydration system that programmatically sanitizes all email, phone, and address footprints from RAG sources. Hydrates PII only on explicit contact requests. Minimizes LLM exposure to sensitive PII and reduces the footprint size sent over third-party APIs.
Stream Filtering & Security Configured reactive chunk interceptors to strip raw type: "reasoning" tokens from streamed outputs. Hardened DOMPurify HTML rendering to block nested XSS vectors. Protects internal Chain-of-Thought (CoT) logic from leaking to the client interface and secures dynamic markdown rendering.
Google Design Token Spec Created a centralized, terminal-inspired design spec (DESIGN.md v1 alpha) with a strictly mapped custom MUI palette and Cascadia Code monospace grid system. Decouples presentational styles from semantic layout variables, ensuring robust cross-browser responsive rendering.
Chat Hook Extraction Decomposed the monolithic ChatPopup molecule (~880 LOC) into 6 single-responsibility custom hooks (useDocumentIndex, useSearch, useAutoScroll, useCompaction, useConversationHistory, useKeyboardShortcuts) and a constants module (src/constants/chat.ts). ChatPopup is now a thin presentational wrapper; all business logic is independently testable, reusable, and follows the Single Responsibility Principle.
Content Security Policy Added a strict CSP meta tag (default-src 'self', explicit connect-src allowlist for Puter.ai and Getform/Forminit, style-src allowing Google Fonts) to mitigate XSS and data exfiltration vectors. Defense-in-depth security layer restricting resource loading to trusted origins.

Design Patterns and Best Practices

  • Data-Driven UI: Resume content is dynamically generated from centralized i18n translation files, making updates easy and consistent across languages.
  • Atomic Design: Components organized by complexity, promoting reusability and maintainability.
  • Centralized Theming: All styling values managed through MUI theme in App.tsx.
  • Design System: DESIGN.md (Google Design Token Spec v1 alpha) — single source of truth for colors, typography, spacing, rounded corners, and component tokens. All component definitions use token references ({colors.primary}, {typography.body-md}) instead of literal values. Defines usage indicator, usage bar, compaction indicator, and model badge component specs with safe/warning/danger semantic color coding.
  • Performance Optimization:
    • Memoization: Presentational components wrapped in React.memo
    • Bundle Size: Direct-path MUI imports for optimal tree-shaking
    • Asset Hashing: Locale and public asset hashes (VITE_LOCALE_HASH, VITE_ASSET_HASH) for cache invalidation
  • Path Aliasing: @/ alias for absolute imports throughout the codebase.
  • Internationalization: Full EN/TR support with browser language auto-detected locale, hash-busted locale loading, and bilingual chat index (both locales indexed in a single MiniSearch instance for seamless mid-conversation language switching). Translation schema validation via translation.schema.ts.
  • Responsive Design: StatusBar uses useMediaQuery to hide page indicators on mobile/tablet.
  • Accessibility: Chat popup includes role="dialog", aria-label, and keyboard navigation support.
  • Security: AI responses sanitized via DOMPurify before rendering; EXTERNAL-tagged FAQ entries (placeholders for answers not presented in the resume document) are indexed but can be filtered out via the commented-out guard in chunkFAQDocument; extractFAQQuestions() safely parses only question titles without exposing answer content in the initial prompt.
  • Centralized Theming: All styling values managed through MUI theme in src/theme/index.ts and applied via ThemeProvider in main.tsx.

Key Recent Changes

Date Change Description
2026-09-04 Terms Route, Chat Consent & Privacy Rework Terms of Service: New localized TermsOfServicePage with full SEO wiring (route, page meta, JSON-LD, sitemap entries, prerender captures; sitemap/prerender grow 18→20 URLs). Privacy: Extracted shared PrivacySections reused by the privacy page and the contact-form PrivacyAccordion (replaces nested Outlet + deleted ReplacePlaceholders atom); Forminit rebrand note folded into section 4; notice rewritten to cover AI chat data flows. Chat consent: Explicit Privacy Notice checkbox (sessionStorage-persisted) gates send button, Enter key, and shortcuts before the first message. Build fixes: puter.js 2.6 ChatOptionsWithSignal intersection type; prerender.mjs migrated from node:child_process to promisify-child-process (direct vite.js spawn, eager-promise guards, SIGTERM + taskkill shutdown); new scripts/update-sitemap.mjs (skips yearly entries). Assets: public/*.png consolidated under public/assets/imgs/ with matching hashed output paths and updated references.
2026-09-01 SEO & Prerendering Routing: Migrated to path-prefixed locale routing (/en/skills, /tr/skills) via /:locale param with validateLocale loader redirecting invalid locales to /en. Root / redirects to /en. Per-route meta: React 19 native <title>/<meta>/<link> hoisting (no react-helmet-async) via src/seo/pageMeta.ts registry with unique title/description/canonical/OG/Twitter Cards per route. JSON-LD structured data: WebSite + Person + BreadcrumbList schemas via src/seo/JsonLd.tsx. hreflang: Path-prefixed en/tr/x-default alternates. Static assets: public/robots.txt (crawl rules + sitemap ref), public/sitemap.xml (18 URLs: 9 en + 9 tr with lastmod/changefreq/priority). Prerendering: scripts/prerender.mjs using gs-pro-cli --full-html to capture document.documentElement.outerHTML for all 18 routes — lightweight alternative to puppeteer/react-snap. i18n: Locale extracted from URL path on init; LanguageSelector preserves current section on locale switch. Navigation: Manual normalizePath comparison for trailing-slash-insensitive active state; section-based animation key prevents replay on locale switch. Shared modules: src/seo/types.ts (LooseT), src/seo/constants.ts (SITE_URL, OG_IMAGE, getOgImage). HTML: Preconnect (Google Fonts), theme-color, noindex on 404/ErrorPage, <base href="/"> on both index.html and 404.html.
2026-09-01 Automatic Multi-Model Fallback New src/lib/ModelFallback.ts: automatic model fallback for both streaming chat and background compaction across the AvailableLLMModels catalog (20+ free/paid models in src/constants/chat.ts, default switched to minimax/minimax-m3:free, 1M context). Async-generator streaming fallback (pinned "known good" model first, 2-free/1-paid interleaved attempt order; transparent retry until visible output). Hardened against puter.js runtime quirks: resolved HTTP-200 error bodies, yielded ndjson error lines, plain-object (non-Error) throws, non-iterable stream responses, and providers that ignore stream. Pinned model un-pins on proven failure (advancePinOnError); shared isAbort() duck-typed abort detection replaces triplicated checks. FallbackState (new in Chat.types.ts) is readonly at the type level — mutation confined to the library. useConversationHistory now owns fallback state internally and exposes live currentModel/contextWindow; blank compaction summaries fail the job instead of silently replacing history; empty streaming placeholders are removed before error bubbles render.
2026-06-12 Chat Hook Extraction & CSP Hook Decomposition: Refactored ChatPopup.tsx from a monolithic class (~880 LOC) into a thin presentational wrapper delegating to 6 custom hooks: useDocumentIndex (document loading, chunking, bilingual MiniSearch indexing), useSearch (general + FAQ search), useAutoScroll (smart scroll with user-scroll detection), useCompaction (background queue-based compaction with exponential backoff), useConversationHistory (full send/receive streaming, tool calls, PII hydration, usage tracking), useKeyboardShortcuts (Escape, Enter IME-safe, auto-focus). Extracted chat constants (src/constants/chat.ts): LLM models, compaction thresholds, and DocumentSources. Security: Added Content-Security-Policy meta tag with strict origin allowlist (default-src 'self', connect-src for Puter.ai/GetForm, style-src for Google Fonts). Types: Extended CompactionJob with tokenUsage field for accurate token reset after compaction.
2026-06-11 Design System & Chat v2 Major Feature Release & Security Hardening: Added DESIGN.md (Google Design Token Spec v1 alpha) with a terminal-inspired theme. ChatPopup v2: Implemented queued background conversation compaction (75% trigger) with real-time stream token tracking (prompt/completion/cache) and lazy PII hydration. Evidence Discipline & Anti-Fabrication: Hardened system prompts with a strict 3-Tier Capability Discipline Framework, forcing explicit project tracing (Tier 1), skill isolation (Tier 2), and non-documented fallbacks (Tier 3). Resolved Flutter/Dart mobile mapping omissions and WPF desktop framework classification errors. Telemetry & Security: Intercepted stream chunks to drop reasoning tokens (type: "reasoning") preventing client-side CoT leakage; hardened DOMPurify HTML rendering. Optimized combined procedural command overrides within the conciseness loop. UI additions: Added UsageIndicator with real-time token counts (Prompt/Cache/Total/%), model badge, and "HistorySummarizing..." spinner pill. i18n: Added EN/TR keys: historySummarizing, aIMayMakeMistakes, usage.{prompt,cache,total,percent}. Theme additions: Added warning color (#ad8837). Removed behavior: Removed arbitrary 20-turn history trim; compaction now handles context limits. Ecosystem Modernization: Upgraded the core development toolchain to Vite 8 (using native tsconfig resolution), ESLint 10, TypeScript 6, and i18next 26. Pruned legacy animation dependencies (Framer Motion, React Awesome Reveal). W3C ARIA Compliance: Fixed "aria-hidden on focused element" warnings by programmatically blurring the CloseButton on active click events. UI & Privacy Refinements: Anchored and expanded the ChatPopup viewport height (91.5vh), refactored helper disclaimers into a unified bullet list, and introduced a third-party AI data privacy warning. Hardened system instructions to forbid printing the literal string "HARD STOP".
2026-06-10 ChatPopup Reliability Fixed abort handling (empty assistant message persisted in history causing Puter.js bad_request on next send; abort controller cleanup on unmount; wasAborted flag in both stream loops; partial assistant bubble removed from UI on stop). Smart auto-scroll: pauses when user scrolls >80px from bottom, resumes on new message send, uses behavior: "auto" instead of instant. Callback stability: draftRef eliminates draft from send()'s useCallback deps, preventing recreation on every keystroke. Added sendMessage i18n key + Send button.
2026-06-09 ChatPopup Strengthening Restored StatusIndicator and page name to the StatusBar. Fixed 21 critical/security/accessibility issues in ChatPopup.tsx: empty-context guard, history trimming (20 turns), DOMPurify strengthening, immutable DocumentSources, dedicated FAQ search path, IME composition fix, aria-modal/aria-hidden, greeting removal from API history, scrollIntoView behavior, TypeScript ref fix, robust FAQ regex, ### heading support, removed unnecessary useCallback, Send button, PII redaction, crossLocale=other-locale only, Escape key, AbortSignal passthrough
2026-06-05 UI Fixes Removed StatusIndicator from StatusBar; removed page name from StatusBar on mobile/tablet via useMediaQuery
2026-04-24 Resume Update Added Distributed File Fragmentor project (.NET 9, Clean Architecture, CQRS, EF Core 9); removed E-Store project to keep portfolio focused
2025-12-12 Resume Update Added SystemProcesses project (.NET, WPF, MVVM) to translation files
2025-10-21 Resume Update Added Aided (SolidJS-inspired JS library) and Meeting System (.NET 9, Angular 20+, Docker) projects; refreshed skills list; removed older Sinav Oluşturma project
2025-09-30 Resume & Error Boundary Updated resume content with new Architect title and skill reorganization; added Exchange and Market projects; added phone number to contact info; added ErrorBoundary component for graceful error handling; bumped package version to 1.0.0
2025-09-19 Deployment Fixes Added 404.html for GitHub Pages SPA fallback; set base: '/' and sourcemap: false in Vite config; moved ThemeProvider and CssBaseline to main.tsx; enhanced PrivacyPage layout
2025-09-18 AI Chat Integration ChatPopup.tsx completely rewritten with Puter.js LLM streaming, MiniSearch bilingual merged index (both locales in single index), FAQ question list with expandSearch-on-demand, markdown rendering via marked + DOMPurify, abort controls, and session persistence across locale changes
2025-09-18 i18n & Routing Migrated from state-based navigation to declarative React Router v7 routes; resume sections now fetch data directly from i18n translations via returnObjects: true; standardized env vars (VITE_ASSET_HASH, VITE_LOCALE_HASH)
2025-09-18 Component Refactoring Extracted AboutSection into SummaryContent, AnimatedBadgeComponent, CVDownloadSection; extracted ContactSection into ContactList, ContactForm, PrivacyAccordion; reduced AboutSection from ~180 to ~60 lines and ContactSection from ~185 to ~20 lines
2025-09-17 Asset Hashing Added scripts/hash-locale.mjs using SHA1 for combined locale + public asset hashes; dynamic ?v=hash cache busting for images, PDFs, favicons, and locale JSON files
2025-09-17 Certification Badge Added Microsoft certification badge to AboutSection with i18n support; extended i18n schema
2025-09-16 Project Scaffold Initial React + Vite + TypeScript setup; Atomic Design component structure; i18n with EN/TR support; resume sections (About, Skills, Experience, Education, Contact, Certifications, Languages); ActivityBar navigation; StatusBar; ChatPopup placeholder; public assets (images, favicons, PDFs)
2026-06-13 CSP Fix for 404 Added font-src data: to CSP meta tag in 404.html to allow base64 fonts used by MUI Emotion; ensures consistent styling on GitHub Pages 404 page.
2026-07-01 Portfolio Overhaul & New Projects Master-Detail Projects Section: Redesigned ProjectsSection with scrollable project list + hero detail card, virtual scrolling, and hero variant for ProjectCard. Wrapped ExperienceItem and SkillsSection in Cards with hover glow effects. Added page transition animations (fadeSlideIn) to HomePage. Content Update: Updated resume to reflect 10+ years experience, added SOLID Principles, added new projects (Personal Website RAG, Architectly, MCP CLI), removed old projects (RepoAIfy, AI Utils, E-Store). Updated certification year 2023→2025 with live reference link. Renamed certificate files (underscore→hyphen). Added DOCX resume files and updated PDF/TXT/MD for EN and TR. Synced EN/TR translation JSON with all changes. Removed asset hash query param from CV download URLs. New Projects Added: SevenZipRunner (.NET library for 7‑Zip invocation with platform‑aware resolution and named profiles), MCP Hub Web Interface (zero‑build Koa.js dashboard for monitoring MCP Hub servers), Semantic Tool Router CLI (TypeScript/Node.js CLI solving "fat agent" problem with offline indexing and just‑in‑time context injection). Renamed Semantic Tool Router CLI to Semantic Tool Router across all locales and sources.
2026-07-03 Turkish Resume Translation Completed full Turkish translation of resume content (section headers, contact info, technical skills, experience, project descriptions) in Resume‑TR.pdf and corresponding Resume‑TR.docx. Fixed translation of 'Strong' to 'Güçlü' and localized section headers and contact labels to Turkish.

Build & Deployment

# Development
yarn dev

# Type checking
yarn typecheck

# Lint + Fix
yarn lint:fix

# Build (typecheck → hash locales → update sitemap → vite build → prerender)
yarn build

# Lint + build
yarn build:lint

# Deploy to GitHub Pages
yarn deploy    # runs predeploy (build:lint) then gh-pages -d dist

License

This project's all rights reserved — see the LICENSE file for details.

About

This is a personal portfolio website for Ahmet Fatihoglu, a Senior Software Developer and Architect. The website is a dynamic, data-driven single-page application built with a modern React and TypeScript stack. It features an integrated AI chat assistant that answers questions about Ahmet's professional background using document-based RAG.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0