one-deployment
Deployment
Official docs: one build, one serve, Configuration, FAQ
Build
# build for web (default)
one build
# build for specific platform
one build web
one build ios
one build android
Set ONE_SERVER_URL for production:
ONE_SERVER_URL=https://myapp.com one build
Output goes to dist/ with client/, server/, and api/ folders.
Parallel Builds
One uses worker threads to build static pages across CPU cores. Disable if needed:
one({ build: { workers: false } })
// or: ONE_BUILD_WORKERS=0 npx one build
Security Scanning
One automatically scans client bundles for leaked secrets (API keys, tokens). Set to 'error' for production:
one({
build: {
securityScan: 'error', // 'warn' (default) | 'error' | false
},
})
Detects Anthropic, OpenAI, Stripe, GitHub, AWS keys, bearer tokens, and generic secret patterns.
Node (Default)
One includes a production Hono server.
one build
one serve
Cluster Mode
For high-traffic deployments, use cluster mode to fork workers across CPU cores:
one serve --cluster # use all CPU cores
one serve --cluster=4 # use 4 workers
Each worker handles requests independently with automatic restart on crash.
When to use cluster: 200+ concurrent connections, SSR-heavy workloads, multi-core servers.
Programmatic Usage
import { serve } from 'one/serve'
await serve({
port: 3000,
compress: true,
cluster: true,
loadEnv: true,
// app: customHonoApp // bring your own Hono
})
Docker
FROM node:20-slim
WORKDIR /app
COPY package.json bun.lockb ./
RUN npm install --production
COPY dist/ dist/
EXPOSE 3000
CMD ["npx", "one", "serve", "--port", "3000", "--cluster"]
Vercel
Configuration
one({
web: {
deploy: 'vercel',
},
})
Required: vercel.json
{
"cleanUrls": true
}
cleanUrls: true is required for SSG routes to work correctly.
Deploy
# auto-deploy on git push, or:
one build
vercel deploy --prebuilt
Build generates .vercel/output/ with static assets and serverless functions.
How it works
- SSG pages → static files
- SSR pages → serverless functions
- API routes → serverless functions
Cloudflare Workers
Configuration
one({
web: {
deploy: 'cloudflare',
},
})
Deploy
one build
cd dist
wrangler deploy
Build generates dist/worker.js and dist/wrangler.jsonc.
How it works
- Routes are lazy-loaded (loaded on-demand, not all upfront)
- Static assets served from Workers KV or R2
- SSR/API routes run in the Worker
To customize, create wrangler.jsonc in the project root — One merges its config with yours.
Static Export
For SPA or SSG sites with no server-side loaders, just serve dist/client/:
one build
npx serve dist/client
# or any static host: Netlify, GitHub Pages, S3, etc.
No one serve needed.
Environment Variables
# required for loaders and API routes in production
ONE_SERVER_URL=https://myapp.com one build
Other env vars: PORT (default 3000), HOST (default localhost).
Native Builds
One integrates with existing Expo/React Native build processes:
# generate native projects
one prebuild
# build and run
one run:ios
one run:android
For CI/CD, use EAS Build — see the EAS guide.
Decision Guide
| Scenario | Deploy Target |
|---|---|
| Full control, any cloud | 'node' (default) |
| Serverless, auto-scaling | 'vercel' |
| Edge computing, global | 'cloudflare' |
| Static site, no server | Serve dist/client/ |
More from onejs/skills
one-guides
Guides and recipes for One framework. Covers authentication, images, CSS optimization, dark mode, Tamagui, MDX, OpenGraph images, ISR, skew protection, native iOS builds, EAS, CRA migration, and common issues.
1one-render-modes
Configure render modes (SSG, SSR, SPA, API) in One framework. Use when choosing how pages are rendered, setting up static generation, or mixing render strategies.
1one-loaders
Server-side data loading in One framework. Use when fetching data for pages, implementing caching, redirects, response headers, ISR, refetching, or file-driven content with loaders.
1one-api-routes
Create API routes in One framework. Use when building HTTP endpoints, webhooks, REST APIs, or server-side logic with +api.ts files.
1building-with-one
Complete guide for building full-stack React apps with One framework. Covers routing, layouts, navigation, components, hooks, typed routes, styling, configuration, devtools, and cross-platform (web + native) development.
1