This guide takes a new Vite and React app from an empty folder to a live HTTPS address at name.nexaclouds.online. You need Node.js 20 or newer and a GitHub account.
1. Create the app and push it to GitHub
npm create vite@latest my-site -- --template react
cd my-site && npm install && npm run build
git init && git add . && git commit -m "first commit"
# create an empty repository on GitHub, then:
git remote add origin https://github.com/YOUR-USER/my-site.git
git push -u origin mainThe build writes the site to the dist folder with an index.html at its root, which is what NexaCloud expects.
2. Create the project and add the workflow
- Create a free NexaCloud account with GitHub or email.
- Open Projects, enter a name, your GitHub owner and repository, and create the project. Copy the deploy token shown once.
- In your repository open Settings → Secrets and variables → Actions and add a secret named
NEXACLOUD_TOKENwith that token. - Commit the workflow below as
.github/workflows/nexacloud.ymland push.
name: Deploy NexaCloud
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22 }
- run: npm ci && npm run build
- name: Send to NexaCloud
env:
NEXACLOUD_TOKEN: ${{ secrets.NEXACLOUD_TOKEN }}
run: |
cd dist
args=(); while IFS= read -r f; do args+=(-F "${f#./}=@$f"); done < <(find . -type f)
curl --fail-with-body -sS -X POST "https://app.nexaclouds.online/api/deploy/my-project" \
-H "Authorization: Bearer $NEXACLOUD_TOKEN" "${args[@]}"3. Check the result
Open the Actions tab on GitHub. When the run is green, visit https://my-project.nexaclouds.online. Client-side routes such as /about serve your index.html, so React Router works without extra files.
Tips
- Environment values read at build time (
import.meta.env.VITE_*) come from GitHub Actions secrets or variables; never put private keys in a static site. - File names may use letters, numbers, dot, dash, underscore and slash only. Vite’s default output already follows this.
- If a deploy fails, see the troubleshooting list.