Welcome to Tauri + Astro
+ + +Click on the Tauri or Astro logo to learn more.
+ + + + +diff --git a/.scripts/generate-templates-matrix.js b/.scripts/generate-templates-matrix.js
index 7b58c936e6..fb7ae16a74 100644
--- a/.scripts/generate-templates-matrix.js
+++ b/.scripts/generate-templates-matrix.js
@@ -18,6 +18,7 @@ const nodeJsTemplates = [
"preact",
"preact-ts",
"angular",
+ "astro",
];
const matrixConfig = [
diff --git a/node/README.md b/node/README.md
index abed4b7253..34b0d135de 100644
--- a/node/README.md
+++ b/node/README.md
@@ -77,6 +77,7 @@ Currently supported template presets include:
- `leptos`
- `sycamore`
- `blazor`
+- `astro`
You can use `.` for the project name to scaffold in the current directory.
diff --git a/src/package_manager.rs b/src/package_manager.rs
index b912dc196f..36f1424a35 100644
--- a/src/package_manager.rs
+++ b/src/package_manager.rs
@@ -100,6 +100,7 @@ impl PackageManager {
Template::Solid,
Template::Angular,
Template::Preact,
+ Template::Astro,
],
PackageManager::Dotnet => &[Template::Blazor],
}
@@ -132,6 +133,7 @@ impl PackageManager {
Template::Angular,
Template::Preact,
Template::PreactTs,
+ Template::Astro,
],
PackageManager::Dotnet => &[Template::Blazor],
}
diff --git a/src/template.rs b/src/template.rs
index 952ca51ab5..4280a4a7c3 100644
--- a/src/template.rs
+++ b/src/template.rs
@@ -60,6 +60,7 @@ pub enum Template {
PreactTs,
Blazor,
Dioxus,
+ Astro,
}
impl Display for Template {
@@ -83,6 +84,7 @@ impl Display for Template {
Template::PreactTs => write!(f, "preact-ts"),
Template::Blazor => write!(f, "blazor"),
Template::Dioxus => write!(f, "dioxus"),
+ Template::Astro => write!(f, "astro"),
}
}
}
@@ -109,6 +111,7 @@ impl FromStr for Template {
"preact-ts" => Ok(Template::PreactTs),
"blazor" => Ok(Template::Blazor),
"dioxus" => Ok(Template::Dioxus),
+ "astro" => Ok(Template::Astro),
_ => Err(format!(
"{YELLOW}{s}{RESET} is not a valid template. Valid templates are [{}]",
Template::ALL
@@ -138,6 +141,7 @@ impl Template {
"Blazor - (https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor/)"
}
Template::Dioxus => "Dioxus - (https://dioxuslabs.com/)",
+ Template::Astro => "Astro - (https://astro.build/)",
_ => unreachable!(),
}
}
@@ -163,6 +167,7 @@ impl<'a> Template {
Template::PreactTs,
Template::Blazor,
Template::Dioxus,
+ Template::Astro,
];
pub fn flavors<'b>(&self, pkg_manager: PackageManager) -> Option<&'b [Flavor]> {
@@ -227,7 +232,8 @@ impl<'a> Template {
| Template::SolidTs
| Template::Angular
| Template::Preact
- | Template::PreactTs => PackageManager::NODE,
+ | Template::PreactTs
+ | Template::Astro => PackageManager::NODE,
Template::Yew | Template::Leptos | Template::Sycamore | Template::Dioxus => {
&[PackageManager::Cargo]
}
diff --git a/templates/_assets_/astro.svg b/templates/_assets_/astro.svg
new file mode 100644
index 0000000000..47954ed1e9
--- /dev/null
+++ b/templates/_assets_/astro.svg
@@ -0,0 +1,18 @@
+
diff --git a/templates/template-astro/%(pnpm-yarn-npm-bun)%package.json.lte b/templates/template-astro/%(pnpm-yarn-npm-bun)%package.json.lte
new file mode 100644
index 0000000000..e87b084c74
--- /dev/null
+++ b/templates/template-astro/%(pnpm-yarn-npm-bun)%package.json.lte
@@ -0,0 +1,17 @@
+{
+ "name": "{% package_name %}",
+ "private": true,
+ "version": "0.1.0",
+ "type": "module",
+ "scripts": {
+ "build": "astro build",
+ "dev": "astro dev"
+ },
+ "dependencies": {
+ "@tauri-apps/api": "{% if v2 %}^2{% else %}^1{% endif %}",
+ "astro": "^5.7.13"
+ },
+ "devDependencies": {
+ "@tauri-apps/cli": "{% if v2 %}^2{% else %}^1{% endif %}"
+ }
+}
diff --git a/templates/template-astro/.manifest b/templates/template-astro/.manifest
new file mode 100644
index 0000000000..3e58e27439
--- /dev/null
+++ b/templates/template-astro/.manifest
@@ -0,0 +1,12 @@
+# Copyright 2019-2025 Tauri Programme within The Commons Conservancy
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: MIT
+
+beforeDevCommand = {% pkg_manager_run_command %} dev
+beforeBuildCommand = {% pkg_manager_run_command %} build
+devUrl = http://localhost:1420
+frontendDist = ../dist
+
+[files]
+astro.svg = public/astro.svg
+tauri.svg = public/tauri.svg
diff --git a/templates/template-astro/.vscode/extensions.json b/templates/template-astro/.vscode/extensions.json
new file mode 100644
index 0000000000..37db55205a
--- /dev/null
+++ b/templates/template-astro/.vscode/extensions.json
@@ -0,0 +1,7 @@
+{
+ "recommendations": [
+ "astro-build.astro-vscode",
+ "tauri-apps.tauri-vscode",
+ "rust-lang.rust-analyzer"
+ ]
+}
diff --git a/templates/template-astro/README.md b/templates/template-astro/README.md
new file mode 100644
index 0000000000..a9f4a64a93
--- /dev/null
+++ b/templates/template-astro/README.md
@@ -0,0 +1,7 @@
+# Tauri + Astro
+
+This template should help get you started developing with Tauri and Astro.
+
+## Recommended IDE Setup
+
+[VS Code](https://code.visualstudio.com/) + [Astro](https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).
diff --git a/templates/template-astro/_gitignore b/templates/template-astro/_gitignore
new file mode 100644
index 0000000000..016b59ea14
--- /dev/null
+++ b/templates/template-astro/_gitignore
@@ -0,0 +1,24 @@
+# build output
+dist/
+
+# generated types
+.astro/
+
+# dependencies
+node_modules/
+
+# logs
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+
+# environment variables
+.env
+.env.production
+
+# macOS-specific files
+.DS_Store
+
+# jetbrains setting folder
+.idea/
diff --git a/templates/template-astro/astro.config.ts.lte b/templates/template-astro/astro.config.ts.lte
new file mode 100644
index 0000000000..409c61714a
--- /dev/null
+++ b/templates/template-astro/astro.config.ts.lte
@@ -0,0 +1,34 @@
+// @ts-check
+import { defineConfig } from "astro/config";{% if v2 %}
+
+// @ts-expect-error process is a nodejs global
+const host = process.env.TAURI_DEV_HOST;{% endif %}
+
+// https://astro.build/config
+export default defineConfig({
+ server: {{% if v2 %}
+ port: 1420,{% endif %}
+ host: host ?? false,
+ },
+ vite: {
+ // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
+ //
+ // 1. prevent Vite from obscuring rust errors
+ clearScreen: false,
+ // 2. tauri expects a fixed port, fail if that port is not available
+ server: {
+ strictPort: true,{% if v2 %}
+ hmr: host
+ ? {
+ protocol: "ws",
+ host,
+ port: 1421,
+ }
+ : undefined,{% endif %}
+ watch: {
+ // 3. tell Vite to ignore watching `src-tauri`
+ ignored: ["**/src-tauri/**"],
+ },
+ },
+ },
+});
diff --git a/templates/template-astro/src/components/Welcome.astro.lte b/templates/template-astro/src/components/Welcome.astro.lte
new file mode 100644
index 0000000000..45cddb4513
--- /dev/null
+++ b/templates/template-astro/src/components/Welcome.astro.lte
@@ -0,0 +1,55 @@
+
+
+ Click on the Tauri or Astro logo to learn more.Welcome to Tauri + Astro
+
+
+