Introduction
This guide covers deploying React single-page applications (SPAs) on Shard Cloud.Creating Your Project
Ensure you have Node.js and npm installed.Creating a New React Project
Building Your Project
Build the production output:build/ folder with optimized static files.
Serving Your React App
React apps are static files that need a server. You can use theserve package:
Option 1: Using serve
Install serve:package.json:
package.json
Option 2: Using Express
Create aserver.js file:
server.js
Shard Cloud Configuration
Create a.shardcloud file:
Using serve:
.shardcloud
.shardcloud
Deploying
Prepare Your Files
Ensure you have:
src/folderpublic/folderpackage.json.shardcloudserver.js(if using Express)
Upload to Shard Cloud
Go to Shard Cloud Dashboard and upload.
Additional Resources
Visit the official React documentation for more information.Troubleshooting
Blank page after deployment
Blank page after deployment
- Check that
homepageinpackage.jsonis set correctly or removed - Verify the build folder is being served correctly
Routes not working (404 on refresh)
Routes not working (404 on refresh)
Ensure your server is configured to serve
index.html for all routes (SPA routing).