From 5beb87672b0eb0be53b473f6ca91efd27fdaa1aa Mon Sep 17 00:00:00 2001 From: Atharva Sehgal Date: Thu, 16 Apr 2026 06:33:12 +0000 Subject: [PATCH 1/3] Add remote access section to CLAUDE.md Supabase docs --- CLAUDE.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index fea7e80d..d34cecac 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -112,7 +112,7 @@ import time (`src/datasmith/__init__.py` → `dotenv.load_dotenv`), so reading `DATASMITH_RL_MAX_RETRIES`, `DATASMITH_NEIGHBOR_WINDOW_DAYS`, `DATASMITH_NEIGHBOR_CAP`. -## Supabase (local) +## Supabase fc-data uses a **local Supabase** instance for all persistent state. Connection details live in `tokens.env`: @@ -120,6 +120,16 @@ fc-data uses a **local Supabase** instance for all persistent state. Connection - `SUPABASE_KEY=sb_secret_...` (service-role key) - Direct Postgres: `host=127.0.0.1 port=54322 dbname=postgres user=postgres password=postgres` +### Remote access + +The Supabase PostgREST API is also available at `https://db.formulacode.org` via a Cloudflare Tunnel, protected by Cloudflare Access service tokens. To connect from a remote machine, set these in `tokens.env`: + +- `SUPABASE_URL=https://db.formulacode.org` +- `DATASMITH_CF_ACCESS_CLIENT_ID` — Cloudflare Access service-token Client ID +- `DATASMITH_CF_ACCESS_CLIENT_SECRET` — Cloudflare Access service-token Client Secret + +When both `DATASMITH_CF_ACCESS_*` vars are set, `get_client()` and `get_async_client()` in `utils/db.py` automatically inject the required headers. See `docs/guide/remote-access.md` for full setup instructions. + ### Key tables | Table | Purpose | Populated by | From 9600fe2e74e2bb1832e581c9f7bd21448da6543d Mon Sep 17 00:00:00 2001 From: Atharva Sehgal Date: Thu, 16 Apr 2026 06:33:17 +0000 Subject: [PATCH 2/3] Fix db-tunnel to use explicit cloudflared config path --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 61c568a1..5d82f936 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,7 @@ grafana-tunnel: ## Expose Grafana publicly via Cloudflare Tunnel .PHONY: db-tunnel db-tunnel: ## Expose Supabase PostgREST API via Cloudflare Tunnel (db.formulacode.org) - @cloudflared tunnel run datasmith-db + @cloudflared tunnel --config ~/.cloudflared/config-db.yml run datasmith-db .PHONY: help From a8ed6ce5c73f92f84096f566113721d8182566a7 Mon Sep 17 00:00:00 2001 From: Atharva Sehgal Date: Thu, 16 Apr 2026 06:33:21 +0000 Subject: [PATCH 3/3] Add remote access quick-start to README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index cf10ec9d..e61898ac 100644 --- a/README.md +++ b/README.md @@ -323,6 +323,16 @@ $ npx supabase stop # stop all containers Studio is available at the URL printed by `supabase status` (default `http://127.0.0.1:54323`) — use it to browse tables, run SQL, and inspect data. +#### Remote access + +To connect from a remote machine (without running Supabase locally), the PostgREST API is available at `https://db.formulacode.org` via a Cloudflare Tunnel. Add these to your `tokens.env`: +```bash +SUPABASE_URL=https://db.formulacode.org +DATASMITH_CF_ACCESS_CLIENT_ID=your-cf-client-id +DATASMITH_CF_ACCESS_CLIENT_SECRET=your-cf-client-secret +``` +See the [Remote Access guide](docs/guide/remote-access.md) for full setup and credential provisioning. + Running `preflight` ensures that all the variables are properly defined: ```bash $ python -m datasmith.preflight