A collection of production-ready Astro templates with TypeScript, featuring modern development tools and best practices.
This repository contains multiple template presets:
- Framework: Astro + React + TypeScript
- Styling: Tailwind CSS v4
- Features: SSR support, API routes, form handling
- State Management: React hooks
- Testing: Vitest + React Testing Library
- Framework: Astro + Vue 3 + TypeScript
- Styling: Tailwind CSS v4
- Features: SSR support, API routes, form handling
- State Management: Vue Composition API
- Testing: Vitest + Vue Test Utils
# Create React template
npm create astro@latest my-project -- --template github:your-username/astro-templates/templates/react
# Create Vue template
npm create astro@latest my-project -- --template github:your-username/astro-templates/templates/vue- Clone the repository:
git clone https://github.com/your-username/astro-templates.git
cd astro-templates- Copy your preferred template:
# For React
cp -r templates/react/ my-project/
# For Vue
cp -r templates/vue/ my-project/- Install dependencies:
cd my-project
npm install- Start development:
npm run dev- Feature-based structure: Organized by domain/feature
- Separation of concerns: Clear boundaries between UI, logic, and data
- Type safety: Strict TypeScript configuration
- API integration: Built-in API routes with proper error handling
- Tailwind CSS v4: Latest version with improved performance
- Responsive design: Mobile-first approach
- Modern CSS: CSS custom properties and modern features
- ESLint: Code linting with framework-specific rules
- Prettier: Code formatting
- Husky: Git hooks for code quality
- Lint-staged: Run linters on staged files
- Vitest: Fast unit testing
- SSR Support: Server-side rendering enabled
- Node.js Adapter: Ready for deployment
- Optimized builds: Production-ready configurations
templates/
βββ react/ # React template
β βββ src/
β β βββ components/ # Reusable components
β β βββ pages/ # Astro pages
β β βββ layout/ # Layout components
β β βββ styles/ # Global styles
β βββ public/ # Static assets
β βββ package.json # Dependencies
β βββ astro.config.mjs # Astro configuration
β βββ tsconfig.json # TypeScript config
βββ vue/ # Vue template
βββ src/
β βββ components/ # Vue SFC components
β βββ composables/ # Vue composables
β βββ pages/ # Astro pages
β βββ layout/ # Layout components
β βββ styles/ # Global styles
βββ public/ # Static assets
βββ package.json # Dependencies
βββ astro.config.mjs # Astro configuration
βββ tsconfig.json # TypeScript config
- Node.js 18+
- npm, yarn, or pnpm
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint
npm run format # Format code with Prettier
npm run test # Run testsBoth templates include:
- Pre-commit hooks: Automatic linting and formatting
- Strict TypeScript: Enhanced type checking
- ESLint rules: Framework-specific best practices
- Prettier config: Consistent code formatting
Both templates include example API routes:
GET /api/todos/get- Fetch todosPOST /api/todos/post- Create todoDELETE /api/todos/[id]/delete- Delete todoGET /api/todos/[id]/get- Get single todoPATCH /api/todos/[id]/patch- Update todoPUT /api/todos/[id]/put- Replace todo
See CONTRIBUTING.md for development setup and contribution guidelines.
MIT License - see LICENSE for details.
See CHANGELOG.md for version history and updates.