Skip to Content
AI-built apps

Deploy a Bolt app on Zenifra

You keep building and editing the app in Bolt, and Zenifra deploys a new version on every change. The path goes through GitHub: Bolt pushes the code to a repository, and Zenifra builds and deploys from it.

This guide was tested end to end with a new Bolt app on Bolt's free plan: email and password sign-in, the Bolt database, reloading internal routes, and an automatic deploy after an edit made in Bolt.

The video is a real recording of the whole path: the app built in Bolt, the repository on GitHub, the project created in the Zenifra console, the app live and a Bolt edit deployed on its own. Only the waits, app generation and the build, are sped up.

1. Create the app in Bolt

Describe the app in Bolt and wait for the first version. If the app has sign-in or stores data, Bolt uses its own database, Bolt Database, which keeps working with the app deployed on Zenifra.

Bolt home screen with the prompt for a to-do list app with sign-in

When you ask for an app, Bolt usually generates a React and Vite SPA: package.json has vite and the "build": "vite build" script. That is the case this guide covers. If your project has next in its dependencies, follow Deploy Next.js.

2. Create the GitHub repository from Bolt

In the Bolt project, click the GitHub icon in the top-right corner.

Bolt's Connect to GitHub dialog with the Log in to GitHub button

  1. Click Log in to GitHub and authorize StackBlitz, the company behind Bolt.
  2. Install the Bolt.new (by StackBlitz) app on your GitHub account. Choose All repositories, or add the repository once it is created.
  3. Back in Bolt, click the GitHub icon again, name the repository, and click Create repository.

Bolt's Create a GitHub repository dialog with the repository name filled in

Bolt creates a private repository with the app's code and commits to the main branch on every change you make in Bolt.

  • If the repository name field is disabled, with the message "Install the GitHub App", the Bolt app is not installed on the account yet. Do step 2.
  • The repository starts without the .env file: the .gitignore Bolt creates leaves it out. The database variables are added in Zenifra, in step 5.

Details in Bolt's documentation on GitHub.

3. Add serve to the project

Zenifra serves the SPA with the serve package, which a new Bolt project does not include. Ask Bolt itself:

Add the serve package, version 14, to the dependencies in package.json, to serve the dist folder in production. Don't change anything else in the app.

Bolt prompt asking to add the serve package to the dependencies

Bolt updates package.json and package-lock.json and pushes the commit to GitHub on its own. If you prefer, run npm install serve in Bolt's terminal.

4. Copy the database variables

The app reads the database address and public key from two variables, VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY, kept in the project's .env in Bolt. Bolt's code editor shows these values as asterisks. To copy them:

  1. In Bolt, open the Code view and the Terminal tab below the editor.
  2. Run:
cat .env
  1. Copy both values. They go into the Zenifra console in the next step.

The VITE_SUPABASE_ANON_KEY key is public by design: it ships to the browser of everyone who uses the app. The data is protected by the per-user access rules Bolt creates in the database.

5. Create the project on Zenifra

In the console, connect your GitHub account and install the Zenifra GitHub App on the account where Bolt created the repository. Since the repository is private, it must be included in the installation.

Click + Create project, choose HTTP Application, the Basic plan, and name the project. Under Source and port, choose Git repository, GitHub as the Git provider, the repository Bolt created, and the main branch.

Source and port section with the Bolt repository and the main branch selected

Fill in the fields like this:

FieldValue
RuntimeNode.js
Version24
Build commandnpm run build
Start commandnpx serve -s dist -l tcp://0.0.0.0:3000
Port3000

Build and start commands and port 3000 filled in

Bolt keeps a package-lock.json in the repository. On the Node.js runtime, Zenifra installs dependencies with npm ci from that file, at the same versions Bolt uses. The -s option of serve answers any app route with index.html, so a page like /about opens straight from the URL and on reload.

Under Environment Variables, add:

VariableValue
VITE_SUPABASE_URLfrom the project's .env in Bolt
VITE_SUPABASE_ANON_KEYfrom the project's .env in Bolt

VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY variables added

VITE_* variables are built into the app's JavaScript during the build. They must exist before the first build, and any change to them needs a New build.

6. Deploy and test

When you create the project, the first build starts right away and takes less than a minute. Follow it in the project page's Deploys tab.

Project Deploys tab with the first build completed

When the build finishes, open the project URL and test:

  • sign-up or sign-in, and a screen that reads and writes data;
  • an internal route, opened straight from the URL and reloaded in the browser.

Bolt app running on Zenifra, with a signed-in user's task list

7. Keep editing in Bolt

Every change you make in Bolt becomes a commit on main, and Zenifra deploys the new version on its own, with no clicks in the console. See Auto deploy.

Deploys tab with a new build started by Bolt's commit

What stays in Bolt

Zenifra now serves the app, but the database, sign-in, files, and functions of Bolt Database keep running in Bolt. The app deployed on Zenifra uses the same data as the app in Bolt.

If the app sends links by email, such as sign-up confirmation or password reset, or uses social sign-in, add the Zenifra URL under Database › Authentication › Site URL and URI Allow List in Bolt, so those links return to the new address. Email and password sign-in without confirmation worked in our test without this change.

To move the database out of Bolt as well, the Claim in Supabase option under Database › Advanced moves it to your own Supabase account. Details in Bolt's advanced database settings.

Static plan with NGINX

The path in this guide runs serve on the Node.js runtime, which needs the Basic plan or higher. To use the Static plan, serve the SPA with the NGINX image. See Static sites and SPAs.

Custom domain

Once the app works on the Zenifra URL, point your domain to the project. See Custom domains.

Common problems

SymptomLikely causeWhat to do
Blank page; the browser console shows Missing Supabase environment variablesThe VITE_* variables did not exist at build timeAdd both variables and choose New build
A route like /about returns 404 on reloadThe -s option is missing from the Start commandUse npx serve -s dist -l tcp://0.0.0.0:3000
Blank page in Bolt's preview too, with Missing Supabase environment variablesThe generated code reads import.meta.env.SUPABASE_URL, without the VITE_ prefix; Vite only exposes VITE_ variables to the browserIn the client file (e.g. src/lib/supabase.ts), change it to import.meta.env.VITE_SUPABASE_URL and import.meta.env.VITE_SUPABASE_ANON_KEY
The build fails with serve: not foundserve is not in dependenciesRepeat step 3
In Bolt, the repository name field is disabledThe Bolt app is not installed on the GitHub accountInstall the Bolt.new (by StackBlitz) app and open the dialog again
The Bolt repository does not show up when creating the projectThe Zenifra GitHub App does not include the repositoryCheck the installation in Connect GitHub

Last updated on

On this page