DioxusLabs / dioxus

Fullstack app framework for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
21.61k stars 830 forks source link

Multisite Routing for Fullstack #1755

Open itsezc opened 11 months ago

itsezc commented 11 months ago

Specific Demand

Many sites these days consist of the following:

At least this is the case where SaaS, E-commerce and Corporate sites are concerned, often components are shared across these sites to provide users with a consistent experience. Another scenario is providing a slightly different experience based on regions, the use cases are endless and really dependent on the business problem at hand.

Instead of using a monorepo to have multiple Dioxus projects which results in repetitions of configuration (multiple Dioxus.toml, tailwind.config.ts etc.) it would be great if it was possible to extend the router to allow for multiple domains and split routing based on the requested domain.

Related:

Implement Suggestion

Where file based routing is concerned, not sure if there is an on going specification yet but it would be great if we had the following:

Folder structure for file based routing (if necessary)

/
  pages/
    [*]/ // all sites
    landing/ // landing site
    docs/ // docs

Dioxus.toml

[web.app]
  [[sites]]
    name = 'landing'
    path = 'example.com'
    dir = 'landing'
  [[sites]]
    name = 'docs'
    path = 'docs.example.com'
    dir = 'docs'
itsezc commented 4 months ago

@ealmloff @jkelleyrtp could this be considered for the 0.6-fullstack milestone?

ealmloff commented 4 months ago

I think the simplest way to support multi site routing in dioxus is to just run multiple routers on different addresses which you can do in dioxus today. If you want all routers to use the same server function address, you can override the server function address in each router.

Outside of multiple routers, it would be useful to support something like cargo workspace inheritance for Dioxus.toml settings (although likely not in 0.6)

hydra commented 2 months ago

See also https://github.com/DioxusLabs/dioxus/issues/2924