Environment variables
The local API and the bundled launcher read a handful of environment variables. Most users will never need to set any of these; they're here for the cases when you do.
HOST
Default: 127.0.0.1
The address the API binds to. The default is 127.0.0.1, which means the API is only reachable from the same machine. Setting this to 0.0.0.0 would expose it to your network; don't do that unless you understand the implications (no authentication, no isolation, every request from a network client can read every collection and send any request).
The default and the lookup live in apps/api/src/config/config.ts (loadConfig()), which reads from process.env and re-exports the ENV constants so the rest of the code uses one source of truth.
PORT
Default: 8000
The port the API listens on. If 8000 is already in use, set this to something else, and update the web app's proxy or use the API URL directly. The web app's Vite dev server is configured to forward /api/* to 127.0.0.1:8000; if you change the port, the dev proxy has to be updated in apps/web/vite.config.ts.
SQLITE_PATH
Default: <REWIND_DATA_DIR>/rewind.sqlite
The location of the SQLite database file. Absolute paths are used as-is. Relative paths resolve from the process working directory. Setting this to a relative path like ./data/rewind.sqlite is convenient when you want the database to live in the project (e.g. for development), but the relative-to-cwd semantics can surprise you when starting the server from a different directory.
The path is resolved by resolveDatabasePath() in apps/api/src/runtime-paths.ts and consumed by createDatabaseClient() in apps/api/src/db/client.ts.
For most cases, prefer REWIND_DATA_DIR to relocate the whole data tree, and leave SQLITE_PATH alone.
REWIND_DATA_DIR
Default: the platform's application-data directory (see Data and storage)
The base directory for everything Rewind writes: the database, attachments, response bodies, logs, and backups. Absolute paths are used as-is. Relative paths resolve from the process working directory.
Resolution lives in resolveDataDirectory() in apps/api/src/runtime-paths.ts. The platform defaults are:
- macOS —
~/Library/Application Support/Rewind - Windows —
%LOCALAPPDATA%\Rewind - Linux / other —
$XDG_DATA_HOME/rewind(defaulting to~/.local/share/rewind)
This is the right knob to set when:
- You want a per-project workspace (e.g. one workspace per repo).
- You want the data on a separate volume.
- You want to test a clean workspace by pointing at a temp directory.
WEB_BUILD_PATH
Default: <API_ROOT>/web (compiled) or <API_ROOT>/../web/build (dev)
The path the API looks at to serve the bundled web app. The compiled launcher uses <API_ROOT>/web, where <API_ROOT> is the directory of the compiled rewind executable. The dev workflow uses the Vite dev server, so this is not relevant during development.
The default and the compiled-vs-dev selection live in apps/api/src/runtime-paths.ts (DEFAULT_WEB_BUILD_PATH); loadConfig() then applies any WEB_BUILD_PATH override.
You would only set this if you are building a custom launcher that puts the web bundle somewhere non-standard.
REWIND_OPEN_BROWSER
Default: 1 (the compiled launcher opens the default browser to the local URL after a short delay)
Set to 0 to skip the auto-open. This is for headless and CI environments where opening a browser is unwanted. The dev server does not auto-open a browser; this variable only affects the compiled launcher.
The check is in loadConfig(): openBrowserOnStart is true only when the binary is the compiled launcher (isCompiled is set when import.meta.dir.startsWith("/$bunfs/")) and REWIND_OPEN_BROWSER !== "0".
LOCALAPPDATA (Windows only)
Used to resolve the default data directory. If you want to put the workspace somewhere other than the default %LOCALAPPDATA%\Rewind, set REWIND_DATA_DIR instead.
XDG_DATA_HOME (Linux only)
Used to resolve the default data directory per the XDG Base Directory Specification. Defaults to ~/.local/share. The full default data directory is $XDG_DATA_HOME/rewind. Override with REWIND_DATA_DIR to change this.
BUN_* (any)
The bundled launcher uses process.platform, process.arch, and Bun.version to populate the diagnostic archive. You can leave them alone.
Precedence
When multiple variables are set:
REWIND_DATA_DIRandSQLITE_PATHare independent. Setting both works: the data directory holds everything except the database, which lives atSQLITE_PATH(interpreted as an absolute path if you give one).HOSTandPORTare independent of the data directory.WEB_BUILD_PATHonly affects the compiled launcher.- All five names are defined in the
ENVmap exported fromapps/api/src/config/config.ts; if you add a new variable, add it there too.
Examples
Use a workspace inside the project
REWIND_DATA_DIR=./.rewind bun run devUse a custom port
PORT=9000 bun run devRun a headless launcher without opening a browser
REWIND_OPEN_BROWSER=0 ./apps/api/dist/rewindOverride just the database
SQLITE_PATH=/tmp/rewind.sqlite bun run devWhat's next?
- Data and storage — what ends up in
REWIND_DATA_DIR - API surface — the routes the server exposes
- Release build — the bundled launcher