How bchiang7/v4 works
Project Type and Purpose
• This is a static personal website built with Gatsby (a React-based static site generator) and hosted on Netlify. It pulls markdown content from the content/ folder, uses GraphQL at build time to generate HTML/CSS/JS assets, then deploys the result to a CDN.
File Structure Highlights (Architectural Clues)
• Root config files: gatsby-config.js, gatsby-node.js, .babelrc, ESLint, Prettier, Husky hooks.
• content/: Markdown files organized by type (featured, jobs, posts, projects).
• src/:
• pages/ and templates/ define page entry points and page-template components.
• components/: reusable React UI pieces.
• hooks/, utils/: client-side utility code.
• styles/: theme, global styles, Prism for code highlighting.
• images/, static/: static assets (favicons, PDFs, slides).
• package.json & Netlify: defines build scripts (gatsby build, gatsby serve) and deployment via Netlify CI.
Key Architectural Patterns
• Static Site Generation (SSG):
• GraphQL schema created at build-time to query markdown and image data.
• Gatsby pipelines (gatsby-node.js) programmatically create pages from markdown.
• Component-Based UI:
• React components for layout, navigation, sections.
• CSS-in-JS (GlobalStyle, theme variables) for styling.
• Content-Driven Structure: All user-visible content lives in content/; code simply transforms and renders it.
Main Components and Their Interactions
a. Developer Machine
– Writes code and markdown.
– Runs gatsby develop or pushes to GitHub (with Husky pre-commit hooks).
b. Version Control / CI
– GitHub hosts the repo.
– Netlify watches the main branch, triggers builds on push.
c. Gatsby Build Process
– Reads gatsby-config.js plugins and site metadata.
– Imports all markdown from content/ via gatsby-source-filesystem.
– Transforms markdown to HTML using gatsby-transformer-remark.
– Exposes data through GraphQL.
– Executes createPages in gatsby-node.js using templates (src/templates/*.js).
– Bundles React components and CSS into static JS/CSS files.
d. Hosting / CDN
– Netlify deploys the /public folder's static assets to a CDN.
e. End Users (Browsers)
– Request HTML/CSS/JS assets via CDN.
– Hydrate into a React SPA (for any client-side interactivity).