diff --git a/.github/workflows/build.yaml b/.github/workflows/build_cli.yaml
similarity index 100%
rename from .github/workflows/build.yaml
rename to .github/workflows/build_cli.yaml
diff --git a/Cargo.lock b/Cargo.lock
index fe190acd2..eba401119 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1467,6 +1467,7 @@ dependencies = [
"hex",
"http 1.1.0",
"http-body-util",
+ "include_dir",
"libsql",
"opentelemetry",
"opentelemetry-proto",
@@ -1476,6 +1477,7 @@ dependencies = [
"serde",
"serde_json",
"strum",
+ "test-log",
"thiserror",
"time",
"tokio",
@@ -1492,7 +1494,10 @@ dependencies = [
name = "fpx-app"
version = "0.1.0"
dependencies = [
+ "anyhow",
+ "axum 0.7.5",
"fpx",
+ "nix",
"schemars",
"serde",
"serde_json",
@@ -1501,6 +1506,9 @@ dependencies = [
"tauri-plugin-dialog",
"tauri-plugin-store",
"tauri-plugin-window-state",
+ "tokio",
+ "tracing",
+ "tracing-subscriber",
]
[[package]]
@@ -1533,7 +1541,6 @@ dependencies = [
"serde_json",
"serde_with",
"strum",
- "test-log",
"thiserror",
"time",
"tokio",
diff --git a/fpx-app/Cargo.toml b/fpx-app/Cargo.toml
index 27efde22b..8b5b8d23e 100644
--- a/fpx-app/Cargo.toml
+++ b/fpx-app/Cargo.toml
@@ -13,17 +13,36 @@ repository = { workspace = true }
tauri-build = { version = "2.0.0-rc.11", features = [] }
[dependencies]
-fpx = { version = "0.1.0", path = "../fpx", features = ["config"] }
+anyhow = { workspace = true }
+axum = { workspace = true, default-features = false, features = [
+ "http1",
+ "query",
+ "tokio",
+ "tracing",
+ "ws",
+], optional = true }
+fpx = { version = "0.1.0", path = "../fpx", features = ["config", "libsql"] }
+nix = { version = "0.29", default-features = false, features = ["signal"] }
schemars = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tauri = { version = "2.0.0-rc.14", features = ["config-toml"] }
tauri-plugin-dialog = "2.0.0-rc"
tauri-plugin-store = { version = "2.0.0-rc" }
+tokio = { version = "1", default-features = false, features = [
+ "sync",
+ "process",
+ "macros",
+] }
+tracing = { version = "0.1" }
+tracing-subscriber = { version = "0.3", features = ["env-filter"] }
[features]
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!
custom-protocol = ["tauri/custom-protocol"]
+# This feature enables the new Rust API. If not enabled it will use the TS API.
+fpx-api = ["dep:axum"]
+
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-window-state = "2.0.0-rc"
diff --git a/fpx-app/Tauri.toml b/fpx-app/Tauri.toml
index a71d4ebda..9762595c6 100644
--- a/fpx-app/Tauri.toml
+++ b/fpx-app/Tauri.toml
@@ -3,7 +3,7 @@ identifier = "com.fiberplane.fpx"
[build]
devUrl = "http://localhost:5173"
beforeBuildCommand = "pnpm build:fpx-studio"
-beforeDevCommand = "pnpm dev:api & pnpm dev:frontend"
+beforeDevCommand = "pnpm dev:frontend"
frontendDist = "../studio/dist"
[bundle]
diff --git a/fpx-app/src/api_manager.rs b/fpx-app/src/api_manager.rs
new file mode 100644
index 000000000..7cd5da756
--- /dev/null
+++ b/fpx-app/src/api_manager.rs
@@ -0,0 +1,11 @@
+#[cfg(feature = "fpx-api")]
+mod fpx_api;
+
+#[cfg(feature = "fpx-api")]
+pub use fpx_api::*;
+
+#[cfg(not(feature = "fpx-api"))]
+mod legacy;
+
+#[cfg(not(feature = "fpx-api"))]
+pub use legacy::*;
diff --git a/fpx-app/src/api_manager/fpx_api.rs b/fpx-app/src/api_manager/fpx_api.rs
new file mode 100644
index 000000000..e069ed529
--- /dev/null
+++ b/fpx-app/src/api_manager/fpx_api.rs
@@ -0,0 +1,94 @@
+use fpx::api;
+use fpx::config::FpxConfig;
+use fpx::data::libsql_store::LibsqlStore;
+use fpx::events::memory::InMemoryEvents;
+use fpx::service::Service;
+use std::sync::{Arc, Mutex};
+use tauri::async_runtime::spawn;
+use tokio::sync::broadcast::error::RecvError;
+use tracing::{error, info, trace, warn};
+
+#[derive(Debug, Default)]
+pub struct ApiManager {
+ // Sending a message on this channel will shutdown the axum server.
+ shutdown_tx: Mutex