Skip to content

Frontend Deployment

Deploy your frontend directly from Butterbase. Build your app locally, zip the output, upload it, and deploy to a live URL powered by Cloudflare Pages.

Frontend deployments are served globally and aren’t tied to a single region — your static assets reach users fast no matter where your app’s backend lives.

  1. Call create_frontend_deployment to get a deployment ID and upload URL
  2. Upload your built frontend as a zip file
  3. Call start_frontend_deployment to trigger the deployment
  4. Your site goes live at a .pages.dev URL
FrameworkValueNotes
React (Vite)react-vitedist/ folder from npm run build
Next.js (static)nextjs-staticout/ folder from next build && next export
Static HTMLstaticAny plain HTML/CSS/JS files
OtherotherAny framework that produces static output

Step 1: Create deployment

create_frontend_deployment({ app_id: "app_abc123", framework: "react-vite" })

Step 2: Upload your zip

Terminal window
curl -X PUT "{uploadUrl}" \
-H "Content-Type: application/zip" \
--data-binary @frontend.zip

Step 3: Start deployment

start_frontend_deployment({ app_id: "app_abc123", deployment_id: "uuid-1234" })
StatusMeaning
WAITINGCreated, awaiting zip upload
UPLOADINGFiles are being processed
BUILDINGDeployment is being built
READYSucceeded — URL is assigned
ERRORFailed — check the error message
CANCELEDDeployment was canceled
Terminal window
npm install archiver --save-dev
zip-dist.js
const fs = require('fs');
const path = require('path');
const archiver = require('archiver');
const output = fs.createWriteStream(path.join(__dirname, 'frontend.zip'));
const archive = archiver('zip', { zlib: { level: 9 } });
output.on('close', () => {
console.log(`frontend.zip created (${archive.pointer()} bytes)`);
});
archive.on('error', (err) => { throw err; });
archive.pipe(output);
archive.directory('dist/', false);
archive.finalize();
Terminal window
cd dist && zip -r ../frontend.zip .

Set environment variables for frontend builds:

PUT /v1/{app_id}/frontend/env
{
"VITE_API_URL": "https://api.butterbase.ai/v1/app_abc123",
"VITE_APP_NAME": "My App"
}

Framework-specific prefixes:

  • Vite: VITE_ (e.g., VITE_API_URL)
  • Next.js: NEXT_PUBLIC_ (e.g., NEXT_PUBLIC_API_URL)
  • Create React App: REACT_APP_ (e.g., REACT_APP_API_URL)

For single-page app frameworks, a _redirects file is automatically injected so all routes serve index.html. Client-side routing works out of the box. If your zip includes a custom _redirects, it is preserved.

Each deployment is kept independently until you hit your plan’s deployment limit. Delete old deployments you no longer need.

Point your own hostname at this deployment — app.example.com instead of *.pages.dev — with SSL issued and renewed automatically. Requires the Launch plan or above.

Terminal window
butterbase domains add app.example.com
butterbase domains status <domain-id>

Full setup, DNS records, validation methods, apex handling, and troubleshooting live on the Custom Domains page.

LimitValue
Maximum deployment size100 MB (compressed)
Upload URL expiration15 minutes
Deployments per app — Playground2
Deployments per app — Launch10
Deployments per app — Certified25
Deployments per app — EnterpriseUnlimited