Deploy a (Create) React App

Discover our Public Cloud offer

Shared Hosting for Everyone, imagined by developers, for developers.

Discovering the Public Cloud

An application designed with React is essentially made of static assets for its production part.

If the development cycle uses Node.js HTTP server to serve the pages/views with all the comfort of the development tools (hot-reloading, etc.), it is not mandatory for its production. A simple web server]( will do the trick:

Set up your favorite HTTP server so that a visitor to your site is served index.html, and requests to static paths like /static/js/main..js are served with the contents of the /static/js/main..js file.

On the alwaysdata side

Just create a Static files site pointing to the directory of your choice (e.g. www/my-app).

On the development side

Start by adding an entry in your package.json file telling the build the final URL of your project in production, e.g.:

"homepage": "https://[account]"

In your local development environment, run the build task. If you used a tool like Create React App to bootstrap your project, it is available using the npm task npm run build. This command will produce static assets in a build directory.

You can then deploy these files resulting from the build to the directory you specified earlier when you created the site, for example by using rsync/SSH :

rsync -rz --mkpath build/ [account]@ssh-[account]