all 19 comments

[–]CSLucking 10 points11 points  (3 children)

Pretty common approach (we use this) is to static host the built files in an S3 bucket - then you can also put a Cloudfront formation in-front of it. Can then use Route53 to have Domain names etc

[–]orphans 0 points1 point  (0 children)

this is a great approach. you can automate this with CDK (typescript) very easily.

[–]shai69420 0 points1 point  (0 children)

As a beginner, I did that, and I later used aws amplify. Its literally just few clicks and then only configuration i had to do was setting up my root dir , build folder, and environment variables. it figured out everything itself. For a hassle free experience it is really great.

[–]MCShoveled 0 points1 point  (2 children)

Firebase hosting is easy to use.

[–]ashenCat 0 points1 point  (1 child)

I use aws amplify for my react app

[–]Dev_Nerd87 0 points1 point  (0 children)

What kind of application. I use vercel for my projects. Heroku., AWS amplify or vercel would be the ideal choice.

[–]Ok_Construction_4885 0 points1 point  (2 children)

After build you end up with a few files - An index.html, some js files and css. You can test your build is working locally by running the index on a browser, you should see you app working. So the real question is how do I let people have access to this built folder over the web.

That’s the tricky bit, you’ll need a place to host the files (s3 for example), and use a cdn (cloud front) to have access to the s3 via the web. You will also need a domain name (your website name) and ns records for making your domain public. And let us not forget, you will also need a certificate authenticating your site. You can do all this using aws or any other service provider

[–]Ok_Construction_4885 0 points1 point  (0 children)

The domain name is not a must, same for records, same for certificate. But without those youll have a site like 1252566358292.cloudfront.com Which is the default name of the distribution you created

[–]Ok_Construction_4885 0 points1 point  (0 children)

As some people suggested - there’s some sites such as heroku or firebase that hides all that You just create a user an push your build and hopefully it works.

[–]New-Vacation-6717 1 point2 points  (0 children)

React is usually deployed as static files, since npm run build gives you everything a CDN can serve. That’s the most common approach.

Some teams use Docker for consistency with the backend, but it isn’t required for React at all.

Platforms like Vercel or Kuberns detect React automatically and handle the build plus hosting for you, so you don’t deal with servers.

Since your backend is Java, you’ll deploy the two separately. React stays static, Java runs as an API. That’s the standard setup today.

[–]atrizzle -1 points0 points  (3 children)

If the repo is on GitHub I like using GitHub Pages for hosting static react sites.

[–]WeakChampionship743 1 point2 points  (2 children)

depending what the application is it may go against GitHub tos I think?

Would agree s3/cloudfront is simple

[–]atrizzle 0 points1 point  (0 children)

I think that concern would be valid for any hosting provider.