Astro site with React islands, Tailwind CSS v4 (Vite plugin), and shadcn/ui-style components (components.json).
- Node.js 20+ (LTS recommended)
git clone https://github.com/bmn789/astro-react-template project_name
cd project_name
npm installnpm run devThe dev server listens on http://localhost:3000 (see astro.config.mjs).
| Command | Description |
|---|---|
npm run dev |
Local development |
npm run build |
Production build to ./dist/ |
npm run preview |
Serve the production build locally |
npm run astro |
Astro CLI (e.g. npm run astro check) |
- Astro — pages and layouts under
src/pages/andsrc/layouts/. - React —
@astrojs/react; use.tsxcomponents where you need client interactivity (client:*directives as needed). - Tailwind CSS v4 — configured via
@tailwindcss/viteinastro.config.mjs; global styles insrc/styles/global.css. - shadcn/ui —
components.jsonpoints UI tosrc/components/uiand utilities tosrc/lib/utils.ts. Path alias@/maps tosrc/(seetsconfig.jsonand Viteresolve.alias).
From the project root (where components.json lives):
npx shadcn@latest add buttonReplace button with the component you need. Import in Astro or React using the @/ alias, for example @/components/ui/button.