feat: Add LOCAL_ONLY mode for local development without Firebase/GCP#3644
feat: Add LOCAL_ONLY mode for local development without Firebase/GCP#3644evand wants to merge 4 commits intomanifoldmarkets:mainfrom
Conversation
Enable fully local Manifold development using local Supabase (PostgreSQL). ## SQL Schema Fixes (21 files) - seed.sql: Fix malformed comment syntax (lines 2, 4) - answers.sql: Remove trailing comma before ); - 19 files: Change invalid `constraint primary key` to `primary key` ## LOCAL_ONLY Mode (API Server) - serve.ts: Skip Firebase init and Secret Manager when LOCAL_ONLY=true - init.ts: Support SUPABASE_HOST/SUPABASE_PORT env vars for local connection - utils.ts: Handle LOCAL_ONLY in isProd() to avoid Firebase calls - stripe-endpoints.ts: Lazy-init firestore to prevent import-time crash ## LOCAL_ONLY Mode (Scheduler) - scheduler/utils.ts: Skip Firebase/Secret Manager init - scheduler/index.ts: Skip METRIC_WRITER when LOCAL_ONLY ## New Files - backend/api/.env.local.template: Environment template for local API - backend/scheduler/.env.local.template: Environment template for scheduler - backend/supabase/load-local-schema.sh: Script to load schema in correct order ## Usage 1. Start local Supabase: `cd backend/supabase && npx supabase start` 2. Load schema: `./load-local-schema.sh` 3. Copy template: `cd backend/api && cp .env.local.template .env.local` 4. Start server: `set -a && source .env.local && set +a && yarn dev` Tested: API server connects to local PostgreSQL and serves data correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Enable web frontend to work with local Supabase in LOCAL_ONLY mode. Changes: - web/lib/supabase/admin-db.ts: Use SUPABASE_KEY env var in LOCAL_ONLY mode - common/src/supabase/utils.ts: Use local Supabase REST API URL in LOCAL_ONLY mode Usage: 1. Copy web/.env.local.template to web/.env.local (or set LOCAL_ONLY=true, SUPABASE_KEY) 2. Run: yarn dev:local Note: May need to increase file watcher limit: sudo sysctl fs.inotify.max_user_watches=524288 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- auth-context.tsx: Skip Firebase, load test user directly from API - api.ts: Add setLocalOnlyUserId() to include auth headers without Firebase - endpoint.ts: Accept X-Local-User header in LOCAL_ONLY mode Enables full local development workflow: - Set NEXT_PUBLIC_LOCAL_ONLY=true in web/.env.local - Set NEXT_PUBLIC_LOCAL_TEST_USER=<username> - Frontend auto-logs in as test user, API calls work 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Someone is attempting to deploy a commit to the Manifold Markets Team on Vercel. A member of the Team first needs to authorize it. |
Comprehensive step-by-step guide for running Manifold locally without Firebase/GCP credentials. Covers: - Quick wins (web frontend only, mock bet server) - Full local stack with Supabase - LOCAL_ONLY mode configuration - Test data creation and betting verification - Web frontend with auto-login - Troubleshooting common issues 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
I ran into several issues, particularly around the contract created manually in the documentation. Here is a patch file with the fixes: Things are still not working 100%, but it's roughly working |
|
This is really cool! |
|
Superseded by #3696, which is rebased on current main and incorporates the fixes from @GabrielleVivissi (thank you for the Supabase client config, auth context, and env var contributions!). The new PR also resolves several additional issues discovered during testing:
Thank you @ManiFed for the positive feedback on this PR! Closing in favor of #3696. |
PR created entirely by Claude; zero human code review, only high-level functional checks.
Summary
Adds a
LOCAL_ONLYmode that enables fully local Manifold development without requiring Firebase credentials or GCP access. This makes it possible to:Changes
Backend API - Accept X-Local-User header for auth when LOCAL_ONLY=true
Web Frontend - Auto-login as test user when NEXT_PUBLIC_LOCAL_ONLY=true
Common - Add setLocalOnlyUserId() for API auth headers
Supabase - Use SUPABASE_URL env var in local mode
Test plan
Why this is useful
Enables contributors to test backend changes (AMM logic, bet calculations, schema changes) without needing privileged credentials.