Supabase Core Functionality for Bloom
# Install dependencies
pnpm install
# Configure environment
cp .env.example .env.local
# Edit .env.local with your Parse Server credentials
# Start local development (requires Docker)
pnpm dev
# Run tests
pnpm testTest the fs function (it answers with a 302 to S3; -L follows it; it needs the worker secret
from your .env.local):
curl -L -H "x-bloom-worker-secret: $BLOOM_WORKER_SECRET" "http://127.0.0.1:54321/functions/v1/fs/harvest/VuebFgcL0R/Ososi.bloompub" -o test.bloompub- pnpm v11+ (pins its own version via
packageManagerand downloads Node.js v24.18.0 viadevEngines.runtimeinpackage.json— no Volta or manual Node install needed) - Deno v2.9+ (runs and tests the edge functions)
- Docker Desktop (local development only)
- Supabase account
Both package resolvers enforce a 7-day cooldown: a version published less than 7 days ago will not be installed (mitigates compromised-package supply-chain attacks).
- npm side (dev tooling):
minimumReleaseAgeinpnpm-workspace.yaml - Deno side (edge function imports):
minimumDependencyAgeindeno.json
Dependencies are pinned to exact versions (savePrefix: "" for pnpm; exact versions in the
deno.json import map), and CI installs with frozen lockfiles. To update deps, run
pnpm update / deno outdated --update — both respect the cooldown — and commit the
lockfile changes.
supabase/functions/
├── _shared/ # Shared utilities
│ ├── BloomParseServer.ts
│ └── utils.ts
├── fs/ # resolves book files to S3 (302; the Cloudflare worker streams them)
│ ├── index.ts
│ ├── BookData.ts
│ └── README.md
└── tests/ # Deno tests
pnpm dev # Start Supabase
pnpm dev:debug # Start with debugger
pnpm test # Run tests
pnpm test:watch # Run tests in watch mode
pnpm run deploy # Deploy to production ("run" needed: deploy is a pnpm built-in)Serves book files from S3 without exposing bucket details. The function looks up the book and
answers with a 302 to the S3 file; the Cloudflare worker in cloudflare/
follows that redirect server-side and streams the file to the client, so the bytes don't count
as Supabase egress.
URL: /functions/v1/fs/{bucket}/{bookid}/{path...}
Example:
# Thumbnail: expect a 302 to s3.amazonaws.com
curl -I -H "x-bloom-worker-secret: $BLOOM_WORKER_SECRET" "http://localhost:54321/functions/v1/fs/dev-harvest/ZWI7FUQnDd/thumbnails/thumbnail-256.png"
# Download book (follow the redirect)
curl -L -H "x-bloom-worker-secret: $BLOOM_WORKER_SECRET" "http://localhost:54321/functions/v1/fs/harvest/VuebFgcL0R/Ososi.bloompub" -o book.bloompubSee supabase/functions/fs/README.md for details.
This project uses a staging → production deployment workflow:
develop→ Staging environment (auto-deploy on push)main→ Production environment (auto-deploy on push)feature/*→ Feature branches (PRs todevelop)
- Develop on feature branch
- PR to
develop→ Runs tests - Merge to
develop→ Deploys to staging - Test in staging
- PR from
developtomain→ Runs tests - Merge to
main→ Deploys to production
Actions tab → Choose workflow → Run workflow
See .github/workflows/README.md for complete documentation.