How mrmoneyinthebank/personal-website works
Main Components of the System
a. Astro Build Environment & Configuration:
• Components: astro.config.ts, tsconfig.json, package.json, tailwind.config.cjs, and other build-related files.
• Role: These files configure the build process, TypeScript settings, and styling (via Tailwind) for the site.
b. Content Management:
• Components: The src/content directory (with specific subdirectories for blog posts and other markdown content) and its configuration files.
• Interaction: Content (in markdown) flows into the layouts/pages during the build process.
c. Presentation Layer (Frontend):
• Components:
• Pages: Located in src/pages (e.g., index.astro, pages for posts, archives, tags, etc.).
• Layouts: Located in src/layouts (e.g., Main.astro, PostDetails.astro, AboutLayout.astro).
• Components: Reusable UI pieces found in src/components (e.g., Header, Footer, Breadcrumbs, ShareLinks, Tag, etc.).
• Role: These work together to form the visual structure of the website, rendering both static content and dynamically generated pages (like paginated posts or tag-based pages).
d. Assets & Static Files:
• Components:
• public directory: Contains globally accessible assets such as images, JavaScript (like toggle-theme.js), etc.
• Interaction: Assets are referenced by components and pages to style and enhance the website.
e. Utility/Helper Functions:
• Components: The src/utils folder, which provides functions for handling post filtering, slug generation, generating OG images, sorting posts, etc.
• Role: They abstract out common logic used by pages and components to dynamically generate parts of the website.
f. Docker & Deployment:
• Components: docker-compose.yml, Dockerfile (implicitly referenced via docker commands in README), and related configurations.
• Role: Provide containerization support to run this static site in a Docker environment, ensuring consistency across development and production.
g. Development & Quality Tools:
• Components: Files like .prettierrc, eslint.config.mjs, .npmrc, .gitignore, and others.
• Role: Ensure code quality, consistent formatting, and linting during development.
Relationships and Interactions
• The build configuration (Astro and TypeScript) takes inputs from the src content and pages, along with the configurations and utilities.
• The page layouts incorporate components (header, footer, navigation, etc.) and inject content from the markdown files (located in src/content).
• Utility functions (in src/utils) assist in processing data (e.g., sorting posts, generating slugs) that then feed into the pages or even OG image generation for social sharing.
• The public and assets directories provide resources that the rendered HTML (produced by Astro) references.
• Deployment scripts (like Docker-related files) sit at the root and indicate the process to containerize and run the static pages.
Architectural Patterns & Design Principles
• Modularity – each UI piece is encapsulated as a reusable component (Astro components and React components in TSX).
• Separation of Concerns – content (markdown), presentation (pages/layouts/components), and utilities (logic, data handling) are clearly separated in the file structure.
• Build Pipeline – the Astro build process turns these components and content into a static HTML site, which is then served.
• Containerization – Docker configurations indicate deployment flexibility via containerized environments.