DocsPluginsShowcaseReleases
npmStar us on GitHub

Getting Started

IntroductionInstallationProject StructureLayouts and PagesLinking and Navigating

Routing

Folder-Based RoutingFile-Based RoutingDynamic RoutesParallel RoutesIntercepting RoutesCatch-All RoutesMDX & Markdown Pages

Special Files

Loading UIError BoundariesTemplateDefaultNot Found

Data Fetching

LoadersActionsAccessing Route Data

Metadata

Metadata & SEOOpen Graph & TwitterIcons & Favicons

API Routes

API Routes OverviewPlain Function HandlersHono IntegrationDynamic API Routes

Environment Variables

OverviewPrefixes & Client ExposureUsing in API Routes

Styling

CSS OverviewTailwind CSSCSS Modules

Platforms

WebWindowsmacOSLinuxAndroidiOS

Deployment

Deployment OverviewProduction ServerStatic ExportHosting Providers

A native React framework for building cross-platform applications from a single codebase.

Resources

  • Documentation
  • Plugins
  • Showcase
  • Releases

Community

  • GitHub Discussions
  • Reddit
  • Discord
  • LinkedIn

More

  • npm
  • GitHub
  • Issues
  • License

© 2026 Bini Cooperation.

Deploying

Learn how to deploy your Bini.js application to production.

Bini.js can be deployed to any platform that supports Node.js, or exported as static files for static hosting. For all hosting platforms except static export, use the unified npm run deploy command.

Deployment Options

PlatformCommandNotes
Node.jsnpm run deployDefault - uses the production server
Static Exportnpm run buildGitHub Pages, S3, Firebase, Surge
Netlifynpm run deployAutomated by the deploy tool
Vercelnpm run deployAutomated by the deploy tool
Cloudflarenpm run deployAutomated by the deploy tool
Deno Deploynpm run deployAutomated by the deploy tool
Unified command: npm run deploy works for Node.js, Netlify, Vercel, Cloudflare, and Deno Deploy. Static export uses npm run build which pre-renders all routes.

Deploy Anywhere

The deploy tool makes deployment effortless. Simply run:

>_Terminal
$ npm run deploy

When you run npm run deploy, it will:

1Run the deploy command
2Choose a target
3Config is generated
4Pushed to GitHub

Step 1 - Choose the target platform

It asks which platform you want to deploy to. Choose Web for any hosting provider:

>_Terminal
◆
Platforms?
◼ Web
◻ Desktop
◻ Android
◻ iOS
↑/↓ to navigate • Space: select • Enter: confirm

Step 2 - Choose the hosting provider

If you picked Web, it then asks for the hosting provider. Each section below explains what the deploy tool generates for that target.

>_Terminal
◆
Hosting provider?
● Node.js (default)
○ Netlify
○ Vercel
○ Cloudflare Workers
○ Deno Deploy
↑/↓ to navigate • Enter: confirm

Step 3 - Enter your GitHub repository URL

It needs to know where to push the project. Enter your repository URL (skipped when an origin remote already exists):

>_Terminal
◆
GitHub repository URL?
https://github.com/you/my-app

Step 4 - Choose the branch to push to

By default it pushes to the remote's default branch, falling back to main. You can pick an existing branch or create a new one:

>_Terminal
◆
Branch to push to?
● main (default)
○ + New branch...

Step 5 - Confirm

A confirmation prompt appears before generating files and pushing:

>_Terminal
◆
Generate deployment files and push to GitHub?
●Yes/○No

Step 6 - Commit message

Finally, it asks for a commit message. Press Enter to use the default:

>_Terminal
◆
Commit message (press Enter for the default):
chore: add deployment configuration
Zero config required: The deploy tool automatically detects your project structure, picks the right adapter, and generates platform-specific configuration. No changes to vite.config.ts needed. Learn more at bini-deploy.

Node.js Server

The default deployment option. Bini.js ships with a zero-dependency production server.

Your app will be served at the port specified by PORT (default: 3000):

.env
# .env
PORT=3000

Platforms

  • Railway - Auto-detects Node.js, just connect your repo
  • Render - Set build command to npm run build and start to npm run start
  • Fly.io - Use the Node.js builder
  • VPS - Use pm2 to keep the server running
Production server features: ETag support, 30s timeouts, 10MB body limit, graceful shutdown, and automatic port increment.

Netlify

When you choose Netlify in the hosting prompt, the deploy tool automatically generates:

netlify.toml
netlify
functions
api.mjs
edge-functions
spa-fallback.ts
  • netlify.toml - Build and function configuration
  • netlify/functions/api.mjs - API route handler
  • netlify/edge-functions/spa-fallback.ts - only without pre-rendering
Important: Netlify Functions run on a Node-like runtime but are not full Node - packages like nodemailer, fs, or path may not work. Use Web API alternatives.

Vercel

When you choose Vercel in the hosting prompt, the deploy tool automatically generates:

