Run it with Docker
The repository’s docker-compose.yaml is a production-like stack: memento from the image
ghcr.io/digital-cube/jsmemento, PostgreSQL 18 and Redis 7, with health checks and named
volumes. The server applies its migrations when it starts, and the CLI is inside the image.
This is the PostgreSQL stack; without Docker or a database service,
run it on a SQLite file instead.
-
Get the compose file, with the rest of the repository:
Terminal window git clone https://github.com/digital-cube/jsmemento.git && cd jsmemento -
Give it a database password and the image to run.
MEMENTO_IMAGEdefaults to thelatesttag, the newest release; pin a release as here, or takemain, the image of the newest commit:Terminal window # .env next to docker-compose.yaml: a database password, and the release to run# (:latest is the newest release, :main the newest commit)cat > .env <<'ENV'POSTGRES_PASSWORD=change-meMEMENTO_IMAGE=ghcr.io/digital-cube/jsmemento:1.1.0ENV -
Start memento. Compose starts PostgreSQL and Redis first, because memento waits for their health checks;
--waitreturns when all three are healthy. Then ask the server how it is:Terminal window # memento with PostgreSQL 18 and Redis 7; --wait returns once their health checks passdocker compose -f docker-compose.yaml up -d --wait mementocurl localhost:3000/memento/api/healthWhat it prints Container jsmemento-redis-1 HealthyContainer jsmemento-postgres-1 HealthyContainer jsmemento-memento-1 Healthy{"ok":true,"data":{"status":"ok"}}The file has more services:
service, the self-service site (accounts, keys, usage), and behind thedemoprofile a CPU monitor and a ticket desk simulator. Namingmementostarts only what the API needs. -
Create a tenant, and an API key of it. A key belongs to one tenant: everything it pushes or reads is that tenant’s.
readlets it list, query and stream;writelets it push.Terminal window # a tenant, and an API key of it with both scopes: the mk_… secret is printed this oncedocker compose -f docker-compose.yaml exec memento memento create-tenant acme --name "Acme Inc"docker compose -f docker-compose.yaml exec memento \memento create-key --tenant acme --scopes read,write --name backendWhat it prints created tenant acme (Acme Inc) id=40c1b5bc-0c20-40e2-b00a-b88dc9e3b4e5created key "backend" for acme [read,write]prefix: 27lho6hxkey: mk_27lho6hx_…Store it now: it cannot be shown again.Only a hash of the key is stored. Copy the
mk_…line now; a lost key is revoked (memento revoke-key <prefix>) and replaced, never shown again. -
Push the first event, and read the history of
user/42back, rendered in Serbian:Terminal window export MEMENTO_API_KEY=mk_… # what create-key printedcurl -X POST localhost:3000/memento/events -H "Authorization: Bearer $MEMENTO_API_KEY" \-H 'content-type: application/json' \-d '{"event_type":"USER_LOGIN","instance_type":"user","instance_id":42,"actor_id":"igor"}'curl "localhost:3000/memento/entities/user/42/events?locale=sr" \-H "Authorization: Bearer $MEMENTO_API_KEY"What it prints {"ok":true,"data":{"id":"ee41fd55-c7f5-4dfa-991e-b486e6591a4d","occurred_at":"2026-11-02T00:27:43.402Z","received_at":"2026-11-02T00:27:43.430Z","event_type":"USER_LOGIN","instance_type":"user","instance_id":"42","actor_id":"igor","payload":{},"rendered":"User igor logged in.","rendered_locale":"en","archived_at":null}}{"ok":true,"data":[{"id":"ee41fd55-c7f5-4dfa-991e-b486e6591a4d","occurred_at":"2026-11-02T00:27:43.402Z","received_at":"2026-11-02T00:27:43.430Z","event_type":"USER_LOGIN","instance_type":"user","instance_id":"42","actor_id":"igor","payload":{},"rendered":"Korisnik igor se prijavio.","rendered_locale":"sr","archived_at":null}],"meta":{"limit":50,"count":1,"next_cursor":null}}memento renders
renderedfrom theUSER_LOGINtemplate of the asked locale, per request; the event itself is stored once and never changes. -
Open
http://localhost:3000/: the image serves the examples site there, same origin as the API. It asks for a key: paste the one from step 4 under Settings, or give the server a read-only demo key and it connects by itself (DEMO_API_KEY, see docs/DEPLOYMENT.md). To give its pages something to show, turn on thedemoprofile: the CPU monitor and the simulator push into a tenantdemowith a write key of it. -
When you are done:
Terminal window docker compose -f docker-compose.yaml down # stop; the data stays in named volumesdocker compose -f docker-compose.yaml down -v # stop and delete the data too
Ports and the rest of the configuration
Section titled “Ports and the rest of the configuration”Every variable can go into .env. The host ports: MEMENTO_PORT (3000), SERVICE_PORT
(8201), POSTGRES_PORT (5432) and REDIS_PORT (6379); PostgreSQL and Redis are published on
127.0.0.1 only. A second stack next to the first needs its own ports and its own
COMPOSE_PROJECT_NAME: the file names its project jsmemento, and two stacks with one name
are one stack. The whole list, the image’s tags, the service site, retention, backups and a
reverse proxy in front of it:
docs/DEPLOYMENT.md.
- Push from your own code: the client programs work against this server
with
MEMENTO_URL=http://localhost:3000/memento. - Run memento inside your application instead: Embedded in Node.
- The image on one SQLite file, with a volume and no
postgresorredisservice: the SQLite guide.
v1.1.0released built 663143e