diff --git a/autoinstall/bashly.yml b/autoinstall/bashly.yml
index 526b258..7a9cedc 100644
--- a/autoinstall/bashly.yml
+++ b/autoinstall/bashly.yml
@@ -115,3 +115,13 @@ commands:
       - name: target
         required: true
         help: The path to write the result to
+
+  - name: flatpak
+    help: Install a flatpak
+    args:
+      - name: flatpak
+        required: true
+        help: The flatpak to install
+      - name: mode
+        required: true
+        help: The target to install into (user or system)
diff --git a/autoinstall/before.sh b/autoinstall/before.sh
index b5da850..24b4323 100644
--- a/autoinstall/before.sh
+++ b/autoinstall/before.sh
@@ -2,8 +2,8 @@
 
 action=${action:?}
 
-# if action is run or completions, do nothing
-if [ "$action" = "run" ] || [ "$action" = "completions" ]
+# do nothing on some selected actions
+if [ "$action" = "completions" ] || [ "$action" = "flatpak" ] || [ "$action" = "run" ]
 then
 	return
 fi
diff --git a/autoinstall/flatpak_command.sh b/autoinstall/flatpak_command.sh
new file mode 100644
index 0000000..89f6e54
--- /dev/null
+++ b/autoinstall/flatpak_command.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+flatpak=${args[flatpak]:?}
+mode=${args[mode]:?}
+
+if ! flatpak info "$flatpak" &> /dev/null
+then
+	echo "Installing flatpak $flatpak"
+
+	flatpak install -y "--$mode" "$flatpak"
+
+	_run_hook
+fi
diff --git a/autoinstall/run_command.sh b/autoinstall/run_command.sh
index 968d4b1..a45399c 100644
--- a/autoinstall/run_command.sh
+++ b/autoinstall/run_command.sh
@@ -44,5 +44,5 @@ _config_query ".[]" | while read -r entry; do
 
 	install_args+=("$(eval "echo $target")")
 
-	"$0" "${install_args[@]}"
+	"$0" "${install_args[@]}" || true # Continue on error
 done