#How to make 2 Projects out of a fullstack project ?
1 messages · Page 1 of 1 (latest)
If you mean as separate crates, I do not think so.
Dioxus Fullstack works on a server and web feature. You can build one or the other with dx build --platform web or dx build --platform server. I believe dx build will build both the server and client at the same time. You can also run both at the same time simply with dx serve.
When both are built, DX will give you a server executable and the static website files.
I am currently doing this. It is possible. https://github.com/DioxusLabs/dioxus/tree/main/packages/fullstack/examples/axum-desktop <- take this as a base. And make it work with web.
Seperate web part for fullstack and just web using feature like
#[cfg(feature = "web")]
// Hydrate the application on the client
dioxus_web::launch::launch_cfg(app, dioxus_web::Config::new().hydrate(true));
#[cfg(feature = "just_web")]
dioxus_web::launch::launch_cfg(app, dioxus_web::Config::default());
I have discussed it here
https://github.com/DioxusLabs/dioxus/discussions/2223
Kinda messy wayout but gets the job done
I have looked at the example you gave. I expected to have server and web part separated into 2 crates in separate directories, but in the example all seems to be in one directory. I am not sure if this works at all, because i don't understand the way the dispatching of the server functions works (client sees a stub function, server has to export that function).
Sorry, maybe i misunderstood it as i didnt see seperate directory or crate on the question. You wanted to build web with dx build and server with usual cargo. So example is to make it work that way. Its not splitting into two different crate. In my use case i have seperated it as a feature like the example and just work on web for UI with hot reloading and running server with cargo independently during the development time. And on final build running as a fullstack.
if you want to separate them, just use another RPC library like https://github.com/google/tarpc to provide the client-server communication. Then you can keep them otherwise indepedent
There are three crates defined in one in the fullstack example: https://github.com/DioxusLabs/dioxus/blob/main/packages/fullstack/examples/axum-desktop/Cargo.toml#L20-L28
The client binary, the server binary and the shared library that defines the server functions
You could split each one out into seperate folders if you want to