Set up OpenBursar on Cloudflare
This guide takes you from the Deploy to Cloudflare button to a working site that your AI assistant can read. It takes about 10 minutes, plus whatever your data source needs (Plaid's Sandbox works straight away).
What you need first
- A Cloudflare account. The Workers Free plan works. Workers Paid ($5/month) gives more headroom: the free plan has a tight CPU limit per request, and a first full history import or a cold dashboard load can run into it.
- A GitHub account. Cloudflare copies OpenBursar into it.
- A password manager, for your passphrase.
- A phone or computer that can hold a passkey (Face ID, Touch ID, Windows Hello, or a password manager that stores passkeys).
1. Deploy
- Click Deploy to Cloudflare in the README, or open
https://deploy.workers.cloudflare.com/?url=https://github.com/openbursar/openbursar. - Cloudflare asks for one secret,
OWNER_PASSPHRASE. Choose one long random phrase: at least 12 characters, ideally 20 or more. Save it in your password manager now. It is your setup code (you type it once, to claim the site) and the root of the key that encrypts your bank credentials. Start the deploy. Cloudflare then:
- copies the repository into your GitHub account,
- creates a D1 database (
DB) and a KV namespace (OAUTH_KV) and connects them to the Worker, - sets up Workers Builds, so every push to your copy redeploys it. The build command is
npm run build; the deploy command isnpm run deploy, which deploys the Worker and applies database migrations.
Want your own domain? Add it before you create your passkey in step 2. Passkeys are tied to the site's address, so moving later means claiming the site again and reconnecting your AI assistant.
What you should see now: a finished build, and a Worker URL such as https://openbursar.<your-subdomain>.workers.dev.
2. Claim the site
- Open your Worker's URL. Because nobody owns the site yet, it shows a sign-in page that asks for your setup code.
- Enter your
OWNER_PASSPHRASEand create a passkey when your browser asks.
After that, your passkey signs you in. You can add more passkeys, or remove one, in Settings → Security; the last one can't be removed. The setup code stops working once the site is claimed. Wrong codes are limited to 5 tries every 15 minutes, counted for everyone together, so claim your site soon after deploying.
What you should see now: the Overview page with a setup checklist. The first four steps (secret, database, encryption key, sign-in) are already ticked.
Lost your passkey? In the Cloudflare dashboard, open Workers & Pages → your Worker → Settings → Variables and Secrets, and add or change the secret RESET_OWNER to any new value. Then open your site straight away and claim it again with your setup code: the reset happens on the first page load, and until you claim it, anyone who knows your setup code could. (If you think your passphrase leaked, change OWNER_PASSPHRASE first.) Your accounts, history and stored credentials are kept. Passkeys, dashboard sessions and connected AI apps are removed, so approve each assistant again. MCP_TOKEN is not affected. Setting the same value again does nothing.
3. Choose a data source
The setup checklist offers:
- Plaid (default): banks, cards and brokerages in one, with up to 24 months of history and categories. Paste your keys from dashboard.plaid.com and click Test and save keys. Sandbox works right away; for real accounts, apply for Plaid's free Trial plan (US and Canada, up to 10 bank connections). Approval is usually quick. See Plaid: from Sandbox to Production.
- SimpleFIN + SnapTrade: no approval needed. SimpleFIN costs about $15/year and covers banks and cards (SimpleFIN); SnapTrade Personal is free and covers brokerages (SnapTrade (investments)). You paste each one's token or keys in Settings → Data sources.
- Demo data: a fictional household with 13 months of history, to try everything before you connect a bank. Remove it in Settings whenever you like.
You can also bring in CSV exports from a bank, Mint, YNAB or Quicken anytime from Import (or Settings → Data sources); see Importing CSV files.
Not ready to connect yet? Click Skip for now at the bottom of the data-source step to open the dashboard anyway. Until you connect an account, the top bar shows Setup N of 7 and Overview shows a Continue setup button so you can come back to the checklist whenever you're ready.
4. Connect an account
- Plaid Sandbox: click add a test bank instantly, or use Connect a bank or card with
user_good/pass_good. - Plaid Production: paste your Production secret on the setup page or in Settings → Data sources. No redeploy is needed. Banks that sign you in on their own site (Chase, Bank of America, and others) need the redirect address
https://<your-site>/plaid/oauth-returnregistered in Plaid; the setup page shows it with a copy button. Details in Plaid: from Sandbox to Production. - SimpleFIN: paste the setup token from the SimpleFIN Bridge. Connect SnapTrade in Settings → Data sources.
Your data then syncs once a day (a Cron Trigger at 11:17 UTC) and whenever Plaid reports new data.
What you should see now: your accounts on the Overview page, and the "connect your first account" step ticked.
5. Connect your AI assistant
Add https://<your-site>/api/mcp to your AI assistant as a custom connector and approve it with your passkey. Steps for Claude Duet, dots in ChatGPT, Muse, Claude, ChatGPT, terminal agents and other MCP clients are in Connect your AI assistant. There is nothing to configure on the Cloudflare side.
Optional: put Cloudflare Access in front
Cloudflare Access can add a second sign-in in front of the dashboard. If you use it, leave these paths open, because your AI assistant, your data provider and the daily sync call them without a browser session:
/api/mcp,/token,/registerand/.well-known/*(your AI assistant),/api/webhooks/*(Plaid),/api/cron/*(the daily sync calls your own site; if this is blocked, the sync quietly falls back to running in one request, which can hit Cloudflare's per-request limits when you have many connections),/healthz(optional, for uptime checks).
Most of these check their own credentials: /api/mcp needs an OAuth token or MCP_TOKEN, /token needs a valid authorization code, /api/webhooks/* needs Plaid's signature, and /api/cron/* needs a token derived from OWNER_PASSPHRASE. /register, /.well-known/* and /healthz are public by design and show no financial data. Keep everything else, including /login and /authorize, behind Access: the consent page opens in your own browser, which is already signed in to Access.
Updates
Your copy was created from the upstream repository. To update, pull from its release branch: on GitHub, click Sync fork, or open a pull request from openbursar/openbursar release into your copy. Merging starts a build, and npm run deploy applies any new migrations. Your data is untouched.
Reverting the v1 transfer backfill
When you update to a version with improved transfer detection, the first sync runs a one-time backfill (v1) that reclassifies older transactions and saves every changed transaction ID in fin_settings (transfer_backfill_v1_log:*). Any transaction whose transfer flag is controlled by one of your own rules (is_transfer_rule) is never touched.
If you want to undo the v1 backfill:
Check that no sync or backfill is running, and preview how many transactions v1 flipped. Avoid running this near the daily Cloudflare cron (
11:17 UTC) or while triggering a sync. (On Docker, you can pause automatic syncs by settingOB_SYNC=offand runningdocker compose up -d.)Run these read-only queries first:
SELECT key, value FROM fin_settings WHERE key = 'transfer_backfill_lease' AND json_valid(value) AND CAST(json_extract(value, '$.until') AS INTEGER) > unixepoch() * 1000; SELECT count(*) AS active_syncs FROM fin_connections WHERE sync_lease_until > unixepoch() * 1000; SELECT key, json_array_length(value, '$.to_transfer') AS to_xfer, json_array_length(value, '$.to_spending') AS to_spend FROM fin_settings WHERE (key = 'transfer_backfill_v1_log' OR key GLOB 'transfer_backfill_v1_log:*') AND json_valid(value);- Cloudflare: run each query with
npx wrangler d1 execute DB --remote --command "...". Docker: run all three at once inside the running container:
docker compose exec openbursar node -e ' const { DatabaseSync } = require("node:sqlite"); const db = new DatabaseSync(process.env.OB_DB_PATH || "/data/openbursar.db"); try { console.log("active lease:", db.prepare("SELECT key, value FROM fin_settings WHERE key = '\''transfer_backfill_lease'\'' AND json_valid(value) AND CAST(json_extract(value, '\''$.until'\'') AS INTEGER) > unixepoch() * 1000").all()); console.log("active syncs:", db.prepare("SELECT count(*) AS active_syncs FROM fin_connections WHERE sync_lease_until > unixepoch() * 1000").all()); console.log("v1 shards:", db.prepare("SELECT key, json_array_length(value, '\''$.to_transfer'\'') AS to_xfer, json_array_length(value, '\''$.to_spending'\'') AS to_spend FROM fin_settings WHERE (key = '\''transfer_backfill_v1_log'\'' OR key GLOB '\''transfer_backfill_v1_log:*'\'') AND json_valid(value)").all()); } finally { db.close(); } '
If an active lease is returned (leases expire after 2 minutes) or
active_syncsis non-zero, wait for the sync to finish before continuing.- Cloudflare: run each query with
Back up your database first:
- Cloudflare:
npx wrangler d1 export DB --remote --output=before-revert.sql - Docker:
docker compose exec openbursar node dist/server.mjs backup(see Running OpenBursar in Docker)
- Cloudflare:
Save the SQL below as
revert-transfer-backfill.sql. It setstransfer_classifier_vto1first (so a new v1 run can't start mid-revert and future syncs won't re-apply v1, without downgrading any newer version), restores every transaction flipped by v1 while preserving your rules (is_transfer_rule IS NULL), and removes the v1 audit shards and v1 cursor:INSERT INTO fin_settings (key, value) VALUES ('transfer_classifier_v', '1') ON CONFLICT (key) DO UPDATE SET value = '1', updated_at = strftime('%Y-%m-%dT%H:%M:%fZ','now') WHERE fin_settings.value IS NULL OR NOT json_valid(fin_settings.value) OR json_type(fin_settings.value, '$') NOT IN ('integer', 'real') OR CAST(json_extract(fin_settings.value, '$') AS INTEGER) < 1; UPDATE fin_transactions SET is_transfer = 0 WHERE is_transfer_rule IS NULL AND is_transfer = 1 AND id IN ( SELECT j.value FROM fin_settings s, json_each(CASE WHEN json_valid(s.value) THEN s.value ELSE '{}' END, '$.to_transfer') j WHERE (s.key = 'transfer_backfill_v1_log' OR s.key GLOB 'transfer_backfill_v1_log:*') AND json_valid(s.value) AND json_extract(s.value, '$.version') = 1 AND json_type(s.value, '$.to_transfer') = 'array' AND j.type = 'text' ); UPDATE fin_transactions SET is_transfer = 1 WHERE is_transfer_rule IS NULL AND is_transfer = 0 AND id IN ( SELECT j.value FROM fin_settings s, json_each(CASE WHEN json_valid(s.value) THEN s.value ELSE '{}' END, '$.to_spending') j WHERE (s.key = 'transfer_backfill_v1_log' OR s.key GLOB 'transfer_backfill_v1_log:*') AND json_valid(s.value) AND json_extract(s.value, '$.version') = 1 AND json_type(s.value, '$.to_spending') = 'array' AND j.type = 'text' ); DELETE FROM fin_settings WHERE (key = 'transfer_backfill_cursor' AND (value IS NULL OR NOT json_valid(value) OR json_extract(value, '$.version') = 1)) OR key = 'transfer_backfill_v1_log' OR key GLOB 'transfer_backfill_v1_log:*';Run the SQL file against your database (on Cloudflare, re-run Step 1 first if the backup took a while, because
wrangler d1 execute --fileruns statements sequentially without an outer transaction):Cloudflare (D1):
npx wrangler d1 execute DB --remote --file=revert-transfer-backfill.sql(Don't add
BEGIN/COMMITto the file; D1 rejects explicit transaction statements in SQL files.)Docker (SQLite, using the container's built-in
node:sqlite):docker compose exec -T openbursar node -e ' const fs = require("node:fs"); const { DatabaseSync } = require("node:sqlite"); const db = new DatabaseSync(process.env.OB_DB_PATH || "/data/openbursar.db"); try { db.exec("PRAGMA busy_timeout = 5000;\nBEGIN IMMEDIATE;\n" + fs.readFileSync(0, "utf8") + "\nCOMMIT;"); } finally { db.close(); } ' < revert-transfer-backfill.sql
Want the next sync to re-run v1 instead? After running the revert above (so the old v1 audit shards are cleared first), run DELETE FROM fin_settings WHERE key = 'transfer_classifier_v' AND (value IS NULL OR NOT json_valid(value) OR json_type(value, '$') NOT IN ('integer', 'real') OR CAST(json_extract(value, '$') AS INTEGER) <= 1);. Only do this if you're rolling back to an older app version or deliberately re-running the backfill.
Environment variables
Set these under Workers & Pages → your Worker → Settings → Variables and Secrets. Cloudflare deploys a new version of the Worker when you save; if it doesn't, trigger a deploy from the dashboard.
| Name | Purpose |
|---|---|
OWNER_PASSPHRASE | Required. Setup code and encryption root (see below). At least 12 characters. |
RESET_OWNER | Recovery: a new value removes the owner and passkeys so you can claim the site again. |
MCP_TOKEN | A fixed bearer token (16+ characters) for scripts and clients without OAuth. See Connect your AI assistant. |
PLAID_CLIENT_ID, PLAID_SECRET, PLAID_ENV | Set Plaid keys here instead of in the app. Used only when both the client ID and the secret are set; they then override saved keys. |
PLAID_REDIRECT_URI | Override the bank sign-in return address (default https://<your-site>/plaid/oauth-return). Register it in Plaid too. |
PLAID_COUNTRY_CODES | Defaults to US. |
PLAID_LANGUAGE | Language for Plaid Link. Defaults to en. |
BASE_URL | Your public address. Recommended once you've settled on one. Without it, the site uses the address of your last dashboard visit for webhooks and the daily sync. |
Important: the passphrase
Provider keys and bank tokens are encrypted with keys derived from OWNER_PASSPHRASE. If you change it:
- every dashboard session is signed out,
- stored provider credentials can't be decrypted, so re-enter your provider keys and reconnect your accounts (your history is kept),
- your passkeys still work,
- connected AI apps and
MCP_TOKENkeep working. To cut them off, revoke them in Settings → AI access (MCP) and changeMCP_TOKEN, - nothing is re-encrypted, so a database export made earlier can still be read with the old passphrase, and putting the old passphrase back restores access.
If you are changing it because it may have leaked, also rotate your keys at Plaid, SimpleFIN and SnapTrade. To reset your passkeys, use RESET_OWNER instead.
Local development
npm install
cp .dev.vars.example .dev.vars # set OWNER_PASSPHRASE to any 12+ character string
npm run migrate:local # apply migrations to a local D1
npm run dev # build the client bundle and run in the local Workers runtime