A modern, production-ready Astro project template with TypeScript, comprehensive tooling, and best practices built-in.
- π― Astro v5.11.1 - Latest version with all modern features
- π§ TypeScript - Strict configuration with path aliases
- π¨ Prettier - Code formatting with Astro plugin
- π ESLint - Comprehensive linting with accessibility rules
- πͺ Git Hooks - Pre-commit quality checks with Husky
- π Performance - View transitions, prefetching, image optimization
- βΏ Accessibility - Built-in accessibility features and testing
- π± SEO Ready - Meta tags, Open Graph social sharing
- π CI/CD - GitHub Actions with quality checks
- π Organized - Clean project structure with conventions
# Create a new project from this template
npx degit danhendersonede/template-astro my-new-project
cd my-new-project# Install dependencies
npm install
# Customize your project configuration
# Edit src/config/site.ts with your project details
# Start development server
npm run devπ Important: Edit src/config/site.ts to customize:
- Project name and description
- Site URL and author information
- Social media links
- Navigation menu
/
βββ public/ # Static assets
β βββ favicon.svg
βββ src/
β βββ assets/ # Build-time processed assets
β βββ components/ # Reusable components
β β βββ SEOHead.astro # SEO meta tags component
β βββ config/ # Configuration files
β β βββ site.ts # Site-wide configuration
β βββ content/ # Content collections
β β βββ config.ts # Content schema definitions
β βββ layouts/ # Layout components
β β βββ Layout.astro # Base layout with SEO
β βββ pages/ # File-based routing
β β βββ index.astro # Homepage
β β βββ 404.astro # Not found page
β β βββ 500.astro # Error page
β βββ utils/ # Utility functions
β βββ index.ts # Common utilities
βββ .github/workflows/ # GitHub Actions CI/CD
βββ .husky/ # Git hooks
βββ .vscode/ # VS Code settings
βββ eslint.config.js # ESLint configuration
βββ prettier.config.js # Prettier configuration
βββ tsconfig.json # TypeScript configuration
βββ astro.config.mjs # Astro configuration
| Command | Description |
|---|---|
npm run dev |
Start development server at localhost:4321 |
npm run build |
Build production site to ./dist/ |
npm run preview |
Preview production build locally |
npm run check |
Run Astro type checking |
npm run lint |
Run ESLint |
npm run format |
Format code with Prettier |
Update src/config/site.ts to customize your site:
export const siteConfig: SiteConfig = {
name: 'Your Project Name',
title: 'Your Site Title',
description: 'Your site description',
url: 'https://your-domain.com',
author: 'Your Name',
social: {
github: 'yourusername',
},
nav: [
{ label: 'Home', href: '/' },
{ label: 'About', href: '/about' },
],
};Copy .env.example to .env and update:
# Site Configuration
PUBLIC_SITE_URL=https://your-domain.com
# Analytics (optional)
PUBLIC_PLAUSIBLE_DOMAIN=your-domain.com- Create
.astrofiles insrc/pages/ - Use the
Layoutcomponent for consistency - Add navigation links to
src/config/site.ts
- Add components to
src/components/ - Use TypeScript for props interfaces
- Follow Astro component conventions
Define content schemas in src/content/config.ts and add content files to src/content/[collection]/.
Recommended extensions (auto-suggested):
- Astro
- TypeScript Importer
- ESLint
- Prettier
- Error Lens
Pre-commit hooks automatically run:
- Type checking
- Linting with auto-fix
- Code formatting
- Build verification
npm i -g vercel
vercelnpm run build
# Upload dist/ folder to NetlifyEnable GitHub Pages in repository settings and GitHub Actions will automatically deploy.
- Astro - Static site generator
- TypeScript - Type safety
- ESLint - Code linting
- Prettier - Code formatting
- Husky - Git hooks
- lint-staged - Run linters on staged files
This project is open source and available under the MIT License.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Update
src/config/site.tsfirst for site-wide changes - Use TypeScript interfaces for better development experience
- Leverage Astro's component islands for interactive elements
- Keep accessibility in mind when adding new features
- Test your changes across different devices and browsers
Built with β€οΈ using Astro