Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9a1ba2e
Add Supporter plan, cloud backend, and SEO pages (1.1.0)
Sukarth Jul 27, 2026
052ff2a
Fix bugs found in PR review
Sukarth Jul 27, 2026
3e545e1
Harden update-supporters workflow: don't persist the push token durin…
Sukarth Jul 27, 2026
6d56967
Give every account its own local diagrams
Sukarth Jul 28, 2026
d89e081
Store diagrams in IndexedDB instead of localStorage
Sukarth Jul 28, 2026
15bc1e2
Close hard-delete gaps in the schema; harden version cap and metering
Sukarth Jul 28, 2026
e4931b8
Fix data loss and stale-state bugs in the per-account store
Sukarth Jul 28, 2026
99c76d6
Fix billing verification, share revocation, and cross-account leaks
Sukarth Jul 28, 2026
26c2294
Fix intersection geometry in SEO diagram illustrations
Sukarth Jul 28, 2026
597777b
Validate checkout redirect origins; bound the model call; docs and co…
Sukarth Jul 28, 2026
e6cbd95
Accessibility: field names, table semantics, keyboard-reachable templ…
Sukarth Jul 28, 2026
cc153c4
Fix AI title lock, sign-in return target, import ordering and save races
Sukarth Jul 28, 2026
31707ab
Fix share snapshot staleness, modal re-query churn, phone project picker
Sukarth Jul 28, 2026
ce61398
Enforce last-write-wins in the database; fix sync tombstone and retry…
Sukarth Jul 28, 2026
d4f46d4
Validate model output, add request timeouts, pre-render SPA route can…
Sukarth Jul 28, 2026
ba2dc1a
Order Polar webhook events and block concurrent checkouts
Sukarth Jul 28, 2026
a0e3d66
Drop the renewal margin on scheduled cancellations; SPA footer links
Sukarth Jul 28, 2026
7e645a0
Disclose per-backend AI data handling in the privacy policy
Sukarth Jul 28, 2026
4cffab0
Add GoatCounter; revert privacy and changelog edits; drop the checkou…
Sukarth Jul 28, 2026
d507797
Fetch diagram payloads only for the rows sync actually pulls
Sukarth Jul 28, 2026
afbe57f
Stop treating an unreadable local store as an empty one
Sukarth Jul 28, 2026
665b252
Gate saving on the read, not on which namespace loaded last
Sukarth Jul 28, 2026
89d1be1
Chain caller aborts, order version locks, survive a label-less point
Sukarth Jul 28, 2026
50a6b94
Stop keyboard delete from also adding the template
Sukarth Jul 28, 2026
5f281da
Keep per-account retry state apart, and hold auto-open through adoption
Sukarth Jul 28, 2026
b28ac35
Scope the FK check to its table, and match the dev tunnel lists
Sukarth Jul 28, 2026
7125bc9
Stop guest adoption from cancelling itself and losing the work
Sukarth Jul 28, 2026
263efe4
Invalidate a guest handover when the account changes, not by comparin…
Sukarth Jul 29, 2026
706fe56
Park a finished handover until its account is live, never discard it
Sukarth Jul 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ─────────────────────────────────────────────────────────────────────────────
# IB EconGraph AI — environment variables
#
# Everything here is OPTIONAL. Without any of it the app runs fully free &
# local (BYOK AI keys are entered in the UI, data lives in localStorage).
# Configure these only if you want accounts, cloud sync, and the Supporter
# plan on your own deployment. See docs/BACKEND_SETUP.md for the full guide.
# ─────────────────────────────────────────────────────────────────────────────

# ── Client (bundled into the frontend by Vite — safe to expose) ─────────────
# Supabase project URL + publishable key (sb_publishable_…, Project Settings →
# API Keys). Low-privilege, safe in the client bundle. Enables sign-in/sync/share.
VITE_SUPABASE_URL=
VITE_SUPABASE_PUBLISHABLE_KEY=

# ── Server (Vercel project env vars — NEVER commit real values) ─────────────
# Supabase secret key (sb_secret_…, Project Settings → API Keys). Bypasses RLS;
# server only — Supabase rejects it if sent from a browser.
SUPABASE_URL=
SUPABASE_SECRET_KEY=

