Tiny self-hosted sync server for Trace settings.
It stores one plain JSON state file on disk and protects it with one shared bearer token. There are no accounts, database, encryption, pairing flow, web UI, or managed service assumptions.
GET /healthGET /v1/settingsPUT /v1/settings
GET and PUT require:
Authorization: Bearer <TRACE_SYNC_TOKEN>| Environment variable | Required | Default | Description |
|---|---|---|---|
TRACE_SYNC_TOKEN |
Yes | Shared bearer token | |
TRACE_SYNC_DATA_DIR |
No | ./data |
Directory for state.json |
TRACE_SYNC_PORT |
No | 8787 |
HTTP port |
TRACE_SYNC_MAX_BYTES |
No | 1048576 |
Max request body size |
TRACE_SYNC_TOKEN="$(openssl rand -hex 32)" go run .Upload initial settings:
curl -X PUT http://localhost:8787/v1/settings \
-H "Authorization: Bearer $TRACE_SYNC_TOKEN" \
-H "Content-Type: application/json" \
-d '{"baseVersion":0,"updatedBy":"MacBook Pro","settings":{"example":true}}'Download settings:
curl http://localhost:8787/v1/settings \
-H "Authorization: Bearer $TRACE_SYNC_TOKEN"docker build -t trace-sync-server .
mkdir -p data
docker run --rm -p 8787:8787 \
--user "$(id -u):$(id -g)" \
-v "$(pwd)/data:/data" \
-e TRACE_SYNC_TOKEN="$(openssl rand -hex 32)" \
trace-sync-serverPublished images are available from GitHub Container Registry:
mkdir -p data
docker run --rm -p 8787:8787 \
--user "$(id -u):$(id -g)" \
-v "$(pwd)/data:/data" \
-e TRACE_SYNC_TOKEN="$(openssl rand -hex 32)" \
ghcr.io/arjunkomath/trace-sync-server:latestThe E2E script builds the Docker image, runs a local container, exercises auth, empty state, upload, download, conflict handling, and verifies the mounted JSON state file was written.
./e2e.shOptional overrides:
PORT=18788 IMAGE=trace-sync-server:e2e ./e2e.shCreate the data directory before starting Compose, especially on Linux when running the container as a non-root user:
mkdir -p dataservices:
trace-sync:
image: ghcr.io/arjunkomath/trace-sync-server:latest
user: "1000:1000"
ports:
- "8787:8787"
volumes:
- ./data:/data
environment:
TRACE_SYNC_TOKEN: "change-this-to-a-long-random-token"
TRACE_SYNC_DATA_DIR: "/data"The server keeps a monotonically increasing version number.
Clients upload with the version they last saw:
{
"baseVersion": 7,
"updatedBy": "MacBook Pro",
"settings": {}
}If the server is still on version 7, the upload becomes version 8.
If another client already wrote version 8, the server returns 409 Conflict:
{
"error": "conflict",
"currentVersion": 8
}Trace should then ask the user to download remote settings, overwrite remote settings, or cancel.
This server stores Trace settings as plaintext JSON on disk. Keep the server private, use a strong token, and put it behind HTTPS when exposing it over a network.