How kungpaogao/website-astro works
Main Components
• Astro Frontend Framework: Central to rendering pages and handling routing.
• Pages & Layouts: Found in src/pages and src/layouts, these define the routes (blog, projects, index, 404, etc.) and layout (Layout.astro) for the website.
• Content: Under src/content (with separate folders for blog and projects), which contains MDX files that form the dynamic content of the site.
• CMS & Data Integration: The src/lib folder contains various files (notion-client.ts, notion-cms.ts, etc.) that suggest integration with a Notion-based content/source system, including parsing and fetching routines.
• Public Assets & Static Files: The public directory holds assets (fonts, images, various files, places.json, robots.txt) and even tests that might be used client-side.
• Styles & Configurations: CSS files and configuration files (astro.config.mjs, package.json, tsconfig.json, and style declarations in src/styles) define visual and behavioral aspects.
• Build & Deployment: Files like vercel.json (for deployment to Vercel) and project configuration files help manage build and deployment pipelines.
Relationships and Data Flow
• Client Request Flow: A user visits a URL which is handled via Astro's routing (defined in src/pages). The page then loads the appropriate layout (from src/layouts) and integrates multiple components.
• Content Rendering: Within the pages, MDX content from the src/content directory is processed—potentially with help from src/content.config.ts—and rendered using layouts and components.
• Component Integration: Reusable components (in src/components) are pulled into pages and layouts to create a consistent UI (e.g., Navigation appears on multiple pages).
• Static Assets: The public folder provides static resources (e.g., images, fonts, documents) which are referenced by pages and components. Ensure to show directional connections from “Public Assets” to “Pages/Components”.
Architectural Patterns and Design Principles
• Separation of Concerns: Different directories for content, components, and pages mean that presentation and logic are clearly separated.
• Modularization: Each functionality (e.g., Notion fetching, parsing, layout rendering) is encapsulated within dedicated modules/libraries in src/lib.
• Client-Server Rendering with Astro: Illustrate how Astro pre-builds pages while possibly leveraging client-side interactivity through separate components (like those written in TypeScript/React within the .tsx or .astro files).