vercel.json
api
index.ts
tsconfig.json
  • vercel.json - Routing and build configuration
  • api/index.ts - Serverless function entry point
  • api/tsconfig.json - only for TypeScript projects with API routes

Cloudflare Workers

When you choose Cloudflare Workers in the hosting prompt, the deploy tool automatically generates:

wrangler.toml
worker.ts
public
.assetsignore
  • wrangler.toml - Worker configuration
  • worker.ts - Worker entry point with API routes
  • public/.assetsignore - excludes the API bundle from static assets

Deno Deploy

When you choose Deno Deploy in the hosting prompt, the deploy tool automatically generates:

server
index.ts
  • server/index.ts - Deno Deploy entry point

Static Export

For static hosting, npm run build pre-renders every route to static HTML. This is the only deployment method that does not use npm run deploy.

>_Terminal
$ npm run build

The pre-rendered files will be in the dist/ folder. Suitable for:

  • GitHub Pages
  • Amazon S3
  • Firebase Hosting
  • Cloudflare Pages (static mode)
  • Netlify (static mode)
  • Vercel (static mode)

GitHub Pages

Set the base option in vite.config.ts if deploying to a subpath:

vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  base: '/your-repo-name/',
  plugins: [react()],
})

Then deploy the dist/ folder to GitHub Pages.

Pre-rendering: npm run build pre-renders all static routes to HTML and creates shell pages for dynamic routes. The client hydrates on load. No separate export command needed.

Platform Comparison

PlatformAPI RuntimeStaticDynamicCommand
Node.jsNode.js✓✓npm run deploy
NetlifyNode.js Functions✓✓npm run deploy
VercelNode.js Runtime✓✓npm run deploy
CloudflareWorkers✓✓npm run deploy
Deno DeployDeno✓✓npm run deploy
Static ExportN/A✓via shell pagesnpm run build

Environment Variables in Production

Set environment variables through your hosting platform's dashboard:

PlatformHow to Set
Node.jsUse .env file or system environment variables
NetlifySite settings → Environment variables
VercelProject settings → Environment Variables
Cloudflarewrangler.toml or dashboard
Deno DeployProject settings → Environment Variables
Never commit .env files with secrets to your repository. Use platform environment variables for production.

Best Practices

  • Test builds locally - Run npm run build and npm run preview before deploying.
  • Use environment variables - Keep configuration separate from code.
  • Set up CI/CD - Automate deployments with GitHub Actions or similar.
  • Monitor your app - Use platform analytics to track performance.
  • Use a custom domain - Configure SSL for secure connections.

Production Server

Run the production server for Node.js hosting with ETag caching and graceful shutdown.

Static Export

Pre-render every route to static HTML for GitHub Pages, S3, or any static host.

Hosting Providers

Deploy to Vercel, Netlify, Cloudflare Workers, Deno Deploy, or Node.js.

Was this helpful?
PreviousiOS
NextProduction Server

On this page

  • Deployment Options
  • Deploy Anywhere
  • Node.js Server
  • Netlify
  • Vercel
  • Cloudflare Workers
  • Deno Deploy
  • Static Export
  • Platform Comparison
  • Environment Variables
  • Best Practices
Edit this page on GitHub

Deploying

Learn how to deploy your Bini.js application to production.

Bini.js can be deployed to any platform that supports Node.js, or exported as static files for static hosting. For all hosting platforms except static export, use the unified npm run deploy command.

Deployment Options

PlatformCommandNotes
Node.jsnpm run deployDefault - uses the production server
Static Exportnpm run buildGitHub Pages, S3, Firebase, Surge
Netlifynpm run deployAutomated by the deploy tool
Vercelnpm run deployAutomated by the deploy tool
Cloudflarenpm run deployAutomated by the deploy tool
Deno Deploynpm run deployAutomated by the deploy tool
Unified command: npm run deploy works for Node.js, Netlify, Vercel, Cloudflare, and Deno Deploy. Static export uses npm run build which pre-renders all routes.

Deploy Anywhere

The deploy tool makes deployment effortless. Simply run:

>_Terminal
$ npm run deploy

When you run npm run deploy, it will:

1Run the deploy command
2Choose a target
3Config is generated
4Pushed to GitHub

Step 1 - Choose the target platform

It asks which platform you want to deploy to. Choose Web for any hosting provider:

>_Terminal
◆
Platforms?
◼ Web
◻ Desktop
◻ Android
◻ iOS
↑/↓ to navigate • Space: select • Enter: confirm

Step 2 - Choose the hosting provider

If you picked Web, it then asks for the hosting provider. Each section below explains what the deploy tool generates for that target.

>_Terminal
◆
Hosting provider?
● Node.js (default)
○ Netlify
○ Vercel
○ Cloudflare Workers
○ Deno Deploy
↑/↓ to navigate • Enter: confirm

Step 3 - Enter your GitHub repository URL

It needs to know where to push the project. Enter your repository URL (skipped when an origin remote already exists):

>_Terminal
◆
GitHub repository URL?
https://github.com/you/my-app

