The spacetimedb directory structure, represented as a type hierarchy.
Directory Structure of the Database.
[SpacetimePaths] holds the paths to the various directories used by the CLI & database.
-
cli-bin-dir: a directory under which all versions of all SpacetimeDB binaries is be stored. Each binary is stored in a directory named with version number of the binary in this directory. If a binary has any related files required by that binary which are specific to that version, for example, template configuration files, these files will be installed in this folder as well.
-
cli-config-dir: a directory where configuration and state for the CLI, as well as the keyfiles used by the server, are stored.
-
cli-bin-file: the location of the default spacetime CLI executable, which is a symlink to the actual
spacetimebinary in the cli-bin-dir. -
data-dir: the directory where all persistent server & database files are stored.
Unix Directory Structure
On Unix-like platforms, such as Linux and macOS, the installation paths follow the XDG conventions by default:
cli-config-dir:$XDG_CONFIG_HOME/spacetime/cli-bin-dir:$XDG_DATA_HOME/spacetime/bin/cli-bin-file:$XDG_BIN_HOME/spacetimedata-dir:$XDG_DATA_HOME/spacetime/data
As per the XDG base directory specification, those base directories fall back to to the following defaults if the corresponding environment variable is not set:
$XDG_CONFIG_HOME:$HOME/.config$XDG_DATA_HOME:$HOME/.local/share$XDG_BIN_HOME:$HOME/.local/bin
For reference, the below is an example installation using the default paths:
|
| | | | | | |
|
Windows Directory Structure
On Windows the installation paths follow Windows conventions, and is equivalent
to a Root Directory (as defined below) at %LocalAppData%\SpacetimeDB\.
Note: the
SpacetimeDBdirectory is in%LocalAppData%and not%AppData%. This is intentional so that different users on Windows can have different configuration and binaries. This also allows you to install SpacetimeDB on Windows even if you are not a privileged user.
Custom Root Directory
Users on all platforms must be allowed to override the default installation
paths entirely with a single --root-dir argument passed to the initial
installation commands.
If users specify a --root-dir flag, then the installation paths should be
defined relative to the root-dir as follows:
cli-config-dir:{root-dir}/config/cli-bin-dir:{root-dir}/bin/cli-bin-file:{root-dir}/spacetime[.exe]data-dir:{root-dir}/data/
For reference, the below is an example installation using the --root-dir argument:
}
|
| | | | | |
Data directory structure
The following is an example of the internal structure of data-dir. Note that this is not a stable hierarchy, and users should not rely on it being stable from version to version.
} # {Data}: CLI (--data-dir)