#How to make 2 Projects out of a fullstack project ?

1 messages · Page 1 of 1 (latest)

high viper
#

I want to have a fullstack project to be separated into a web and a server project. How does this work ?
Is it possible to build the web part as web project with dx build and build the server as usual with cargo ?

grand bolt
#

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.

thin ore
# high viper I want to have a fullstack project to be separated into a web and a server proje...

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

GitHub

Fullstack GUI library for web, desktop, mobile, and more. - DioxusLabs/dioxus

GitHub

Dioxus 0.6 Roadmap This release focus on polishing existing APIs, improving developer experience, upgrading fullstack, and the initial release of a component library. Fullstack basics Goal: expose ...

high viper
#

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).

thin ore
#

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.

tulip cedar
errant swan
#

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