- Create .gitignore, .env.example, README.md, LICENSE - Add astro.config.mjs and template.config.json - Scaffold .vscode extensions, launch, and settings - Add CLAUDE.md with development commands and guidelines - Include public assets, fonts, and media files - Add src components, layouts, pages, and utils - Add cursor rules and worktrees configuration - Add package.json, pnpm-lock.yaml, and tsconfig.json
Astro Portfolio & Blog Template
A modern, high-performance portfolio and blog template built with Astro 5, React 19, and Tailwind CSS 4. Features an industrial dark design system, MDX blog support, and deployment-ready for Cloudflare Pages.
Features
Content Management
- Type-Safe Content Collections - Schema validation with Astro's Content Collections API
- MDX Blog Support - Write posts in Markdown with embedded React components
- Flexible Taxonomies - Organize content with categories and tags
- Featured Posts - Highlight your best work
- Related Posts - Automatic suggestions based on content similarity
- Reading Time Calculation - Automatic based on word count
Design & UX
- Industrial Dark Design System - Professional, modern aesthetic
- Fully Responsive - Mobile-first design approach
- Custom Components - Blog cards, filters, navigation, table of contents
- Reading Progress Indicator - Visual progress bar for long-form content
- Theme Toggle - Dark/light mode support
- Grid Overlay - Optional design grid for development
Performance & SEO
- Lightning Fast - Built with Astro for optimal performance
- SEO Optimized - Structured data (JSON-LD), meta tags, Open Graph
- AVIF Image Support - Modern image format with conversion utility
- RSS Feed - Automatic feed generation
- Sitemap - Auto-generated for search engines
- Cloudflare Pages Ready - Optimized for edge deployment
Developer Experience
- TypeScript - Full type safety
- pnpm - Fast, disk-efficient package manager
- AI-Powered Git Commits - Automatic commit message generation
- AVIF Converter - Built-in image optimization utility
- Template Initialization - Interactive setup script
Quick Start
Prerequisites
- Node.js 18+
- pnpm (recommended) -
npm install -g pnpm
Installation
-
Clone or download this template
git clone <repository-url> cd astro-template -
Install dependencies
pnpm install -
Initialize your template
node init-template.jsFollow the prompts to personalize with your information.
-
Start development server
pnpm dev -
Replace placeholder content
- Update images in
src/assets/andpublic/media/ - Customize sections in
src/content/sections/ - Write your first blog post in
src/content/blog/
- Update images in
See SETUP.md for detailed setup instructions.
Project Structure
/
├── public/ # Static assets (served as-is)
│ ├── media/ # Videos, large images
│ └── fonts/ # Web fonts
├── src/
│ ├── assets/ # Optimized images (processed by Astro)
│ ├── components/ # Reusable UI components
│ │ ├── sections/ # Homepage section components
│ │ └── ...
│ ├── content/ # Content collections
│ │ ├── blog/ # Blog posts (MDX)
│ │ ├── sections/ # Homepage sections (MDX)
│ │ └── pages/ # Page-specific content
│ ├── layouts/ # Page layouts
│ ├── pages/ # File-based routing
│ ├── styles/ # Global styles
│ ├── utils/ # Utility scripts
│ └── consts.ts # Site-wide constants
├── dev/ # Development resources
│ ├── design.json # Design system documentation
│ └── continuity.md # Development log
├── template.config.json # Template configuration
└── init-template.js # Setup script
Content Collections
Blog Posts
Create MDX files in src/content/blog/:
---
title: 'Your Post Title'
description: 'SEO description'
pubDate: 'Dec 27 2024'
heroImage: '../../assets/your-image.avif'
featured: true
category: 'Tutorial'
tags: ['Tag1', 'Tag2']
---
Your content here...
Sections
Customize homepage sections in src/content/sections/:
hero.mdx- Hero section with headline and bioexperience.mdx- Work history and achievementsskills.mdx- Technical skills and proficienciesfeatured-project.mdx- Showcase your best work
Available Commands
Development
pnpm dev # Start dev server (localhost:4321)
pnpm build # Build for production
pnpm preview # Build and preview with Wrangler
Deployment
pnpm deploy # Build and deploy to Cloudflare Pages
Utilities
pnpm commit # AI-powered commit messages
pnpm convert:avif:all # Convert all images to AVIF
pnpm convert:avif:jpeg # Convert JPEG only
pnpm convert:avif:png # Convert PNG only
pnpm cf-typegen # Generate Cloudflare types
Template Setup
node init-template.js # Interactive setup
node init-template.js --config # Use template.config.json
Customization
Design System
The design system is documented in dev/design.json. Key areas:
- Colors: Modify CSS custom properties in
src/styles/global.css - Typography: Adjust font scales and families
- Spacing: Grid system and spacing tokens
- Components: Design patterns and component specs
Configuration Files
- template.config.json - Site-wide settings (name, URLs, social links)
- astro.config.mjs - Astro configuration
- wrangler.jsonc - Cloudflare Pages settings
- src/consts.ts - Global constants
Adding Content
- New Blog Post: Create
.mdxfile insrc/content/blog/ - Update Sections: Edit files in
src/content/sections/ - Add Images: Place in
src/assets/(processed) orpublic/media/(static) - Customize Components: Modify files in
src/components/
Deployment
Cloudflare Pages (Default)
-
Build your site
pnpm build -
Deploy
pnpm deployOr connect your Git repository to Cloudflare Pages for automatic deployments.
Other Platforms
This template can be adapted for other platforms:
- Vercel: Change adapter to
@astrojs/vercel - Netlify: Change adapter to
@astrojs/netlify - Static: Remove adapter for static site generation
AI-Powered Commit Messages
This template includes an AI commit message generator:
-
Setup: Create
src/utils/.envwith your OpenRouter API keyOPENROUTER_API_KEY=your_key_here -
Use: Stage changes and run
pnpm commit
See src/utils/README.md for details.
Image Optimization
Convert images to AVIF format for optimal performance:
# Convert all images
pnpm convert:avif:all
# Convert specific formats
pnpm convert:avif:jpeg
pnpm convert:avif:png
The utility processes files in src/assets/ and public/media/.
Tech Stack
- Framework: Astro 5
- UI Library: React 19
- Styling: Tailwind CSS 4
- Deployment: Cloudflare Pages
- Content: MDX with Content Collections
- Package Manager: pnpm
Browser Support
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
- Modern mobile browsers
Contributing
This is a template repository. Feel free to fork and customize for your needs.
License
MIT License - see LICENSE for details.
Support
Credits
Built with modern web technologies and best practices for performance, SEO, and developer experience.
Ready to make it yours? Run node init-template.js to get started!