Repository navigation
v3.0.0 — Billing, Dropbox & Security
Turns the app into a freemium SaaS: a paid tier with real Stripe billing, Dropbox as a Pro provider, and R2 credentials moved off the client. Along the way, several security holes were closed and the project got a test suite and CI.
💳 Billing
- Free (500 MB) and Pro ($9/mo, 5 GB) tiers, with a
profilestable holding tier, limits and subscription state. - Stripe Checkout for upgrades, Customer Portal for management, and a webhook that keeps the tier in sync in both directions — upgrade and downgrade.
- Storage limits are now dynamic per tier instead of a hardcoded constant.
- A second checkout is refused with
409when a subscription is already active — the client hid the button, but the route did not, and Stripe billed for every extra subscription.
The public deployment runs on Stripe test keys. The plans page says so, and real cards are declined — use
4242 4242 4242 4242.
📦 Storage
- Dropbox as a Pro-only provider over OAuth 2.0 with PKCE, plus a provider picker on the upload screen.
- Cloudflare R2 moved behind serverless functions.
VITE_R2_ACCESS_KEY_IDandVITE_R2_SECRET_ACCESS_KEYused to be inlined into the public bundle by Vite — anyone could read them in DevTools. Uploads, downloads and deletes now go through/api/r2/*, which signs URLs server-side.
🔒 Security
| Issue | Fix |
|---|---|
Any user could grant themselves Pro — the profiles UPDATE policy covered every column, including tier |
Policy dropped, UPDATE revoked from authenticated/anon (migration 002) |
| Any authenticated user could delete anyone's Cloudinary asset | Ownership verified before destroy() |
| Storage quota was advisory — a direct call to the presign endpoint bypassed it | Enforced server-side, with ContentLength signed into the URL |
| Files inside folders never counted toward the quota | Usage summed across all folders |
Dropbox OAuth had no state parameter |
Added, with a matching check on the callback |
Dropbox refresh tokens lived in localStorage, readable by any XSS |
Moved to dropbox_connections, server-side only, behind RLS with no policies (migration 003) |
Serverless code fell back to VITE_-prefixed secrets |
Fallbacks removed |
🐛 Notable fixes
- Upgrades never applied: Stripe removed
current_period_endfrom the subscription object in API2025-03-31.basil, so the webhook built anInvalid Dateand threw. It is now read fromsubscription.items.data[0]. - The webhook rejected its own successful writes —
.select(columns, options)is not a valid signature after.update(). - An account over its storage limit displayed a flat
100.0%; the number is now honest, and quota errors are readable (3.00 GB of 500.0 MB) instead of raw byte counts.
🧪 Tests and CI
- 31 unit tests (Vitest) and 15 e2e tests (Playwright).
- GitHub Actions runs lint, type-checking of both
srcandapi, unit and e2e tests on every pull request;mainis protected and requires them to pass.
⚡ Performance
- Vendor code split into cacheable chunks — application code is now a 5 KB gzip chunk of its own, instead of riding inside a single 1.7 MB bundle that returning visitors re-downloaded after every deploy.
- Sentry Session Replay removed: it recorded the DOM of a file store, file and folder names included, for 40 KB gzip and a 50-replay monthly quota. Crash reporting and tracing stay.
📄 Also
Legal pages (Terms, Privacy) reachable without signing in, an ErrorBoundary, a 404 page, and a postmortem in the README about an anon key that spent 221 days named SUPABASE_SERVICE_ROLE_KEY.
Full changelog: v2.1.0...v3.0.0