A modern, SEO-optimized Astro starter template with comprehensive meta tags, social media integration, and essential web development tools.
Made with β€ by Ali Piry
- π― SEO Optimized: Complete OpenGraph, Twitter Cards, and meta tag setup
- π Search Engine Friendly: Automated sitemap and robots.txt generation
- β‘ Modern Tooling: ESLint, Prettier, and TypeScript configuration
- π CI/CD Ready: GitHub Actions workflows for quality checks and builds
- π¨ Clean Architecture: Organized component structure with layouts
- π Social Media Integration: Twitter and OpenGraph meta tags configured
- π§ Git Hooks: Husky and lint-staged for automated pre-commit quality checks
/
βββ .github/ # GitHub workflows and templates
β βββ workflows/ # CI/CD automation
β βββ quality.yml # Code quality checks
β βββ build.yml # Build verification
βββ public/ # Static assets
β βββ favicon.ico # Traditional favicon
β βββ favicon-16x16.png # Browser favicon (16x16)
β βββ favicon-32x32.png # Browser favicon (32x32)
β βββ apple-touch-icon.png # iOS home screen icon
β βββ android-chrome-*.png # Android icons (192x192, 512x512)
β βββ og.png # OpenGraph/Twitter image
β βββ favicon.svg # SVG favicon
βββ src/
β βββ assets/ # Build-time assets
β β βββ astro.svg
β β βββ background.svg
β βββ components/ # Reusable Astro components
β β βββ Welcome.astro
β βββ layouts/ # Page layouts
β β βββ Layout.astro # Main layout with SEO
β βββ pages/ # File-based routing
β βββ index.astro
βββ astro.config.mjs # Astro configuration
βββ eslint.config.mjs # ESLint configuration
βββ tsconfig.json # TypeScript configuration
βββ .prettierrc.mjs # Prettier configuration
βββ .prettierignore # Prettier ignore patterns
βββ lint-staged.config.js # Lint-staged configuration
βββ .env.example # Environment variables template
βββ package.json
- Framework: Astro - Modern static site generator
- SEO: astro-seo - Comprehensive SEO component
- Integrations:
@astrojs/sitemap- Automatic sitemap generationastro-robots-txt- Robots.txt generation
- Development Tools:
- ESLint with Astro plugin
- Prettier with Astro formatting
- TypeScript support
- Husky for Git hooks
- lint-staged for pre-commit quality checks
- Package Manager: pnpm for fast installations
-
Clone and install dependencies
pnpm install
-
Set up environment variables
cp .env.example .env
-
Start development server
pnpm dev
-
Open your browser Navigate to
http://localhost:4321
| Command | Action |
|---|---|
pnpm install |
Installs dependencies |
pnpm dev |
Starts local dev server at localhost:4321 |
pnpm build |
Build your production site to ./dist/ |
pnpm preview |
Preview your build locally, before deploying |
pnpm run lint |
Run ESLint to check code quality |
pnpm run lint:fix |
Fix ESLint issues automatically |
pnpm run format |
Format code with Prettier |
pnpm run format:check |
Check if code is properly formatted |
pnpm run type-check |
Run Astro's TypeScript checker |
pnpm astro ... |
Run CLI commands like astro add, astro check |
pnpm astro -- --help |
Get help using the Astro CLI |
This project uses Husky and lint-staged to ensure code quality before commits:
When you commit changes, the following checks run automatically:
- Type Checking: Astro's TypeScript checker validates all
.ts,.tsx, and.astrofiles - Linting: ESLint fixes code style issues automatically
- Formatting: Prettier formats code according to project standards
The pre-commit hooks are configured in lint-staged.config.js:
{
"**/*.{ts,tsx,astro}": "pnpm run type-check",
"**/*.astro": ["eslint --fix", "prettier --write"],
"**/*.{ts,tsx,js,jsx}": ["eslint --fix", "prettier --write"],
"**/*.{md,json,yaml,yml,css,scss,sass}": "prettier --write"
}Git hooks are automatically installed when you run pnpm install via the prepare script. If you need to reinstall them manually:
pnpm run prepareCreate a .env file in the root directory:
SITE_URL=https://your-domain.com
APP_ENV=productionThe Layout.astro includes comprehensive SEO setup:
- Meta Tags: Title, description, keywords, author
- OpenGraph: Complete social media preview setup
- Twitter Cards: Large image cards with metadata
- Favicons: Full cross-platform icon support
- Structured Data: Basic website structured data
- Update site information in
src/layouts/Layout.astro - Modify social media handles in the Twitter configuration
- Replace favicon files in the
public/directory - Update the OpenGraph image (
public/og.png)
astro- Core frameworkastro-seo- SEO component library@astrojs/sitemap- Sitemap generationastro-robots-txt- Robots.txt generation
eslint+eslint-plugin-astro- Code lintingprettier+prettier-plugin-astro- Code formattingtypescript-eslint- TypeScript lintinghusky- Git hooks managementlint-staged- Pre-commit quality checks- Various configuration plugins
This starter includes automated GitHub Actions workflows for continuous integration and deployment:
The .github/workflows/ directory contains the following CI/CD pipelines:
-
Code Quality (
quality.yml): Automated code quality checks- Runs on push/PR to main/develop branches
- TypeScript checking with
astro check - ESLint code linting
- Prettier formatting validation
- Security audit with
pnpm audit
-
Build (
build.yml): Build verification- Runs after Code Quality workflow completes successfully
- Uses pnpm to install dependencies and build the project
- Validates that the project compiles correctly
Recommended platforms:
- Netlify: Automatic builds from repository with Git integration
- Cloudflare Workers: Serverless deployment with global CDN
- GitHub Pages: Static site hosting
- Any static hosting provider
-
GitHub Actions run automatically on push/PR:
- Quality checks must pass before builds run
- Failed quality checks prevent unnecessary builds
-
For Netlify deployment:
- Connect repository to Netlify
- Set
SITE_URLandAPP_ENVenvironment variable in Netlify dashboard - Netlify will build directly from source
This project is licensed under the MIT License. See the LICENSE file for details.