How mustafakbaser/blogfolio-app works
Project Identification
• BlogFolio is a single-page application (SPA) built with React 18 + TypeScript and styled via Tailwind CSS.
• It’s a front-end template (no back-end server by default) that renders blog posts and a portfolio from static data (src/data/blogPosts.ts) with future extensibility for a headless CMS or REST/GraphQL API.
Main Architectural Components
A. Browser / Client
• Renders index.html and downloads the SPA bundle.
• Interacts with the user and external services (Google Analytics, social share endpoints).
B. Vite Build & Dev Pipeline
• Vite Dev Server (serves modules during development)
• PostCSS + Tailwind CSS (style processing)
• TypeScript compiler (via tsconfig.json)
• ESLint, Prettier (linting)
• Final bundle deployed as static assets (Netlify / Vercel / CDN).
C. React App Core
• Entry point: main.tsx → <App /> with Router.
• Routes: defined in pages (Home, BlogPost, About, Portfolio, Contact, NotFound).
D. UI Layer
• Page Components (src/pages/*)
• Reusable UI Components (src/components/*): cards, header/footer, filters, code blocks, theme toggle, cookie consent, pagination, SEO, social share, etc.
E. Data & State
• Static Data Module: src/data/blogPosts.ts (list of posts, categories, authors)
• Core Services: src/lib/db.ts + src/lib/seed.ts (data seeding logic if backed by a CMS)
• Custom Hooks (src/hooks/*): usePost, useSearch, useCookieConsent, useDarkMode
• Utils (src/utils/*): reading time estimation, markdown link parsing.
F. Types & Environment
• Type Definitions (src/types/*)
• Environment variables (.env, VITE_API_URL, VITE_GA_TRACKING_ID)
Relationships & Data Flow
• User Agent → HTTP GET index.html → Vite bundle delivered (Dev) or built assets (Prod).
• main.tsx initializes React Router → <App /> loads the correct <Page />.
• <Page /> uses Hooks to pull data from:
• Static file (src/data/blogPosts.ts) or
• Future: External API (Headless CMS) via environment URL.
• Data passed down via props to UI Components.
• User actions (e.g., search, pagination, theme switch) handled in Hooks → Component state.
• Side effects: analytics events to GA, cookie consent popup, social share APIs.
Architectural Patterns & Principles
• Component-based architecture (atomic/Re-usable).
• Unidirectional data flow (React props & hooks).
• Separation of concerns:
• Presentation (components) vs. data logic (hooks/lib) vs. utilities.
• Static vs. dynamic: static data layer today, abstracted for future API integration.
Essential Details to Capture
• Entire component hierarchy (high level; group similar ones).
• Data retrieval abstraction (static vs. API).
• Build & deployment flow.
• External service integrations (analytics, social share).