Repository navigation
SQLite as a database option, and everything built since the untagged 1.0.0 baseline:
self-service accounts and API keys with daily limits, the service site, client programs in
eight languages, the website, UDC collections on @jsudc/* 0.3. A small installation on one
host runs memento on a single SQLite file (DATABASE_URL=file:<path>), with no database
service and no Redis; PostgreSQL stays the default.
The first tagged release, and the first under the npm scope @jsmemento/*: the tag
v1.1.0 publishes the image ghcr.io/digital-cube/jsmemento as :1.1.0, :1.1, :1 and
:latest, and @jsmemento/core, server, cli, react and lookups 1.1.0 on npm.
[1.0.0] below is the baseline of 2026-10-31, which was never tagged or published.
Code that embeds @jsmemento/server, probes the health check or reads the error codes has to
change, as Breaking for code that embeds the server lists. The version is still minor
because no package was ever published under @memento/* or @jsmemento/* and no release was
ever tagged, so nobody can depend on the old names or the old behaviour.
Breaking for code that embeds the server
Against 1.0.0, the untagged baseline:
- The package names. The npm packages are
@jsmemento/core,server,cli,reactand
lookups, no longer in the@mementoscope, which on npm belongs to someone else: change
the dependency names and imports. Themementocommand, the image, theMEMENTO_*
variables and the/mementoprefix stay as they are. DatabaseHandlecarriesdialect(the newDialecttype) instead ofpool
(node-postgres'pg.Pool).Databaseis drizzle's query builder without a driver in its type,
PgDatabase<PgQueryResultHKT, typeof schema>instead ofNodePgDatabase<typeof schema>, so
it has no$client. Code that reached forhandle.poolordb.$clientuseshandle.db
for queries andhandle.close()on shutdown.connect(url)picks the database from the URL's scheme:postgres:///
postgresql://, or SQLite forfile:<path>,file:///abs/pathand:memory:. Any other
URL throws an error naming only the scheme (before, every URL went to node-postgres). One
process speaks one dialect: aconnectto the other database while a handle is open throws.schemais the tables of the connected database (PostgreSQL untilconnectopens a
SQLite file, which swaps in twins with the same row types). Read a table when a query is
built, not into a module-level constant. The PostgreSQL tables live in
db/schema-postgres.ts.runMigrations(db)applies the migration set of the process's database:
MIGRATIONS_FOLDER(drizzle/) for PostgreSQL, the newSQLITE_MIGRATIONS_FOLDER
(drizzle-sqlite/) for SQLite. On PostgreSQL it runs under an advisory lock.- Ids of new rows are generated by the application as UUID v7 (
uuidv7()), no longer by
the database'sgen_random_uuid(), which stays the column default (no migration). - The health check moved from
GET <prefix>/healthtoGET <prefix>/api/health
(default/memento/api/health). The image'smemento-healthcheckfollows it; external
monitors and load-balancer probes have to be pointed at the new path. - Error codes: a framework
415(unsupported content type) answers with the code
unsupported_media_typeinstead ofbad_request, and a429withrate_limited. - Text sorts (
listTemplates,listTenants, the retention sweep, every UDC sort on a text
field) are in Unicode code-point order on every database:USER_LOGINbefore_generic,
upper case before lower case (see Fixed).
Against the image of main between 1.0.0 and this release (:main, :edge), for code that
used what was added there:
- A boolean UDC field (
is_admin,verified,disabled, …) filters ontrue/false
(a JSON boolean or the string) and refuses anything else withvalidation_error. Before,
the value went to PostgreSQL as a string and its cast decided (t,1andyespassed).
The rows answer a JSON boolean on both databases. - The UDC field maps
EVENTS_FIELDS,CPU_LOAD_FIELDSandAPI_KEY_EVENT_FIELDread
their columns when a query is built (the tables of the connected database), and
FieldKindgains"bool".isoOftakes epoch milliseconds too. @jsudc/*0.3: an application that builds or extends the UDC registry itself (theudc
option,MementoRegistry,eventCollections,EventCollectionSource) with its own
@jsudc/core/@jsudc/serverhas to be on 0.3 too. The registry, its sources and their
schemas are@jsudc0.3 types, and 0.3 stops the start when alookupfield orrow_link
names a collection nobody serves.@jsmemento/reactdoes not depend on@jsudc/*, and no
@jsmemento/*package has@jsudc/*as a peer dependency.- Metering: a key of a tenant with an account member is metered and held to its daily
limit on every server process, not only on one withMEMENTO_ACCOUNTS(see Fixed). An
embedding application without accounts now answers429 quota_exceededfor such a key past
its limit.
Added
-
memento --version(also-V,@jsmemento/cli) prints the package's version, read from
itspackage.json; in the image,docker run --rm ghcr.io/digital-cube/jsmemento:1.1.0 memento --versionprints1.1.0. -
The website says how fresh it is. The footer of every page (the home page beside
"MIT licence.", the docs under Starlight's footer) shows the version, the date of its release
tag (theCHANGELOG.mdheading while there is no tag), when the site was built (UTC) and the
commit; the Packages list and table show when each package's newest version went to npm, and
that version when it is not the repository's (not on npm yet while a package has never been
published); beside the image, the release tag's date. Read once per build
(apps/website/src/build-info.mjs); the registry never fails the build, andSITE_NPM=off
builds without asking it (apps/website/README.md).
deploy/website/stage.shfetches the tags and rebuilds when a release tag lands on a built
commit. -
SQLite as a database option for installations that must not depend on a database
service (the first user: a customer's local machine with neither PostgreSQL nor Redis):
DATABASE_URL=file:<path>(orfile:///abs/path,:memory:for tests) instead of
postgresql://…. PostgreSQL stays the default. On SQLite everything works — events,
queries, rendering, chats, UDC collections with the same answers, the/wsstream, accounts,
quotas, usage, retention, the CLI — with one limit: one server process on one host per
file, so that process serves either the examples site or the service site, not both. Redis
is optional there as on PostgreSQL and not needed at all: without it the stream runs on the
in-process bus, the quota counter reads the usage table and the rate limits live in memory;
with it, still one server process. The guide, from an empty directory to a running server
(which database fits, the quick start, the image and a Compose file withoutpostgresand
redis, embedding, accounts, the CLI next to the server, backups and the limits), is
docs/SQLITE.md; the README anddocs/DEPLOYMENT.mdlink to it.- The driver is Node's built-in
node:sqliteunder drizzle'ssqlite-proxy, no native
dependency. One writer connection behind an in-process FIFO gate (every transaction
BEGIN IMMEDIATE, a nested one a savepoint), a read-only second connection for reads, WAL,
foreign_keys = ON; another process holding the write lock (amementoCLI command next to
the server) is waited for on a timer, up to 10 s, without stopping the server. - Its own migration set,
packages/server/drizzle-sqlite/(with the event immutability
triggers), shipped in the package next todrizzle/;pnpm db:generatewrites both, the
server at start andmemento migrateapply the set of the URL's database. DATABASE_URL/TEST_DATABASE_URLacceptfile:<path>,file:///abs/pathand
:memory:. The tables ofdb/schema.tsare those of the connected database
(db/schema-postgres.tsordb/schema-sqlite.ts, the same row types, checked at compile
time); a process speaks one dialect. New exports:dialectOf,describeDatabase,
SQLITE_MIGRATIONS_FOLDER.- The server and CLI suites run on both databases (vitest projects,
MEMENTO_TEST_DIALECT,
test:pg/test:sqlite);test/parity.test.tspins what both must answer alike.
- The driver is Node's built-in
-
The website (
apps/website,@jsmemento/website, docs/DEPLOYMENT.md):
Astro + Starlight with memento's own identity (ink and bone, the red thread, Bodoni Moda),
dark and light, Pagefind search, a home hero (oneUSER_LOGINand its EN / SR sentence),
the sidebar Get started / Concepts / Reference / Examples / Clients / Packages (an index each
for now) and its own 404.SITE_URL,EXAMPLE_URL,SERVICE_URLat build time;
starlight-links-validatorfails the build on a broken internal link (CI job Website
build). Served atstage.memento-service.orgbydeploy/website/stage.sh
(build-and-swap, nginx vhost indeploy/website/nginx/). Not part of the image.
The home page below the hero: one event read back every way (entity history, en / sr,
Filter DSL, a/wsframe), the eight examples as real screenshots, the API, four quick
starts and the packages; Get started with Docker, a client and embedded in Node. Its code
is repository files imported raw (apps/website/snippets/,clients/): requests and answers
recorded bynpm run capture, screenshots bynpm run shots, the snippets compiled by
check:snippetsintypecheck.
The rest of the sidebar: Concepts (events and instances, tenants and keys, rendering,
streaming, chats, UDC collections, accounts and retention, deployment modes), Reference
generated fromdocs/bynpm run gen(the HTTP API, the Filter DSL, streaming, chats, the
CLI, the environment variables; not in git, each page naming its file and commit),
Examples (the examples site, one page per example with its screenshot, the service site),
Clients (clients/rendered at build time: the READMEs and the programs' sources, a page
per language) and Packages (versions from the workspace, the image tags, which ones you
install, the changelog generated from this file). -
The
/clientspage of the service site (apps/service, docs/CLIENTS.md):
public, a tab per language at/clients/<lang>(remembered in localStorage), the two
environment lines with this origin and amk_…placeholder (Copy; the hint links to/keys),
the README's install / variables / run, the source with line numbers, Copy and the manifest as
a second tab, and Download<lang>.zip. Built byvite-plugin-clients.tsfrom
clients/at build time:virtual:clients(shiki-highlighted HTML, no grammars in the
browser) anddist/clients/<lang>.zip(fflate; withoutnode_modules,target,build).
Logged out, the header links to it. No key is ever embedded. -
Client programs (
clients/<lang>, docs/CLIENTS.md): one complete
program each in JavaScript, TypeScript, Python, PHP, Java, Rust, Go and C++ — push a
USER_LOGINevent, query the last ten ofuser/<you>, tail the stream for 10 s (not in PHP
and C++) — withMEMENTO_API_KEY/MEMENTO_URLfrom the environment, exit 2 without a key
and 1 on an HTTP error, and a README each; the service site serves them for download.
clients/check.shruns one against a local server, and theClient programsworkflow
(.github/workflows/clients.yml) runs all eight on every change. -
API keys users manage (
@jsmemento/server,MEMENTO_ACCOUNTS): session routes
POST /keys({name, scopes: read|write, expires_at?, daily_limit?}→ the plaintext once;
409 limit_reachedpastmax_keys),PATCH /keys/:id(name,daily_limit),
POST /keys/:id/disable|enable(pause / resume),DELETE /keys/:id(soft delete). Disabled
and deleted keys fail auth like revoked ones;revoke-key(CLI) unchanged. Admin routes
POST /admin/users/:id/disable|enable(disabling deletes the user's sessions) and
POST /admin/keys/:id/disable|enable. -
Lifecycle events:
APIKEY_CREATED,APIKEY_DISABLED,APIKEY_ENABLED,
APIKEY_DELETED,APIKEY_LIMIT_CHANGED(instance typeapi_key, instance id the prefix,
actor the user's email) inlookups.yaml,translations.csvand EN + SR templates. -
api_key_idon events: every event stored with a key records it (EventSchemagains an
optionalapi_key_id); theeventsUDC collection gainsapi_key(the prefix, filterable). -
Daily limits per key (
daily_limit ?? MEMENTO_DEFAULT_DAILY_LIMITevents per UTC day):
429 quota_exceededwith{limit, used, resets_at},quota_warning(80 %) and
quota_exceededmails once a day each (EN + SR, via the mailer); counters in Redis
(memento:quota:<key>:<day>) or summed from the usage table. -
Usage meter (
UsageMeter): requests, bytes in, events written, rows read and stream
seconds per key and hour, flushed tomemento_apikey_usageevery 5 s and on close. -
Self-service UDC collections:
api_keys,api_key_events,api_key_activity,
api_key_usage(session) andadmin_users,admin_api_keys(admin), on the new
TableCollectionSource(a read-only UDC source over any SQL query). -
Retention:
memento retention [--tenant slug] [--dry-run]archives events older than a
tenant'sretention_daysin batches of 10 000; aretentionservice (profiledemo) in
docker-compose.yamlruns it daily. -
Migration
0005_apikey_lifecycle; error codesquota_exceeded(429),limit_reached(409);
ApiKeygainsstatus,daily_limit,used_today,created_by; compose passes
DEFAULT_MAX_KEYS,DEFAULT_DAILY_LIMIT,MAX_DAILY_LIMIT. -
Self-service accounts, server side (
@jsmemento/server, behindMEMENTO_ACCOUNTS, off by
default):POST /auth/register(a user, a tenant of their ownt-xxxxxxxx, theowner
membership, a verify mail, a session),/auth/verify,/auth/resend,/auth/login,
/auth/logout,/auth/forgot,/auth/reset,GET/PATCH /auth/me. Passwords argon2id
(@node-rs/argon2); single-use mail tokens stored as SHA-256 (verify 24 h, reset 1 h);
rate limits (@fastify/rate-limit, Redis store withREDIS_URL) 10 per IP per 15 min,
login also per email. Migration0004_accounts:memento_user,memento_tenant_user,
memento_session,memento_user_token, andplan/max_keys/retention_dayson
memento_tenant. -
The session credential: cookie
memento_session(HttpOnly, SameSite=Lax, Secure over
https, slidingMEMENTO_SESSION_DAYS),config.auth: "session" | "admin"on routes next
toconfig.scope— the two never accept each other's credential; cookie writes need
Content-Type: application/json(415 otherwise).TenantContextgainsuserId,
userEmail,isAdmin;apiKeyIdisnullfor a session. UDC collections registered in
the newMementoRegistrywithauth: "session" | "admin"are read with the cookie. -
Mail (
@jsmemento/server):Mailer,BrevoMailer(Brevo transactional API; a refusal is
logged, never fails the request),LogMailer,MemoryMailer; templates
packages/server/mail/{verify,reset}.{en,sr}.hbs(first line the subject) rendered with the
event templates' Handlebars sandbox. -
Config:
MEMENTO_ACCOUNTS,MEMENTO_SERVICE_URL,MEMENTO_BREVO_API_KEY,
MEMENTO_MAIL_FROM,MEMENTO_TRUST_PROXY,MEMENTO_SESSION_DAYS,
MEMENTO_DEFAULT_MAX_KEYS,MEMENTO_DEFAULT_DAILY_LIMIT,MEMENTO_MAX_DAILY_LIMIT;
docker-compose.yamlpassesACCOUNTS,SERVICE_URL,BREVO_API_KEY,MAIL_FROM,
TRUST_PROXY.buildApp({ trustProxy, accounts }). -
CLI (
@jsmemento/cli):list-users,make-admin/revoke-admin,disable-user/
enable-user,verify-user. -
Error codes (
@jsmemento/core):unsupported_media_type(415),rate_limited(429). -
activityUDC collection (@jsmemento/server): the tenant's events counted per minute and
perevent_type, computed per request with aGROUP BYovermemento_event(no migration,
no new index: the inner query is bounded onoccurred_atand reads the tenant/time index).
Fieldsminute,event_type,count, plus one integer column per event type of
lookups.yamlandother(the chart's series). Last 60 minutes unless the filter names
minute; Filter DSL, sort, offset paging,total= buckets. Chart (default) + table.
EventCollectionSource's filter compiler is nowSqlFilterCompiler, shared by both. -
Examples site: the Activity chart (
/examples/chart, replaces its planned page — the
last one):UdcDataViewonactivity, chart tab first, a window selector (15 min / 1 h /
6 h / 24 h) that writes theminuterange into?f=and slides with the clock, refreshed
by the stream at most once per 5 s. -
Examples site: the Chat page (
/examples/chat, replaces its planned page): the
simulator's demo room inMementoChat, read as one participant picked in a selector
(?as=), with seen markers, "X was added" lines in the header's language, a disabled
composer ("read-only demo key"), live over the WebSocket; an empty state with the compose
command while the room does not exist. -
memento simulatechat scene (@jsmemento/cli): makes surechat-demo-roomexists
(created with four of the cast, an existing one reused) and plays messages about the
desk's tickets in English and Serbian, read markers and the odd new member;--no-chat
turns it off.TicketDesk.nextStep()returns events and chat calls;next()stays the
event-only story. -
MementoChatreadOnly,seenMarkers,systemEvents(@jsmemento/react), with
useMementoChat(…, { seen, system })returningparticipantsandnotices, and the
helpersseenMarkers()/applyChatEvent(). -
MementoClient.createChat(),.listChats(),.markSeen(),.addParticipant()and
chatMessages({ event_type })(@jsmemento/core). -
UDC collections (
@jsmemento/server):POST <prefix>/udc/<action>serves the tenant's
events through@jsudc/server0.2.1 —events(every event) andcpu_load(CPU_LOAD
events with the load averages as columns, table + chart). Filter DSL, sort, offset paging
and exact totals over SQL, tenant-scoped by the API key (read; refused in-protocol with
forbidden).mementoPlugin({ udc })takes anotherCollectionRegistry, orfalse. -
memento cpu-monitor(@jsmemento/cli): pushesos.loadavg()asCPU_LOADevents every
--intervalseconds; logs and retries network/server failures, stops on a refused key. -
cpu-monitorservice indocker-compose.yaml(compose profiledemo, off by
default): runsmemento cpu-monitorfrom the same image againstmemento:3000, with
restart: unless-stopped, so the CPU monitor demo stays live across server and host
restarts. Configured byCPU_MONITOR_API_KEY(write scope),CPU_MONITOR_TENANT,
CPU_MONITOR_INTERVALandCPU_MONITOR_INSTANCE_ID; see docs/DEPLOYMENT.md "Demo pusher". -
memento simulate(@jsmemento/cli): plays a ticket desk — a cast of six users and a
desk-botlogging in and out, creating, modifying, noting and closing tickets
(ticket/T-<n>), newcomers (USER_CREATED) now and then — one event every--interval
seconds (default 3), deterministic from--seed,--oncefor one scene. Payloads carry the
fields the bundled templates read, so every event renders as a sentence. Flags and env like
cpu-monitor. -
simulatorservice indocker-compose.yaml(profiledemo):memento simulatefrom the
same image, keySIMULATOR_API_KEY(write; may be the CPU monitor's),SIMULATOR_TENANT,
SIMULATOR_INTERVAL; see docs/DEPLOYMENT.md "Demo pusher". -
X-Memento-LocaleonPOST /udc/*(@jsmemento/server): theeventsandcpu_load
rows'renderedtext in that locale, like?locale=ofGET /events; a malformed value is
refused in-protocol withvalidation_error. -
Examples site: the Activity feed (
/examples/activity): the tenant's events except
CPU_LOADas rendered sentences, newest first, infinite paging over theeventsUDC
collection, refreshed by the stream, in the header's language (EN / SR). Every example of the
series is inmenu.yaml; the ones not built yet open a "planned" page. -
MementoClient.pushEvent()and.describe()(@jsmemento/core). -
apps/examples(@jsmemento/examples, replacesapps/cpu-monitor): the examples site,
served by the server at/and/en/. A sidebar drawn from themenuUDC collection
(ported from the jsudc example's shell: tree, expand state, en/sr labels), react-router routes
(/examples/cpu-monitor,/udc/:collection), and the CPU monitor as its first example —
UdcDataViewovercpu_load, refreshed by the WebSocket stream, with a live/offline health
indicator. Connects by itself with the server's demo key; settings (base URL, own key) in the
header. -
menuUDC collection (@jsmemento/server):menu.yamlat the repository root
(MEMENTO_MENU_PATH; image/app/config/menu.yaml) served by@jsudc/server'syaml_menu
source,udc:collectionsresolved against the live registry.mementoPlugin({ menu }). -
GET <prefix>/api/demo(@jsmemento/server, no auth): the read-only demo key of
MEMENTO_DEMO_API_KEY(compose:DEMO_API_KEY) for the examples site; 404 without one. The
server refuses to start when that key is unknown, revoked or not exactlyread. -
Vocabulary: event type
CPU_LOAD, instance typeSERVER, and theCPU_LOADtemplates
(Server {{instance_id}} — CPU: …).
Changed
-
@jsmemento/server: the database layer goes through one dialect seam (what breaks for
embedding code is listed above). Everything PostgreSQL-only sits behinddb/dialect.ts(the
Dialectinterface) anddb/postgres.ts: SQLSTATE 23505, the::casts,jsonb_typeof/
->>,ILIKE,date_trunc,to_char,greatest,array_to_string,is distinct from,
nulls last,now() - interval, withdb/sqlite.tsas the second implementation. The SQL
each PostgreSQL helper renders is the SQL the services ran before (test/dialect.test.ts).
db/client.tsis nowdb/index.ts. -
The CLI's
send-messagewrites withapiKeyId: null(was the placeholder"cli"): events
now referencememento_apikey, and the CLI uses no key. -
Docs read as the website's Reference pages: the "(Phase N)" suffixes are gone from the titles,
docs/CLI.mdlistssimulate(with its own section) andretention,docs/TEMPLATES.mdthe
CPU_LOADandAPIKEY_*templates, anddocs/ARCHITECTURE.mdthe standalone entry
dist/server.jsand the UDC collections and accounts as implemented. -
@jsudc/*0.3 (@jsudc/core0.3.0,@jsudc/server0.3.0,@jsudc/react0.3.1, the
lookups androw_linkrelease) in@jsmemento/server,@jsmemento/ui-shell, the examples site
and the service site. Nothing changes on the wire: the rows, filters, sorts and paging of
events,cpu_load,activity,menuand the self-service collections are as before.
@jsudc/server0.3 checks at startup that everylookupfield androw_linkof the
registry names a served collection with the named fields; memento has neither (its
lookups.yamlvalues — event, instance and actor types — are plainstringfields), so the
check stays on and passes (test/udc.test.ts), and a collection an embedder registers with
a lookup into a collection nobody serves now stops the start. 0.3 still ships no transport
forcapabilities.subscribe(memento's sources answersubscribe: false); the live updates
keep riding memento's own/wsstream (docs/STREAMING.md).
Fixed
- Text sorts no longer depend on the database's collation.
listTemplates(by event type
then locale),listTenantsand the retention sweep (by slug) and every UDC sort on a text
field (event_type,source, an API key'sname, …) order in Unicode code-point order on
PostgreSQL and SQLite alike —USER_LOGINbefore_generic, upper before lower case —
through the newdialect.bytewise(COLLATE "C"/COLLATE BINARY). Before, a PostgreSQL
created with a linguistic collation (thepostgresimage'sen_US.utf8default) listed
_genericfirst, since such a collation ignores punctuation. - Two server processes can start together on PostgreSQL. The startup migrations run under
a session-level advisory lock (pg_advisory_lock, on one connection of the pool): one process
migrates, the others wait and find nothing pending. Before, two processes on a database with
pending migrations (two replicas, ormementoandservicestarted by one
docker compose up) both ran the sameCREATE …and one exited with a unique violation.
SQLite is unchanged (one process per file). - A self-service key is metered and held to its daily limit on every server process, not
only on one withMEMENTO_ACCOUNTS. Stage runsservice(accounts on) andmemento
(accounts off) on one database, and a key made on the service site works on both: events
written throughmementowere missing from the key's usage and "today" count, and its daily
limit did not apply there. Now a key of a tenant with an account member is metered and
limited wherever it writes (one count in Redis whenREDIS_URLis set); a process with
accounts still meters every key, and one without leaves other keys (CLI keys of operator
tenants) alone. A process without accounts sends the quota mails when it has
MEMENTO_SERVICE_URL, and without it leaves the day's mail to one that can. New plugin
optionsmetering(redis,usage,mail,now) andlimits;accounts.redis,
.usageand.nowstill work.
Docker: docker pull ghcr.io/digital-cube/jsmemento:1.1.0