Unearth DocsUnearth Docs

Installation

Configuration

Configure origins, storage, authentication, AI, email, and optional research providers for your installation.

The production Compose file reads .env.production through the --env-file argument. Keep this file private and out of Git. After changing values, recreate the affected services using the same Compose command.

Required settings

SettingPurpose
POSTGRES_USER, POSTGRES_DB, POSTGRES_PASSWORDCredentials for bundled PostgreSQL
DATABASE_URLDatabase URL using the same credentials and Compose host postgres:5432
REDIS_PASSWORD, REDIS_URLRedis password and matching URL using Compose host redis:6379
BETTER_AUTH_SECRETUnique authentication signing secret of at least 32 characters
API_BASE_URLPublic HTTPS API origin, such as https://api.example.com
WEB_ORIGINPublic HTTPS application origin, such as https://app.example.com
RESEARCH_CHAT_MODERequired AI mode: openai or gateway
AI_MODELModel available to your account; Gateway uses provider/model-id
OPENAI_API_KEY or AI_GATEWAY_API_KEYCredentials for the selected AI mode
EMAIL_DELIVERY_MODERequired production email mode: smtp or resend
EMAIL_FROMSender authorized by your email provider
SMTP_HOST or RESEND_API_KEYSelected transport credentials; SMTP can also require port, TLS, username, and password

The API rejects missing AI configuration and incomplete production email configuration. These checks establish that settings are present; they do not verify provider credentials, quota, billing, or email deliverability.

Origins and cookies

For sibling app and API hostnames, set AUTH_COOKIE_DOMAIN to the shared parent domain, for example example.com. For a single public HTTPS origin, set WEB_ORIGIN and API_BASE_URL to that origin and omit AUTH_COOKIE_DOMAIN.

For same-origin routing, send /trpc and application /api/ requests to the API. Route the following exceptions to the web service before the general API rule:

  • /api/avatar and /api/avatar/**
  • /api/health and /api/health/ready
  • /api/ready

Send other pages and assets to the web service. The production Compose file sets the internal server API URL and the public browser API URL separately.

Proxy trust

Forwarded client IPs are ignored by default. Set API_TRUSTED_PROXY_CIDRS only to actual ingress peer addresses and configure the proxy to sanitize forwarded headers. Alternatively, API_TRUSTED_INGRESS=true supports isolated ingress that always overwrites X-Real-IP. Do not enable both modes.

Optional capabilities

CapabilitySettings
Live web researchRESEARCH_WEB_SEARCH_MODE=firecrawl, FIRECRAWL_API_KEY
Property listingsRESEARCH_LISTING_SEARCH_MODE=rentcast, RENTCAST_API_KEY
Property recordsRESEARCH_PROPERTY_INTELLIGENCE_MODE=rentcast, RENTCAST_API_KEY
Connected appsCOMPOSIO_API_KEY and authorization by each user
Google sign-inGOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET; production email is still required
Queue isolationQUEUE_PREFIX, shared by the API and worker
Automated ingestionINGESTION_AUTOMATION_SCOPE_PROFILE_KEY and the source-specific settings for that scope

A provider key alone does not enable a research mode. Set both the mode and its credentials. Self-hosted mode disables Unearth plan and credit limits; external provider charges and quotas still apply.

Managed PostgreSQL and Redis

The runtime accepts provider-neutral PostgreSQL and Redis URLs. The supplied production Compose file includes both services and depends on their health checks. To use managed services, adapt those service dependencies and pass URLs reachable from the containers. Changing a URL alone does not remove the bundled services from the Compose topology.

For a pooled database connection, configure a direct migration connection when required. See database migrations.

For all supported settings, consult the application environment example and README.

Unearth DocsUnearth Docs

Search documentation

8 pages to explore

Guide / Get startedResearch with the source in viewFind properties, research owners, and compare markets with Unearth. Start with the product or run your own installation.Guide / Get startedResearch with UnearthAsk focused questions, inspect the evidence, and build on results in your workspace.Self-hosting / InstallationInstall with Docker ComposeBuild and run the web app, API, worker, PostgreSQL, Redis, and database migrations on your own host.Self-hosting / InstallationConfigurationConfigure origins, storage, authentication, AI, email, and optional research providers for your installation.Self-hosting / OperationsDatabase migrationsApply pending schema changes before starting a new application release.Self-hosting / OperationsData ingestionEnable automated acquisition and publication for the datasets and geographic coverage your installation needs.Project / About UnearthArchitectureUnderstand the boundary between the public website, documentation, and application runtime.Project / About UnearthProject statusCurrent implementation boundaries, public-release preparation, and planned integrations.