Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A minimal Astro starter template for building sites with Preact components, scaffolded via npm.
The Astro + Preact Example is a starter template that demonstrates how to add Preact components to an Astro project, scaffolded with a single npm command.
The Astro + Preact Example is a starter project from the official withastro/astro repository, located under examples/framework-preact. It shows how to write Preact components as .jsx or .tsx files inside an Astro site and have them automatically processed by Astro's build pipeline. The template takes a new project name as input through the npm init astro command and produces a working Astro site with Preact installed and configured. The live demo is hosted on a Vercel preview URL, and the project can be opened directly in StackBlitz.
npm init astro -- --template framework-preact creates a new project with the Preact integration already set up..jsx or .tsx files; Preact is compiled and hydrated by Astro when needed..vercel.app URL, confirming the template builds and deploys successfully on Vercel.Run npm init astro -- --template framework-preact to create the project. Then add Preact components as .jsx or .tsx files in your project; Astro's Preact integration automatically compiles them and serves only the necessary JavaScript to the browser.
Yes, the template is part of the public withastro/astro repository on GitHub, so you can view, copy, and modify it freely.
Use the command npm init astro -- --template framework-preact in your terminal. npm will prompt you for a project directory and then scaffold the template.
Yes, the template explicitly supports .tsx files, so TypeScript syntax is allowed in your Preact components alongside .jsx.
The live demo is hosted on a Vercel preview domain, and Vercel automatically recognizes Astro projects, so you can deploy the template there without extra configuration.