# ── Hosted AI (Supporter plan) ──────────────────────────────────────────────
# The server generates diagrams for supporters using ONE of three backends.
# They are tried in the order below; the first one that is configured wins.
#
# 1) Vertex AI express mode: a single API key, no service account, so it works
# on serverless out of the box. Create one in the Google Cloud console under
# "Gemini Enterprise Agent Platform" (the 2026 rebrand of Vertex AI), express
# mode. NOTE: creating a Vertex API key requires a Google Cloud organization;
# a personal @gmail.com account with no org is blocked and should use (2).
VERTEX_API_KEY=
#
# 2) Vertex AI with a project id (and optional location, default "global").
# Locally this authenticates with your gcloud Application Default
# Credentials: run `gcloud auth application-default login` once. On hosts
# without gcloud (e.g. Vercel), also paste a service-account key JSON as a
# single line into GOOGLE_SERVICE_ACCOUNT_JSON.
GOOGLE_CLOUD_PROJECT=
GOOGLE_CLOUD_LOCATION=global
GOOGLE_SERVICE_ACCOUNT_JSON=
#
# 3) Gemini Developer API (Google AI Studio): the simplest fully-free option.
# Get a key at https://aistudio.google.com/apikey
GEMINI_API_KEY=

# Shared hosted-AI settings, applied to whichever backend above is active.
HOSTED_AI_MONTHLY_LIMIT=150
HOSTED_AI_MODEL=gemini-2.5-flash

# Polar billing (https://polar.sh). Use POLAR_SERVER=sandbox while testing.
POLAR_ACCESS_TOKEN=
POLAR_WEBHOOK_SECRET=
POLAR_PRODUCT_ID_MONTHLY=
POLAR_PRODUCT_ID_YEARLY=
POLAR_SERVER=production

# Public URL of the deployment, used to pin checkout redirects to a canonical
# domain. Optional: if left blank the server uses the incoming request's origin
# (your real domain), which is correct for most setups. Set it only to force a
# specific domain, e.g. when *.vercel.app preview aliases should redirect to
# your primary URL. Example: https://your-app.vercel.app
APP_URL=
50 changes: 50 additions & 0 deletions .github/workflows/db-keepalive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: DB keepalive

# Supabase free-tier projects pause after 7 days of inactivity. This makes a
# cheap read against the database every ~5 days to keep it awake, leaving a
# safe margin under the 7-day pause window.
#
# Reuses the same repository secrets as the supporters workflow
# (Settings, then Secrets and variables, then Actions):
# SUPABASE_URL your Supabase project URL
# SUPABASE_SECRET_KEY the Supabase secret key (sb_secret_...)

on:
schedule:
# Runs on days 1,6,11,16,21,26,31 -> a gap of at most 5 days, always under 7.
- cron: '0 6 */5 * *'
workflow_dispatch: {}

concurrency:
group: db-keepalive
cancel-in-progress: false

jobs:
ping:
runs-on: ubuntu-latest
steps:
- name: Ping the database
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_SECRET_KEY: ${{ secrets.SUPABASE_SECRET_KEY }}
run: |
if [ -z "$SUPABASE_URL" ] || [ -z "$SUPABASE_SECRET_KEY" ]; then
echo "Supabase secrets are not set; nothing to ping."
exit 0
fi
# One-row read via PostgREST. The secret key bypasses RLS, so this is a
# trivial query that still counts as real database activity.
# Bound the request: without a timeout a hung connection would stall
# the job until GitHub's 6h default runner limit.
code=$(curl -s -o /dev/null -w '%{http_code}' \
--connect-timeout 15 --max-time 60 --retry 2 --retry-delay 5 \
"$SUPABASE_URL/rest/v1/profiles?select=id&limit=1" \
-H "apikey: $SUPABASE_SECRET_KEY" \
-H "Authorization: Bearer $SUPABASE_SECRET_KEY")
echo "Supabase responded: HTTP $code"
# 200 (rows) and 206 (partial content) both mean the query was served.
if [ "$code" != "200" ] && [ "$code" != "206" ]; then
echo "Unexpected status $code; keepalive may have failed."
exit 1
fi
echo "Keepalive ping OK."
53 changes: 53 additions & 0 deletions .github/workflows/update-supporters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Update supporters

# Refreshes the Supporters block in README.md from the database on a schedule.
# Requires two repository secrets (Settings → Secrets and variables → Actions):
# SUPABASE_URL — your Supabase project URL
# SUPABASE_SECRET_KEY — the Supabase secret key (sb_secret_…)

on:
schedule:
- cron: '0 6 * * 1' # every Monday at 06:00 UTC
workflow_dispatch: {} # allow manual runs from the Actions tab

permissions:
contents: write

# Never run two updates at once.
concurrency:
group: update-supporters
cancel-in-progress: false

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Don't leave a contents:write token in .git/config while `npm ci`
# runs arbitrary dependency install scripts. The push below passes
# the token explicitly instead.
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- name: Refresh supporters block
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_SECRET_KEY: ${{ secrets.SUPABASE_SECRET_KEY }}
run: node scripts/update-supporters.mjs
- name: Commit if the README changed
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -n "$(git status --porcelain README.md)" ]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "chore: refresh supporters list"
git push "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "HEAD:${GITHUB_REF_NAME}"
else
echo "No supporter changes to commit."
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ lerna-debug.log*
# OS files
.DS_Store
Thumbs.db
.vercel
.env*
!.env.example
Loading