Orbiter
Much like the inspiration behind bhvr, Orbiter is a site hosting platform built on the principles that the web should be open and without walled gardens. It features many of the things every dev wants:
- Simple CLI for local builds and deployments
- Custom Domains
- Analytics
- Version Control for easy rollbacks
- GitHub actions for automated deployments
- Serverless Functions
In this guide we'll show you how to deploy your server
to Orbiter Functions.
Server Deployment
Quickstart
If you haven't already created your bhvr app you can quickly create one using the Orbiter CLI
Setup Orbiter Account
Visit app.orbiter.host to create an account and make an API key on the App Dashboard or on the Keys Page.
Install the Orbiter CLI and Authorize
bun add -g orbiter-cli@latest
orbiter auth
Create a New bhvr Project
Orbiter includes a special version of bhvr that has everything you need to have a fullstack app
orbiter new --template bhvr
This will automatically install, build, and deploy the client and server packages of your bhvr project!
Deploy
Whenever you need to upload, simply run any of the deploy
commands
bun run deploy:client
bun run deploy:server
bun run deploy # Deploys both client and server
Manual Setup
Follow this guide if you already have an existing bhvr project you want to deploy to Orbiter
Setup Orbiter Account
Visit app.orbiter.host to create an account and make an API key on the App Dashboard or on the Keys Page.
Install the Orbiter CLI and Authorize
bun add -g orbiter-cli@latest
orbiter auth
Update Export Format
Update the code inside server/src/index.ts
to use the export format required by Orbiter Functions:
import { Hono } from 'hono'
import { cors } from 'hono/cors'
import type { ApiResponse } from 'shared/dist'
const app = new Hono()
app.use(cors())
app.get('/', (c) => {
return c.text('Hello Hono!')
})
app.get('/hello', async (c) => {
const data: ApiResponse = {
message: "Hello BHVR!",
success: true
}
return c.json(data, { status: 200 })
})
export default app;
export default {
async fetch(request: Request, env: any, ctx: any) {
return app.fetch(request, env, ctx)
}
};
Deploy Server
Move into the server
package and run the deploy command with the server flag:
cd server
orbiter deploy --server
This will:
- Ask which site you want to link the server to (you must already have a client site deployed on Orbiter)
- Ask for the entry path for your server code (typically
src/index.ts
) - Ask for your desired build folder (typically
dist
) - Save your preferences to an
orbiter.json
file - Build and bundle your server code
- Deploy it to Orbiter
If successful, you'll see a returned URL where you can access your API!
Environment Variables
If you need to use environment variables in your server, create a .env
file with your values, then include the --env
flag when deploying:
orbiter deploy --server --env
This will automatically scan your .env
file and include the variables in the deployment. Orbiter will never be able to see your variables, so make sure they are correct!
GitHub Actions
You can set up GitHub Actions to automatically deploy your server whenever you push to your main branch.
Create a .github/workflows/deploy.yaml
file in the root of your project:
mkdir -p .github/workflows && touch .github/workflows/deploy.yaml
Paste the following code into the deploy.yaml
file:
name: "Deploy to Orbiter"
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Deploy to Orbiter
env:
ORBITER_API_KEY: ${{ secrets.ORBITER_API_KEY }}
run: bunx orbiter-cli@latest deploy-server --siteId YOUR_SITE_ID --entryFile src/index.ts --buildDir dist
Replace YOUR_SITE_ID
with your actual site ID, which can be found by clicking the "ℹ" icon on the Orbiter dashboard.
You'll need to add your Orbiter API key as a repository secret. Navigate to GitHub project Settings > Secrets and Variables > Actions. Click New repository secret
, then use ORBITER_API_KEY
as the name, and paste your API key into the box below.
Further Reference
For more information about how to use Orbiter Functions, visit the official docs:
Orbiter Functions Docs