Deployment
Deployment
Environments
| Environment | URL | Branch | Database | Storage |
|---|---|---|---|---|
| Production | datahub.io | main | datahub-cloud (Neon) | datahub-cloud (R2) |
| Staging | staging-cloud.datahub.io | staging | datahub-cloud-staging (Neon) | datahub-cloud-staging (R2) |
| Preview | *.vercel.app | PR branches | staging DB | staging storage |
Deployment Pipeline
Deployments are managed by Vercel:
- PR Preview: Every PR gets an automatic Vercel preview deployment using the staging database/storage.
- Staging: Merging to
stagingdeploys to the staging environment. - Production: Rebasing
stagingontomaindeploys to production.
The build command (pnpm build) runs Prisma migrations automatically:
prisma migrate deploy && prisma generate && next build
Infrastructure
Databases
PostgreSQL hosted on Neon (via Vercel integration):
- Production:
datahub-cloud - Staging:
datahub-cloud-staging - Development: Local PostgreSQL via Docker (see DEVELOP.md)
Content Storage
Cloudflare R2 buckets:
- Production:
datahub-cloud - Staging:
datahub-cloud-staging - Development: Local MinIO via Docker (see DEVELOP.md)
Authentication
GitHub OAuth applications (under Datopian account):
- Production:
DataHub Cloud - Staging:
DataHub Cloud - Staging - Development:
DataHub Cloud - Dev
Domain Configuration
Root Domain (datahub.io)
All routes are served by this single Next.js app. The middleware (middleware.ts) handles routing:
- Landing pages (
/,/pricing,/collections,/solutions,/publish) are rewritten toapp/home/* /@usernamepaths are rewritten toapp/user/*/<publication>/<post>paths route toapp/[publication]/[post]/*/dashboardand/loginhave auth guards- Custom domains are rewritten to
/_domain={hostname}/*
Subdomains
- Production:
datahub.io - Staging:
staging-datahub.io(orstaging-cloud.datahub.io)
Background Jobs (Inngest)
- Production/Staging: Inngest Cloud (https://app.inngest.com, invite required)
- Development: Local Inngest dev server via
make dev
Cloudflare Worker (content processing)
A separate Cloudflare Worker processes markdown uploads:
- Repo:
datahub-cloudflare-workers - Deployed independently to Cloudflare
- Consumes R2 queue events (prod/staging) or MinIO webhooks (dev)
- See ARCHITECTURE.md for details
Environment Variables
Production and staging environment variables are configured in Vercel project settings.
Required variables (see .env.example for full list):
POSTGRES_PRISMA_URL/POSTGRES_URL_NON_POOLING- Database connectionsNEXTAUTH_SECRET- Session encryption keyNEXT_PUBLIC_AUTH_GITHUB_ID/AUTH_GITHUB_SECRET- GitHub OAuthS3_*variables - R2 storage configurationGH_ACCESS_TOKEN/GH_WEBHOOK_SECRET- GitHub integrationINNGEST_APP_ID- Inngest configurationNEXT_PUBLIC_ROOT_DOMAIN/NEXT_PUBLIC_CLOUD_DOMAIN- Domain configuration
CI/CD
GitHub Actions workflows (.github/workflows/):
| Workflow | Trigger | Description |
|---|---|---|
e2e.yml | PR to main/staging, push to staging | E2E tests against Vercel preview deployment |
lint.yml | PR to main/staging, push to staging | ESLint checks |
unit.yml | PR to main/staging, push to main | Jest unit tests |
sync-ga-views.yml | Scheduled (daily) | Sync Google Analytics view counts |