Deploy a React Vite app from GitHub to managed hosting with repo prep, build config, env vars, testing, and automatic redeployment checks.
Deploying a front-end application from GitHub to a managed hosting platform involves more than pushing code. The build command, output directory, environment variables, and branch selection all have to line up before the first deployment succeeds. This guide walks through that process using Hostinger Web Apps Hosting and a React application built with Vite, from repository preparation to verifying that a new commit redeploys automatically.
The source material for this walkthrough is a tutorial published on October 20, 2026, by Ksenija. It documents a deployment of a task management app called TaskFlow, covering seven stages: repository preparation, deployment method selection, GitHub connection, deployment configuration, build log review, application testing, and automatic redeployment verification.
Why repository preparation determines deployment success
The first step is to run the application locally and test its main functionality. A working local version makes deployment problems easier to isolate, because an error that already appears locally is not caused by the hosting environment.
The project must also include the configuration files its framework requires. The React project in this example uses Vite and includes a `package.json` file that defines its dependencies and available scripts. That file must contain the production build script the application needs.
This matters specifically on Hostinger: the platform does not let you type a build command. Instead, you select it from a dropdown of the scripts defined in `package.json`, so a script that is not defined there cannot be selected. In the Vite project, the relevant script makes `npm run build` available as the build command during configuration.
For a project not already tracked with Git, the next step is to open its directory in the terminal and initialize a repository. Before staging files, the `.gitignore` file in the project root should be checked to confirm it lists files and directories Git should not track. In the Vite project, `node_modules` is already listed, so locally installed dependencies are not added to the repository. Projects that lack a `.gitignore` file need one created in the root directory, alongside files such as `package.json`, with each ignored file or directory on a separate line.
Sensitive values such as API keys and credentials should stay out of the repository. The values the deployed application needs are added as environment variables during deployment instead.
Once the included files are confirmed, the project is staged and committed. That commit is the version pushed to GitHub. An empty repository is then created on GitHub, without initializing it with files such as `README.md` or `.gitignore` if those already exist locally. The local repository is connected to the GitHub repository, and the branch containing the production-ready application is pushed. The branch may be named `main`, `master`, or something else; the name can be checked with `git branch`. The branch that is pushed becomes the production branch selected during deployment configuration.
When pushing with an HTTPS GitHub URL, GitHub requires identity verification and does not accept a normal GitHub password. A supported method such as a personal access token (PAT) is used instead. Finally, the repository is opened on GitHub to confirm the latest project files are present.
Choosing a deployment method
The deployment method must support the application's framework, runtime, and resource requirements. Hostinger Web Apps Hosting retrieves the code from the GitHub repository, builds the application, and runs it on managed infrastructure, so no server configuration or custom continuous integration and continuous deployment (CI/CD) pipeline is needed.
Applications that run server-side code require a specific runtime and often additional server resources. Those needs should be accounted for when choosing the right environment.
Connecting the repository and configuring the deployment
In the Hostinger dashboard, the path is Websites → Web Apps, which opens the deployment area where a GitHub or GitLab repository can be connected or the application uploaded as a ZIP file. For a GitHub deployment, the process starts with Get started.
Before connecting the repository, the web address used to access the deployed app is chosen. An existing domain can be used or a new one entered. Selecting Use temporary domain gives the app a Hostinger-provided address so it can be deployed and tested first, with a custom domain connected later.
The next choice is how Hostinger accesses the application code. Because the project is already on GitHub, the option is Continue with GitHub. Connecting the account gives Hostinger access to the authorized repositories and sets up the connection used for future deployments. Alternatively, the GitHub URL can be entered directly without connecting an account if the repository is public. The account connection is what enables automatic deployment when new changes are pushed.
After connecting to GitHub, the repository containing the application is selected. Hostinger then detects deployment settings from the repository, starting with the framework and branch. The branch should contain the version of the application to publish.
In the example, Hostinger correctly detected Vite, selected the `main` branch, selected Node.js 22 as the default version, and set the repository root (`./`) as the application directory. It detected `npm run build` as the build command and `dist` as the output directory. Because build commands come from the scripts in `package.json`, the needed command must be defined there. These detected settings matched the Vite project and were kept unchanged.
The settings vary by application type. Front-end applications typically use a build command and output directory, while back-end applications require an entry file that Hostinger uses to start the application. Full-stack applications, such as Nuxt, use both. A Node.js back end, for instance, might use `src/server.js` as its entry file, so how the application starts should be verified when preparing a Node.js project for production.
Hostinger also detects environment variables in the project. Variables without a value are marked Action required and must be completed before deploying. Values can be entered individually or imported from a `.env` file using Import .env. Variable names must contain only uppercase letters, numbers, and underscores, such as `API_KEY`. Variables that do not follow this format must be renamed, otherwise the Deploy button stays grayed out and deployment cannot proceed.
Where a variable is used matters. In front-end applications, variables used during the build are included in the code delivered to the browser, allowing visitors to access them. Private API keys, credentials, and other secrets should not be exposed through client-side code.
Deploying, reading build logs, and testing
After a final review of the configuration, clicking Deploy builds the application from the selected GitHub branch and publishes it to the domain shown at the top of the page. A message indicates it is safe to leave the page if the build takes longer than expected. When the process finishes, the Deployment completed screen confirms the app is live and displays its address as the App at Hostinger link.
The Build logs section shows what happened during deployment. In the example, the log confirmed that the build completed, the generated files were published, and the deployment finished successfully. If a deployment fails, the first error in the build log shows which stage caused the failure. Selecting Settings and redeploy, correcting the responsible setting, and clicking Save and redeploy runs the deployment again without repeating the initial setup.
Once deployment completes, the app is opened from its App at Hostinger link and its main functionality is tested. The deployed TaskFlow app loaded correctly and its interactive features worked as expected: a new task was added, another was marked as completed, and the task counters updated accordingly. The same workflows tested locally should be repeated before making the app public, because this reveals production-specific problems such as failed API requests, missing environment variables, or assets that do not load correctly.
A successful build does not always mean the application runs correctly. If the deployment completes but the app crashes or fails to start, Runtime logs in the website dashboard should be opened. The error messages identify the failing part of the application, such as a missing environment variable or an incorrect entry file. After correcting the problem, the application is redeployed and the affected functionality tested again.
Verifying automatic redeployment
After the initial deployment, changes pushed to the connected production branch automatically trigger a new deployment. To verify this, a visible change is made to the application and tested locally before committing. In the example, the main heading in the TaskFlow app was changed from "Keep your work moving." to "Plan today. Make progress." — a clear change to look for on the live site after the next deployment.
The change was committed and pushed to the `main` branch connected to Hostinger. Hostinger detected the new commit and automatically started another deployment. Progress can be followed in the Web Apps dashboard, where the latest deployment shows the branch, commit, and deployment status. After the deployment reached Completed, the live application showed the new heading, confirming that the GitHub update reached the live application without a manual redeployment.
Alternative ways to deploy from GitHub
Three other approaches are worth knowing. GitHub Pages publishes static files directly from a repository. In the repository's Settings → Pages, selecting Deploy from a branch and choosing the branch and folder containing the files to publish causes GitHub to build and publish the site from the selected source. This method suits static projects and does not provide the server-side runtime required by back-end applications.
GitHub Actions gives control over the steps that run between pushing code and deploying it. A workflow file is created in `.github/workflows` and defines its trigger and jobs. The workflow can run tests or build commands first and start the deployment only after those jobs succeed. In the example, pushing a commit to `main` triggered a workflow with two jobs: the test job ran first, and the deploy job started only after it succeeded. The workflow run shows the status of each job, making it easier to trace where a failure occurred.
Hostinger Connector offers an optional alternative for deploying through an AI coding assistant. The source material notes this option but does not document its configuration steps, so it is mentioned here only for completeness.
What this means for readers
The practical takeaway is that the constraints of the hosting platform shape what must be prepared in the repository. Because Hostinger takes the build command from `package.json` scripts rather than accepting typed input, a missing production build script blocks deployment before it starts. Because front-end environment variables are delivered to the browser, secret handling has to be decided before configuration, not after. And because the production branch is chosen once and then watched for commits, the branch that is pushed is the branch that goes live.
The tutorial does not report build times, pricing, or performance benchmarks, and none should be inferred. What it does establish is a repeatable sequence: prepare and test locally, commit and push, connect the repository, confirm the detected framework, branch, build command, output directory, and environment variables, deploy, read the logs if something fails, test the live app, and confirm that a new commit redeploys on its own.
Last updated: October 20, 2026
Reader notes 0
- No notes yet. Corrections and first-hand test results are welcome.
