Hello,
My website is here https://main--animated-dasik-f465b5.netlify.app/
I want to build and deploy multiple React applications from a single repository, for now, there’s only one app in the repo. Still, in the future I want to be able to push multiple apps, build them when needed, and make them available like this:
-
dnd5
served on https://main--animated-dasik-f465b5.netlify.app/dnd5
-
some-app
on https://main--animated-dasik-f465b5.netlify.app/some-app
…
Is this possible to achieve with Netlify through configuration files? Or do I need a specific setup in the pipeline?
I’d advise using separate sites along with Netlify Rewrites: Rewrites and proxies | Netlify Docs
Do not forget to add the correct homepage
value in package.json
.
Thanks for this quick reply.
I’m confused by what you mean by separate sites, just to be clear: I would need these apps to be served on the same domain as I want to implement a sort of microfrontend approach.
I will try playing around wi redirects but so far it seems like the app in the folder doesn’t get picked up for compilation.
Sorry if my request is confusing, let me know if you need me to elaborate!
Create 2 different sites on Netlify, each from the required folder. On the main app (the one that you would connect the domain to), setup Netlify Rewrites to point each directory to the correct app. For example:
main
has the URL: https://main.netlify.app/
(domain is connected to this site)
dnd5
has the URL: https://dnd5.netlify.app/
some-app
has the URL: https://some-app.netlify.app/
add a _redirects
file to dnd5
with the contents:
/dnd5/* https://dnd5.netlify.app/dnd5/:splat 200!
/some-app/* https://some-app.netlify.app/some-app/:splat 200!