Skip to content

Examples & Recipes

Real-world examples and recipes for common deployment scenarios.

  1. Build your React app:

    Terminal window
    npm run build
  2. Deploy the build folder:

    Terminal window
    bantam deploy ./build -p -s my-react-app
  3. Your app is live at my-react-app.bantam.site

Terminal window
# Build for production
npm run build
# Deploy dist folder
bantam deploy ./dist -p -s my-vue-app
Terminal window
# Build and export static files
npm run build
npm run export
# Deploy the out directory
bantam deploy ./out -p -s my-nextjs-site
Terminal window
# Build your Astro site
npm run build
# Deploy the dist folder
bantam deploy ./dist -p

Perfect for project documentation:

Terminal window
# Build your docs
npm run docs:build
# Deploy to custom domain
bantam deploy ./docs/dist -d docs.myproject.com

Deploy multiple versions:

Terminal window
# Deploy v1
bantam deploy ./docs/v1 -d v1-docs.example.com
# Deploy v2
bantam deploy ./docs/v2 -d v2-docs.example.com
# Deploy latest as main
bantam deploy ./docs/latest -d docs.example.com

Share work-in-progress with teammates:

Terminal window
# 1-day preview for quick feedback
bantam deploy ./preview -e 1 -s feature-preview
Terminal window
# Permanent staging environment
bantam deploy ./build -p -s staging-app
# Production deployment
bantam deploy ./build -p -d app.company.com

In your CI/CD pipeline:

.github/workflows/preview.yml
name: Deploy Preview
on: pull_request
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npm run build
- run: npx @bantamhq/cli deploy ./dist -s pr-${{ github.event.number }}
Terminal window
# Deploy a basic website
bantam deploy ./my-website -p

Directory structure:

my-website/
├── index.html
├── about.html
├── css/
│ └── style.css
└── js/
└── script.js
Terminal window
# Create a landing page
mkdir landing
cd landing
echo '<!DOCTYPE html>
<html>
<head>
<title>Coming Soon</title>
<style>
body { font-family: sans-serif; text-align: center; padding: 50px; }
</style>
</head>
<body>
<h1>Coming Soon!</h1>
<p>Something awesome is in the works.</p>
</body>
</html>' > index.html
# Deploy it
bantam deploy -p -s coming-soon
Terminal window
# Development
bantam deploy ./dist -s myapp-dev
# Staging
bantam deploy ./dist -s myapp-staging
# Production
bantam deploy ./dist -s myapp-prod
{
"scripts": {
"deploy": "npm run build && bantam deploy ./dist -p",
"deploy:staging": "npm run build && bantam deploy ./dist -p -s staging",
"deploy:prod": "npm run build && bantam deploy ./dist -p -d example.com"
}
}

Usage:

Terminal window
npm run deploy:staging

Create deploy.sh:

#!/bin/bash
set -e
echo "Building project..."
npm run build
echo "Running tests..."
npm test
echo "Deploying to Bantam..."
bantam deploy ./dist -p -s production
echo "✅ Deployment complete!"

Make executable and run:

Terminal window
chmod +x deploy.sh
./deploy.sh

While Bantam doesn’t support password protection via CLI, you can:

  1. Deploy temporarily
  2. Add protection via web dashboard
  3. Share secure link
Terminal window
# Deploy for 7 days
bantam deploy ./sensitive-preview -e 7

For projects near size limits:

Terminal window
# Remove development files
rm -rf node_modules
rm -rf .git
# Create optimized archive
zip -r dist.zip dist/ -x "*.map" "*.log"
# Deploy the zip
bantam deploy dist.zip -p

Deploy a Jekyll or Hugo blog:

Terminal window
# Build Jekyll site
bundle exec jekyll build
# Deploy _site folder
bantam deploy ./_site -p -s my-blog