One Logo Pool Ball
wwwwwwwwwwwwwwwwwww

CLI

One provides a simple CLI for development, building, and serving your apps.

one dev

Developing an app with One is as simple as one dev.

Terminal window
one dev [options]
--clean # clear all caches before running
--host # set the hostname to bind to
--port # set the port to bind to
--debug # turns on vite debugging

The One development server serves both web and native apps on the same port at the same time, and should hot reload both at once. When you see the Server running on message with a host and port, that is the same for both native and web.

Native Development

The one dev command only starts the development server — it does not build or run the native iOS/Android shell. One ships native code inside the one package, so native development uses your own app build rather than Expo Go:

  1. Run one prebuild to generate the native Xcode/Android project
  2. Run one run:ios or one run:android to build and launch the app

See the Build or Run the Native iOS App guide for detailed instructions.

one build

Building your app for production happens through one build.

Terminal window
one build [--platform web|ios|android]

The --platform flag defaults to web. To build for iOS:

Terminal window
npx one build --platform ios

Building for web

When building One for web, the output will be a mostly static directory of HTML, CSS, and JavaScript. Internally, One runs a few different Vite production builds to output client, server, and API folders. This output is always in the dist directory.

Ensure your .env file has a ONE_SERVER_URL set to your production URL:

ONE_SERVER_URL=https://onestack.dev

We provide a production server based on Hono with one serve that handles loaders, SSR, and API routes for you. You can choose a deploy target for that server via your Vite configuration:

vite.config.ts
import { one } from 'one/vite'
export default {
plugins: [
one({
web: {
deploy: 'vercel' // defaults to 'node'
}
})
]
}

For detailed deployment instructions, see the Deployment Guide.

If you are only using SPA and SSG routes and aren’t using loaders, you can statically serve the results of dist/client using any server you’d like.

Building for native

We don’t have an end-to-end build command yet, but One is designed to be easy to integrate into existing Expo or React Native build processes.

If you’re familiar with EAS, see how to Build and Deliver Native Apps with EAS.

Or check out the iOS Native Guide for instructions on building your iOS app with Xcode.

one serve

Serve your web apps for production with one serve, after you’ve successfully run one build.

Terminal window
one serve [options]
--host # set the hostname to bind to
--port # set the port to bind to
--compress # enable gzip compression (default: true)
--loadEnv # load .env files before running
--cluster # enable cluster mode using all CPU cores
--cluster=N # enable cluster mode with N workers

One comes with a serve command that is powered by Hono. For high-traffic production deployments, use --cluster to fork multiple worker processes that share the same port. See one serve for details.

If you are only using SPA and SSG routes and aren’t using loaders, you don’t need to use one serve - you can statically serve the results of dist/client using any server you’d like.

You must run a one build before serve.

Programmatic Usage

You can also run your production server programmatically:

import { serve } from 'one/serve'
await serve()

Which takes options:

type ServeOptions = {
// you can pass in your own Hono server
app?: Hono
host?: string
port?: number
compress?: boolean
/**
* Whether to run the Vite logic to load .env files before running the server
* @default false
*/
loadEnv?: boolean
}

one patch

Manually apply package patches configured via the patches option in your Vite config. Patches are automatically applied during one dev and one build, but you can run this command to apply them manually.

Terminal window
one patch [options]
--force # re-apply all patches, even if already applied

See patches configuration for how to configure patches.

Edit this page on GitHub.