Deploy aplikasi React kamu
A React app is just static files once it's built — the CLI doesn't know or care that it's React. The only thing that varies is which folder the build lands in, and that depends on what scaffolded the project.
- 01
Build the app
Run "npm run build" (or the equivalent for your package manager). This bundles and minifies everything into a folder of static files.
- 02
Find the output folder
Scaffolded with Vite (the current default)? It's "dist". Still on Create React App? It's "build" — CRA is deprecated but plenty of projects still use it.
- 03
Deploy
Jalankan "npx harvis deploy dist" dari root proyek kamu. Tanpa konfigurasi dan tanpa login untuk deploy pertama ini — kamu langsung mendapat URL live, plus link klaim pribadi untuk menghubungkan situs itu ke akun gratis kapan pun kamu siap.
Deploy React dengan satu perintah
Build proyek kamu, lalu serahkan folder output ke harvis. Tidak perlu akun untuk deploy pertama — kamu akan mendapat link live dan link klaim pribadi untuk mengelolanya nanti.
npm run build npx harvis deploy dist
Lebih suka menyeret file daripada terminal? Build proyek kamu, lalu lepas folder output di sini dan publikasikan dengan cara yang sama.
Deploy React on every git push
The command above is one you will run again after every change. A git hook runs it for you: this one already points at dist, the folder React builds into.
The folder holding the finished site. "." is the repo root, which is right for hand-written HTML; a static-site generator writes somewhere else.
pre-push fires on every branch and every remote, so a feature branch would publish over your live site. With this on, a push from anywhere else exits early and goes through untouched.
cat > .git/hooks/pre-push <<'EOF' #!/bin/sh set -e npm run build harvis deploy dist EOF chmod +x .git/hooks/pre-push
The options, the gotchas and how to share a hook with your team are on the git hook page.
Pertanyaan deploy React
My project uses Create React App, not Vite. Does anything change?
Only the folder name. Run "npm run build" as usual, then "npx harvis deploy build" instead of "dist". Everything else — routing, assets, the deploy itself — works the same.
Does client-side routing (React Router) work after deploying?
Yes, for the common case. harvis falls back to your entrypoint HTML file for unmatched paths, which is what client-side routers need to handle a direct visit to a deep link like /settings.
Apakah men-deploy aplikasi React ke harvis benar-benar gratis?
Ya, tanpa kartu kredit. Batas gratisnya adalah 500 file dan 50 MB per situs, yang lebih dari cukup untuk build statis React dengan banyak ruang tersisa. Situs yang dipublikasikan tidak kedaluwarsa — situs itu tetap live sampai kamu menghapusnya.
Bisakah saya memakai domain sendiri untuk situs React yang di-deploy?
Setiap situs mendapat alamat harvis.page gratis, dan kamu bisa memilih subdomain sendiri dari dashboard setelah mengklaimnya — my-app.harvis.page, bukan yang acak. Mengarahkan domain yang sudah kamu miliki (seperti mytoko.com) ke situs itu belum didukung.
Apa bedanya ini dengan men-deploy React ke Vercel atau Netlify?
Vercel dan Netlify dibangun di sekitar menghubungkan repo Git dan menjalankan build kamu di server mereka, dengan dashboard untuk mengonfigurasinya. harvis melewati semua itu: kamu build secara lokal (atau di CI kamu sendiri), jalankan satu perintah CLI terhadap folder output, dan dapatkan link — tanpa setup proyek, dan tanpa perlu akun sampai kamu ingin mempertahankan situs itu.
Men-deploy sesuatu yang lain?
Caranya sama di mana pun — build, lalu npx harvis deploy hasil outputnya.