Overview
The Astro Portfolio v3 project follows a clean, organized structure that separates concerns and makes the codebase easy to navigate. This guide will walk you through each major directory and explain its purpose.Root Directory Structure
The project is configured for server-side rendering (SSR) with Cloudflare as the adapter, as defined in
astro.config.mjs:15-16.Source Directory (src/)
The src/ directory contains all the application code and is organized into logical subdirectories:
Components Directory
The components are organized by category for better maintainability:Component Categories
Component Categories
- Home Components
- UI Components
Located in
src/components/home/:About.astro- About section componentBlogs.astro- Blog listing componentHeroImage.astro- Hero section imageHeroText.astro- Hero section textProjects.astro- Projects showcaseWorkExperience.astro- Work experience timeline
Content Directory
Content is organized using Astro’s Content Collections API:Data Directory
JSON files for structured data that doesn’t need frontmatter:Pages Directory
File-based routing powered by Astro:The
[slug] directory uses dynamic routing to generate individual blog post pages from the content collections.Public Directory
Static assets that are served directly without processing:public/ directory are served at the root path and can be referenced directly (e.g., /favicon.svg).
Configuration Files
astro.config.mjs
Main Astro configuration including i18n, integrations, and deployment settings.See:
~/workspace/source/astro.config.mjscontent.config.ts
Defines schemas for all content collections using Zod for type safety.See:
~/workspace/source/src/content.config.tsconfig.ts
Site-wide configuration like name, description, and social links.See:
~/workspace/source/src/config.tstsconfig.json
TypeScript compiler options and path aliases.See:
~/workspace/source/tsconfig.jsonKey Design Patterns
Path Aliases
The project uses TypeScript path aliases for cleaner imports:@/ alias maps to the src/ directory, configured in tsconfig.json.
Component Organization
Components are grouped by their purpose:- home/ - Homepage-specific sections
- navs/ - Navigation and footer
- shared/ - Reusable across multiple pages
- ui/ - Base UI elements and icons
Content First
The project embraces Astro’s content-focused approach:- Content is stored in type-safe collections
- Schemas ensure data integrity
- Static generation for optimal performance
Next Steps
Components
Learn about the component architecture and how to use existing components
Content Collections
Understand how to add and manage content using Astro’s Content Collections API
i18n Setup
Explore the internationalization system and how to add translations
Theming
Discover how the theme system works and how to customize it