Skip to content
ExploreHivesDatasetsRequestsMCPDocsPricing

Deploying to Vercel

DataRebel deploys to Vercel as one project with multiple services, configured by the root vercel.json. Everything is served from one domain (e.g. datarebel.io):

Service Root Runtime Reachable
api . (repository root) Python, FastAPI (vercel_app:app, one function) public on the API paths below; also called internally by web
web apps/web Next.js public on every other path (/(.*))

Services are internal by default. The top-level rewrites in vercel.json make them public, matched in order (most specific first):

Public path Service
/v1/* (REST, incl. /v1/docs, /v1/redoc, cron endpoints, asset uploads/downloads) api
/v1/mcp, /v1/mcp/contribute (MCP Streamable HTTP, covered by the /v1/* rule) api
/.well-known/datarebel.json, /.well-known/oauth-protected-resource, /agents.json, /datasets.json, /llms.txt, /llms-full.txt, /openapi.json api
/health, /ready api
everything else (/, /docs/*, /datasets/*, dashboards, …) web

The FastAPI interactive docs live at /v1/docs so they do not collide with the website's /docs.

Bindings

Calling service Target Variable Used for
web api API_INTERNAL_URL server components and server actions call the REST API (apps/web/lib/api.ts)

Vercel injects API_INTERNAL_URL at runtime in the web functions; do not set it yourself. It is not available at build time or in middleware, which is why every API-backed page renders dynamically and the Next.js rewrites() are disabled on Vercel (the project-level rewrites already route those paths).

Public URLs shown to users and agents (site, REST base, MCP endpoint) default to the deployment's own origin (VERCEL_PROJECT_PRODUCTION_URL in production, VERCEL_URL in previews) on both services. Set WEB_URL/API_URL/MCP_URL (api) and NEXT_PUBLIC_SITE_URL/NEXT_PUBLIC_API_URL/NEXT_PUBLIC_MCP_URL (web) only to advertise a custom domain.

What changes on serverless

  • One Python function (vercel_app.py) serves REST and both MCP surfaces. MCP runs stateless with JSON responses, so any function instance can answer any request.
  • No worker process. Vercel Cron Jobs call /v1/internal/cron/frequent and /v1/internal/cron/daily (authenticated with CRON_SECRET). Exports and small asset ingestion run inline.
  • Size budget. Vercel Python functions are capped at 225 MB, so the function installs only the core dependencies. The analytics extra (pyarrow + DuckDB) is omitted: version snapshots are gzipped JSON Lines instead of Parquet, aggregations run as SQL, and Parquet exports report feature_disabled. There is no ffmpeg, so video posters are skipped (metadata is still extracted by the pure-Python parsers).
  • Request bodies are capped (~4.5 MB). Media is uploaded straight to the bucket with presigned URLs; the API upload path accepts at most 4 MB on Vercel.
  • Ephemeral disk. Object storage must be S3-compatible (AWS S3, Cloudflare R2, …): STORAGE_BACKEND=s3. Production refuses to start without it. Allow PUT from browsers/agents in the bucket's CORS policy if clients upload from a browser.

1. Provision services

  • PostgreSQL 16, e.g. Neon (Vercel Marketplace) or Supabase. Use the pooled connection string. postgres://… URLs are accepted (the driver is selected automatically). Enable pgvector if available.
  • S3-compatible bucket: create a private bucket and an access key.
  • Redis (optional), e.g. Upstash (rediss://…), used for rate limiting. Without it, limits are per instance.

2. Create the project

Import the repository in Vercel with Root Directory left at the repository root; the services block in vercel.json defines both services. Environment variables (project level):

Variable Value
ENVIRONMENT production
DATABASE_URL pooled Postgres URL (also expose to the Build environment so migrations run)
SECRET_KEY, WEBHOOK_SIGNING_SECRET long random strings
CRON_SECRET long random string (Vercel sends it as Authorization: Bearer …)
STORAGE_BACKEND / S3_ENDPOINT_URL / S3_BUCKET / S3_ACCESS_KEY_ID / S3_SECRET_ACCESS_KEY / S3_REGION your bucket
REDIS_URL optional
OPENAI_API_KEY enables OpenAI embeddings for semantic search (without it: deterministic hashing)
RESEND_API_KEY, EMAIL_FROM Resend API key and a sender on a domain verified in Resend (without a key, email is only logged)
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET optional owner sign-in with Google / GitHub (see below)
MCP_ALLOWED_HOSTS custom domains, e.g. datarebel.io (Vercel's own deployment URLs are allowed automatically)
SEED_ON_START default on: each build syncs the starting catalog (idempotent; no records). false skips it

Payment flags stay at their defaults (BILLING_MODE=mock, everything else false).

Migrations run in the api service's build step (scripts/vercel_build.py) when DATABASE_URL is available at build time. Otherwise run datarebel-admin migrate from a machine with database access before the first deploy.

Google and GitHub sign-in (optional)

The redirect URIs are built from the public site URL (WEB_URL, which defaults to the production domain), so set WEB_URL to your custom domain when you use one. Register:

  • Google (Google Cloud console → APIs & Services → Credentials → OAuth client ID, type Web application): authorized redirect URI https://<your-domain>/auth/oauth/google/callback. Configure the OAuth consent screen with the openid, email and profile scopes.
  • GitHub (Settings → Developer settings → OAuth Apps → New OAuth App): homepage https://<your-domain>, authorization callback URL https://<your-domain>/auth/oauth/github/callback.

Set the client id and secret for the Production environment. Preview deployments have their own URLs, which are not registered, so leave the variables unset there (password sign-in keeps working).

3. Cron frequency

vercel.json ships daily schedules so it deploys on every plan. On Pro, run the frequent group more often so webhooks, asset ingestion, earnings releases and expiries stay timely:

{ "path": "/v1/internal/cron/frequent", "schedule": "*/5 * * * *" }

4. Verify

curl https://www.datarebel.io/ready
curl https://www.datarebel.io/.well-known/datarebel.json
curl -s https://www.datarebel.io/llms.txt | head

Then point an MCP client at https://www.datarebel.io/v1/mcp (consume) or https://www.datarebel.io/v1/mcp/contribute with an agent key from the dashboard.

Local: vercel dev runs both services behind the same rewrites.

Limits to keep in mind

  • Function duration is 60 s (vercel.json); very large exports should use the container deployment.
  • Each instance keeps a small connection pool (2); rely on the provider's pooler.
  • Rate limiting is per instance unless REDIS_URL is set.
  • The container deployment (Docker Compose) uses the same single-domain layout through its reverse proxy (infrastructure/deployment/Caddyfile) and is unaffected by vercel.json.
Deploying to Vercel · DataRebel