Build and Launch a Website with AI
Deploy an AI-generated React website to Vercel (2026): Vite builds, variables and blank pages
Publish an AI-generated React + Vite frontend from GitHub to Vercel. Check build settings, public environment variables, refresh 404s, missing images and the production URL before sharing.

An AI builder has exported a React project, but the download contains .tsx files, a src directory and package.json. To publish it, build the project and deploy the output. This guide covers a React + Vite frontend single-page application, using GitHub and Vercel.
The goal is a public HTTPS address where the homepage, page routes and images work. These instructions were checked against official documentation on November 20, 2026; they are a deployment procedure, rather than a report of testing your particular project.
Open package.json. A basic Vite project has scripts similar to these:
{
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
}
}
Keep working scripts already in the project, including TypeScript checks before the build.
| Export | What to do |
|---|---|
Vite dependency, src, index.html and package.json | Follow this frontend deployment guide |
| Plain HTML, CSS and images | Use the HTML publishing guide |
next, next build and Next.js configuration | Use the Next.js framework preset and its output defaults |
| A single React component without an entry point | Ask the AI to produce a complete buildable project |
| Separate backend, database or server rendering | Plan those services separately from the frontend |
An index.html in the source directory does not mean the project can be published without a build. See Vite's static deployment guide.
Create a repository. A private repository can work through Vercel's GitHub integration when you grant access to it. If your AI tool supports GitHub sync, use that. Otherwise extract the ZIP and upload the files through GitHub or commit them with a Git client.
Include source files, images, configuration and the lockfile for the project's package manager. Keep npm, pnpm or Yarn consistent with the original project. Leave out node_modules and files containing credentials. Upload extracted files with their folders intact, rather than the ZIP archive itself.
Check the repository after committing. If the app is inside my-site/, remember that path for the deployment's Root Directory.
If dependencies are already installed in an npm project, you can check its production build locally:
npm run build
npm run preview
Open the preview and check the homepage and images. vite preview is a local build check, not a production server. You can also proceed without a local toolchain and inspect Vercel's build logs.
Create a new project in Vercel, connect GitHub and import your repository. Check these fields before deploying. The getting started documentation describes the current entry points.
| Setting | Typical React + Vite value |
|---|---|
| Framework Preset | Vite |
| Root Directory | The app directory containing package.json |
| Build Command | Commonly npm run build; follow the actual scripts and package manager |
| Output Directory | dist unless build.outDir changes it |
The output directory is generally neither src nor public. A build command must finish and produce deployable files; npm run dev starts a development server instead. Check Vercel's build configuration documentation before overriding automatic settings.
If deployment fails, read the first relevant error in Build Logs. A missing build script suggests checking the directory and package.json; a missing module calls for checking its dependency and import; a missing output directory calls for comparing the output setting with the build results. Commit the fix to the same repository and follow the new deployment.
A display-only site may need none. For an app with an external API, add the required variables in the project's Environment Variables settings. Check Production for the initial project import; configure Preview separately for later branch deployments. See Vercel environments.
For example, a public API base URL might be:
VITE_API_BASE_URL=https://api.example.com
Read it with the exact matching name:
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL;
Replace the example domain with your deployed HTTPS API. Vite bundles VITE_ values into browser code. Keep model API secrets, database passwords and administrator tokens in an actual backend or server function with access controls. Renaming a secret does not create a backend. See Vite environment variables.
After changing a variable, deploy again. Previous deployments retain their values, as explained in Vercel's environment variable documentation.
If the browser calls localhost:8000, it is calling the visitor's own computer. Use the deployed API address and check whether that backend permits your production origin. Verify actual form submissions and authentication separately; the forms and login guide covers the next steps.
Suppose navigating to /about works, but opening that address directly returns 404. A frontend router can handle navigation while the hosting layer still needs an entry-page fallback.
For a frontend-only Vite SPA, add vercel.json alongside the deployed app's package.json:
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"rewrites": [
{ "source": "/(.*)", "destination": "/index.html" }
]
}
Commit, redeploy and test a direct visit to /about and a refresh. This follows Vercel's Vite SPA instructions. It assumes cleanUrls is not enabled and the example app has no custom API routing. Merge with existing configuration. Projects with APIs, proxy rules, SSR or framework routing need routing rules appropriate to their structure. A fallback also cannot repair a missing JavaScript asset.
Open browser developer tools, select Console and Network, then reload. Record the first error and the failing request's URL, status and Content-Type.
| Symptom | Check |
|---|---|
| JavaScript returns 404 or HTML | Output files, asset paths, Vite base and rewrites |
| One image is missing | Whether it was committed, and filename capitalization |
| Homepage returns 200 but stays blank | The JavaScript runtime error and affected component |
| Form reports success without a saved record | Real API response and receiving system |
| Visitors see a Vercel login | Shared URL and deployment protection settings |
For example, public/cover.png is normally referenced as /cover.png; assets under src can be imported for the build tool to process. Remove an obsolete subdirectory base if your actual deployment uses the domain root. See Vite asset handling.
Before sharing, open the production domain while signed out. Check the homepage, a real inner route, refresh, mobile layout and the main action. Confirm a test form record at its destination and the production callback address for login. Check current plan conditions and usage allowances for the site's intended use.
For later updates, commit to the configured production branch and verify the resulting production deployment. If a release breaks the live site, use the deployment and rollback guide.