Step 4 - Choose the branch to push to

By default it pushes to the remote's default branch, falling back to main. You can pick an existing branch or create a new one:

>_Terminal
◆
Branch to push to?
● main (default)
○ + New branch...

Step 5 - Confirm

A confirmation prompt appears before generating files and pushing:

>_Terminal
◆
Generate deployment files and push to GitHub?
●Yes/○No

Step 6 - Commit message

Finally, it asks for a commit message. Press Enter to use the default:

>_Terminal
◆
Commit message (press Enter for the default):
chore: add deployment configuration
Zero config required: The deploy tool automatically detects your project structure, picks the right adapter, and generates platform-specific configuration. No changes to vite.config.ts needed. Learn more at bini-deploy.

Node.js Server

The default deployment option. Bini.js ships with a zero-dependency production server.

Your app will be served at the port specified by PORT (default: 3000):

.env
# .env
PORT=3000

Platforms

  • Railway - Auto-detects Node.js, just connect your repo
  • Render - Set build command to npm run build and start to npm run start
  • Fly.io - Use the Node.js builder
  • VPS - Use pm2 to keep the server running
Production server features: ETag support, 30s timeouts, 10MB body limit, graceful shutdown, and automatic port increment.

Netlify

When you choose Netlify in the hosting prompt, the deploy tool automatically generates:

netlify.toml
netlify
functions
api.mjs
edge-functions
spa-fallback.ts
  • netlify.toml - Build and function configuration
  • netlify/functions/api.mjs - API route handler
  • netlify/edge-functions/spa-fallback.ts - only without pre-rendering
Important: Netlify Functions run on a Node-like runtime but are not full Node - packages like nodemailer, fs, or path may not work. Use Web API alternatives.

Vercel

When you choose Vercel in the hosting prompt, the deploy tool automatically generates:

vercel.json
api
index.ts
tsconfig.json
  • vercel.json - Routing and build configuration
  • api/index.ts - Serverless function entry point
  • api/tsconfig.json - only for TypeScript projects with API routes

Cloudflare Workers

When you choose Cloudflare Workers in the hosting prompt, the deploy tool automatically generates:

wrangler.toml
worker.ts
public
.assetsignore
  • wrangler.toml - Worker configuration
  • worker.ts - Worker entry point with API routes
  • public/.assetsignore - excludes the API bundle from static assets

Deno Deploy

When you choose Deno Deploy in the hosting prompt, the deploy tool automatically generates:

server
index.ts
  • server/index.ts - Deno Deploy entry point

Static Export

For static hosting, npm run build pre-renders every route to static HTML. This is the only deployment method that does not use npm run deploy.

>_Terminal
$ npm run build

The pre-rendered files will be in the dist/ folder. Suitable for:

  • GitHub Pages
  • Amazon S3
  • Firebase Hosting
  • Cloudflare Pages (static mode)
  • Netlify (static mode)
  • Vercel (static mode)

GitHub Pages

Set the base option in vite.config.ts if deploying to a subpath:

vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  base: '/your-repo-name/',
  plugins: [react()],
})

Then deploy the dist/ folder to GitHub Pages.

Pre-rendering: npm run build pre-renders all static routes to HTML and creates shell pages for dynamic routes. The client hydrates on load. No separate export command needed.

Platform Comparison

PlatformAPI RuntimeStaticDynamicCommand
Node.jsNode.js✓✓npm run deploy
NetlifyNode.js Functions✓✓npm run deploy
VercelNode.js Runtime✓✓npm run deploy
CloudflareWorkers✓✓npm run deploy
Deno DeployDeno✓✓npm run deploy
Static ExportN/A✓via shell pagesnpm run build

Environment Variables in Production

Set environment variables through your hosting platform's dashboard:

PlatformHow to Set
Node.jsUse .env file or system environment variables
NetlifySite settings → Environment variables
VercelProject settings → Environment Variables
Cloudflarewrangler.toml or dashboard
Deno DeployProject settings → Environment Variables
Never commit .env files with secrets to your repository. Use platform environment variables for production.

Best Practices

  • Test builds locally - Run npm run build and npm run preview before deploying.
  • Use environment variables - Keep configuration separate from code.
  • Set up CI/CD - Automate deployments with GitHub Actions or similar.
  • Monitor your app - Use platform analytics to track performance.
  • Use a custom domain - Configure SSL for secure connections.

Production Server

Run the production server for Node.js hosting with ETag caching and graceful shutdown.

Static Export

Pre-render every route to static HTML for GitHub Pages, S3, or any static host.

Hosting Providers

Deploy to Vercel, Netlify, Cloudflare Workers, Deno Deploy, or Node.js.

Was this helpful?
PreviousiOS
NextProduction Server

On this page

  • Deployment Options
  • Deploy Anywhere
  • Node.js Server
  • Netlify
  • Vercel
  • Cloudflare Workers
  • Deno Deploy
  • Static Export
  • Platform Comparison
  • Environment Variables
  • Best Practices
Edit this page on GitHub