TinyStore

Command line / serve

serve

tinystore serve shares a store with programs on this machine and, with --listen, on others. It is the same program an SDK starts as a sidecar or a private child; only its listeners differ. It runs until Ctrl+C or tinystore stop.

sh
tinystore serve ./data
tinystore serve ./data --listen tls://0.0.0.0:7443 --tls-cert cert.pem --tls-key key.pem --tokens tokens.txt
tinystore stop ./data

Local

Without flags, programs on this machine find the server through <dir>/server/SERVE: a Unix socket, or a named pipe on Windows, and a proof that the file system lets only the directory's owner read. No token is needed: their permission is the file system's.

FlagDoes
--stdioone client on stdin and stdout, for a program that starts the server itself
--idle <span>stop once no client has been connected this long; never by default

An SDK's sidecar is serve with --idle 30s, and its private child is serve --stdio.

Remote

sh
tinystore token new admin >> tokens.txt
tinystore token new data >> tokens.txt
tinystore token new read >> tokens.txt
tinystore serve ./data --listen tls://0.0.0.0:7443 --tls-cert cert.pem --tls-key key.pem --tokens tokens.txt
FlagDoes
--listen tls://<host>:<port>serve other machines over TLS
--tls-cert <pem>the certificate chain it answers with
--tls-key <pem>its private key
--tokens <file>who may connect: a token a line

token new prints a capability and a random token:

read fx-o4leY8IHwDw-A-Yr-QwtChi8vDIoF94CANd9XSlk
CapabilityMay
adminanything, backups included
dataread and write the store
readonly reads: SQL on a reader, no migrations, no publishes

--listen tls:// refuses to start without a certificate, a key and a tokens file. --listen tcp:// sends tokens in the clear, for a private network its operator trusts. The same server still serves this machine's programs through its local socket.

The store

FlagDoes
--memory <size>what the engines may hold at once, 512MiB; 1 GiB with --listen
--durability full|oshow far a commit goes before it returns
--keep-free <size>the disk the store keeps free; 1 GiB by default
--encryption-key-file <file>the store's key, kept apart from its data
--self-metricsmeasure the store into its own metrics
--no-system-metricswith --self-metrics, leave out the machine

Output

On a terminal the server prints a banner and a line per event; anywhere else, in a container or a pipe, each line is a JSON object on stderr, ready for a log collector.

FlagDoes
--log-file <file>JSON lines to a file as well
--quietthe banner, warnings and errors only

In a container

sh
docker run -v /srv/chat:/data -p 7443:7443 ghcr.io/tinyshed/tinystore:0.1.0 \
  serve /data --listen tls://0.0.0.0:7443 --tls-cert /data/cert.pem --tls-key /data/key.pem --tokens /data/tokens.txt

Nodes

--node-listen, --from and --node-config make the store a node that copies files from another or serves its own to others. See Nodes.

Stop

sh
tinystore stop ./data

The clients are told to leave and the streams running finish, then the store closes. With no server it says so and exits 1.

See also

Edit this page on GitHub Updated 19 October 2026

esc
↑↓ navigate ↵ open ⇥ filter 0 results