Server
nana-server runs every terminal. The desktop app and the CLI are both clients of it. That is why terminals keep running after you
quit an app, and why several apps can show the same terminal.
flowchart LR
DESKTOP["Desktop app"] <--> SERVER["nana-server"]
CLI["nana CLI"] <--> SERVER
Lifetime
- Apps and CLI commands start the server when they need it. You never need to start it yourself.
- It keeps running until you stop it, even with no app open.
- Stopping or restarting it ends every terminal. Saved screens and history are
kept. Use the status bar, Settings → Server, or
nana server stop --force. - Nana never restarts it on its own while terminals are running. After an update, the desktop app replaces this computer’s server once no terminals are running.
Sessions
- A session is one running terminal. It belongs to the project it was created
in, wherever you
cdlater. - It ends when its program exits, when someone ends it, or when the server stops. Closing the last pane that shows it ends it too.
- Quitting an app, detaching, a crash, or sleep never ends it.
- Any number of apps can show and type into a session at once. They share one size.
- Existing Terminals lists a project’s sessions that this app isn’t showing, and which app owns each one, so you can open them here too.
History
- The server saves each terminal’s screen and scrollback to disk, even when no app is watching. It is still there after the program ends or the server restarts.
- Scrollback size is a byte budget per terminal, 16 MiB by default. Older history loads as you scroll.
- Ended sessions and their saved output are removed after 7 days.
Settings
Server settings apply to everyone using that server. Change them in
Settings → Server, with nana settings set, or in server.toml:
| Setting | server.toml key |
Default |
|---|---|---|
| Default shell | default_shell |
%COMSPEC% on Windows. On a remote server, $SHELL, else /bin/zsh on macOS and /bin/sh on Linux |
| History budget per session | history_budget_bytes |
16777216 (16 MiB) |
| Shell integration | shell_integration |
true |
Shells start as login shells. Changes apply to new terminals. A new history budget applies to saved history after the server restarts.
Shell integration
Shell integration lets Nana track each terminal’s folder, jump between prompts, and select a command’s output. It loads automatically for zsh and fish, without editing your startup files.
Bash is opt-in. Add this to the file your Bash profile loads for interactive shells:
if [[ ${NANA_SHELL_INTEGRATION:-0} == 1 ]]; then
source "$NANA_SHELL_INTEGRATION_DIR/nana.bash"
fi
The Windows server supports opt-in PowerShell prompt integration. Add this to your PowerShell profile, subject to your normal script execution policy:
if ($env:NANA_SHELL_INTEGRATION -eq '1') {
. "$env:NANA_SHELL_INTEGRATION_DIR/profile.ps1"
}
It reports the current filesystem directory with OSC 7 at each prompt, including drive paths, UNC shares, spaces, and Unicode. Non-filesystem locations such as the registry do not replace the terminal’s last filesystem directory.
Every terminal gets TERM=xterm-256color, COLORTERM=truecolor,
TERM_PROGRAM=nana, NANA_SERVER_ID, and NANA_SESSION_ID.
Files
Everything lives in one profile folder.
| Platform | Stable | Beta |
|---|---|---|
| Windows | %LOCALAPPDATA%\Nana |
%LOCALAPPDATA%\Nana Beta |
| macOS (remote server) | ~/Library/Application Support/Nana |
~/Library/Application Support/Nana Beta |
| Linux (remote server) | $XDG_STATE_HOME/nana, or ~/.local/state/nana |
$XDG_STATE_HOME/nana-beta, or ~/.local/state/nana-beta |
| File | What it holds |
|---|---|
server.toml |
Server settings |
server.log |
Server log |
server.sock |
The socket apps connect to |
sessions/ |
Projects, sessions, and saved terminal output |
remote.json |
Mobile access settings and paired phones |
settings.toml, terminal.toml, themes/ |
Desktop app settings, see Settings |
Set NANA_DIR to use a different profile folder. Development builds use
Nana Dev (nana-dev on Linux), so they never touch your real data.
Uploaded attachments live in a separate temporary folder per session. Incoming
names are reduced to Windows-safe basenames, even on Unix servers; drive-relative
names and reserved device names fall back to upload. A repeated name gets a
number rather than replacing an existing upload.