dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Multisite Routing for Fullstack

Open itsezc opened this issue 2 years ago • 3 comments

Specific Demand

Many sites these days consist of the following:

  • Landing site
  • Dashboard
  • Docs

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:

  • #922

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 avatar Dec 28 '23 17:12 itsezc

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

itsezc avatar Jul 06 '24 18:07 itsezc

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)

ealmloff avatar Jul 15 '24 17:07 ealmloff

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

hydra avatar Sep 04 '24 21:09 hydra