~/.fleet/v2, outside your source checkout. Rebuilding an app, unloading an idle worker, or restarting Fleet never wipes your data.ctx.db:ctx.db.get(key) — returns the stored value, or null if the key doesn't exist.ctx.db.set(key, value) — saves a JSON value up to 2 MB (mutations and jobs only).ctx.db.delete(key) — deletes a key and returns true if it existed (mutations and jobs only).ctx.db.list(prefix?) — returns up to 1,000 { key, value } entries matching a key prefix.123// Inside a mutation or job handler: const settings = ctx.db.get('settings') ?? { theme: 'system' }; ctx.db.set('settings', { ...settings, theme: 'dark' });
ctx.db changes from that call roll back automatically. Keep in-memory module state disposable because workers unload after 30 seconds of inactivity.jobs entry to fleet.json (keeping the existing version, id, and name fields):12345{ "jobs": [ { "name": "dailyCheck", "everySeconds": 86400 } ] }
jobs in server/index.ts:12345678910export default { queries: {}, mutations: {}, jobs: { dailyCheck(ctx) { ctx.db.set('lastCheck', new Date().toISOString()); ctx.log('Daily check completed', ctx.runId); }, }, };
ctx.runId — pass ctx.runId as an idempotency key when calling external APIs.fleet call APP jobs NAME and check its history with fleet inspect APP and fleet logs APP.1fleet backup notes --output notes.sqlite
1fleet restore notes notes.sqlite
fleet unregister notes or fleet uninstall leaves both your source checkout and stored SQLite data untouched. Treat backups carefully — they contain your private app data.