How mh4gf/mysite works
Core System Layers and Main Components
• Frontend Application (Next.js App):
• The central hub is the Next.js application found mainly in the “app” folder.
• It contains file-based routing directories such as (pages), dynamic [slug] routes (for articles and other pages), and dedicated pages for special content (like “thinking-in-career”).
• UI Components:
• Content Management:
• The “contents” directory (with subfolders for “articles” and “about”) together with a “contentlayer.config.ts” file indicate that markdown content is processed and integrated into the Next.js pages.
• Utility and Helper Functions:
• “app/_utils” and other helper files help with common tasks such as date formatting, class name (cn) composition, and constants.
• Static Assets and Public Resources:
• The “public” directory holds images and static files (including the site manifest).
• CI/CD and Testing:
• GitHub workflows (in .github/workflows) for continuous integration, along with Playwright and Vitest configurations, indicate automated testing and quality assurance.
• Build and Configuration Tools:
• Config files like “next.config.js”, “tailwind.config.js”, “postcss.config.js” are key to the build and styling pipeline.
Relationships and Interactions
• The Next.js application (frontend) organizes pages following the new App Router with several nested directories. These pages dynamically import various feature modules (e.g., articles, markdownRenderer) to render specific content.
• Content stored as markdown in the “contents” folder is processed (likely via Contentlayer) and then injected into React component pages.
• UI components and feature modules (such as those handling commands or theme changes) interface directly with the Next.js pages, contributing to the dynamic user experience.
• There is a clear separation between presentation (in “_components”) and logical features (in “_features”), which then cooperate to render complete pages.
• Testing (both e2e and unit tests) is interwoven: tests within “__vrt__”, “__tests__” folders ensure the reliability of key parts.
• GitHub workflows further ensure code quality and automated deployment processes.
Architectural Patterns/Design Principles
• File-Based Routing: The project utilizes Next.js’s app directory with file-based dynamic routing (e.g., [slug]) to manage different pages and content types.
• Separation of Concerns: The architecture clearly separates UI components, feature logic, utility functions, and content data. Each “_features” subfolder focuses on a distinct functionality (like markdown processing or theme management).
• Modular Design: The modularity is evident from the breakdown of functionality across various folders, making it easier to update or replace components without major system-wide changes.
• Test-Driven Development: Multiple test directories (e.g., __vrt__, __tests__) indicate that testing is an integral part of the development process.
• Integration with Static Site Generation and API Layer: Besides dynamic rendering, the integration (e.g., content fetching from markdown) suggests that some parts of the application might be pre-rendered for performance.