SurfSenseSurfSense Docs
Docker Installation

Docker Compose

Manual Docker Compose setup for SurfSense

Setup

git clone https://github.com/MODSetter/SurfSense.git
cd SurfSense/docker
cp .env.example .env
# Edit .env, at minimum set SECRET_KEY
docker compose up -d

After starting, access SurfSense at:


Configuration

All configuration lives in a single docker/.env file (or surfsense/.env if you used the install script). Copy .env.example to .env and edit the values you need.

Required

VariableDescription
SECRET_KEYJWT secret key. Generate with: openssl rand -base64 32. Auto-generated by the install script.

Core Settings

VariableDescriptionDefault
SURFSENSE_VERSIONImage tag to deploy. Use latest, a clean version (e.g. 0.0.14), or a specific build (e.g. 0.0.14.1)latest
AUTH_TYPEAuthentication method: LOCAL (email/password) or GOOGLE (OAuth)LOCAL
ETL_SERVICEDocument parsing: DOCLING (local), UNSTRUCTURED, or LLAMACLOUDDOCLING
EMBEDDING_MODELEmbedding model for vector searchsentence-transformers/all-MiniLM-L6-v2
TTS_SERVICEText-to-speech provider for podcastslocal/kokoro
STT_SERVICESpeech-to-text provider for audio fileslocal/base
REGISTRATION_ENABLEDAllow new user registrationsTRUE

Ports

VariableDescriptionDefault
FRONTEND_PORTFrontend service port3929
BACKEND_PORTBackend API service port8929
ELECTRIC_PORTElectric SQL service port5929

Custom Domain / Reverse Proxy

Only set these if serving SurfSense on a real domain via a reverse proxy (Caddy, Nginx, Cloudflare Tunnel, etc.). Leave commented out for standard localhost deployments.

VariableDescription
NEXT_FRONTEND_URLPublic frontend URL (e.g. https://app.yourdomain.com)
BACKEND_URLPublic backend URL for OAuth callbacks (e.g. https://api.yourdomain.com)
NEXT_PUBLIC_FASTAPI_BACKEND_URLBackend URL used by the frontend (e.g. https://api.yourdomain.com)
NEXT_PUBLIC_ELECTRIC_URLElectric SQL URL used by the frontend (e.g. https://electric.yourdomain.com)

Database

Defaults work out of the box. Change for security in production.

VariableDescriptionDefault
DB_USERPostgreSQL usernamesurfsense
DB_PASSWORDPostgreSQL passwordsurfsense
DB_NAMEPostgreSQL database namesurfsense
DB_HOSTPostgreSQL hostdb
DB_PORTPostgreSQL port5432
DB_SSLMODESSL mode: disable, require, verify-ca, verify-fulldisable
DATABASE_URLFull connection URL override. Use for managed databases (RDS, Supabase, etc.)(built from above)

Electric SQL

VariableDescriptionDefault
ELECTRIC_DB_USERReplication user for Electric SQLelectric
ELECTRIC_DB_PASSWORDReplication password for Electric SQLelectric_password
ELECTRIC_DATABASE_URLFull connection URL override for Electric. Set to host.docker.internal when pointing at a local Postgres instance(built from above)

Authentication

VariableDescription
GOOGLE_OAUTH_CLIENT_IDGoogle OAuth client ID (required if AUTH_TYPE=GOOGLE)
GOOGLE_OAUTH_CLIENT_SECRETGoogle OAuth client secret (required if AUTH_TYPE=GOOGLE)

Create credentials at the Google Cloud Console.

External API Keys

VariableDescription
FIRECRAWL_API_KEYFirecrawl API key for web crawling
UNSTRUCTURED_API_KEYUnstructured.io API key (required if ETL_SERVICE=UNSTRUCTURED)
LLAMA_CLOUD_API_KEYLlamaCloud API key (required if ETL_SERVICE=LLAMACLOUD)

Connector OAuth Keys

Uncomment the connectors you want to use. Redirect URIs follow the pattern http://localhost:8000/api/v1/auth/<connector>/connector/callback.

ConnectorVariables
Google Drive / Gmail / CalendarGOOGLE_DRIVE_REDIRECT_URI, GOOGLE_GMAIL_REDIRECT_URI, GOOGLE_CALENDAR_REDIRECT_URI
NotionNOTION_CLIENT_ID, NOTION_CLIENT_SECRET, NOTION_REDIRECT_URI
SlackSLACK_CLIENT_ID, SLACK_CLIENT_SECRET, SLACK_REDIRECT_URI
DiscordDISCORD_CLIENT_ID, DISCORD_CLIENT_SECRET, DISCORD_BOT_TOKEN, DISCORD_REDIRECT_URI
Jira & ConfluenceATLASSIAN_CLIENT_ID, ATLASSIAN_CLIENT_SECRET, JIRA_REDIRECT_URI, CONFLUENCE_REDIRECT_URI
LinearLINEAR_CLIENT_ID, LINEAR_CLIENT_SECRET, LINEAR_REDIRECT_URI
ClickUpCLICKUP_CLIENT_ID, CLICKUP_CLIENT_SECRET, CLICKUP_REDIRECT_URI
AirtableAIRTABLE_CLIENT_ID, AIRTABLE_CLIENT_SECRET, AIRTABLE_REDIRECT_URI
Microsoft TeamsTEAMS_CLIENT_ID, TEAMS_CLIENT_SECRET, TEAMS_REDIRECT_URI

Observability (optional)

VariableDescription
LANGSMITH_TRACINGEnable LangSmith tracing (true / false)
LANGSMITH_ENDPOINTLangSmith API endpoint
LANGSMITH_API_KEYLangSmith API key
LANGSMITH_PROJECTLangSmith project name

Advanced (optional)

VariableDescriptionDefault
SCHEDULE_CHECKER_INTERVALHow often to check for scheduled connector tasks (e.g. 5m, 1h)5m
RERANKERS_ENABLEDEnable document reranking for improved searchFALSE
RERANKERS_MODEL_NAMEReranker model name (e.g. ms-marco-MiniLM-L-12-v2)
RERANKERS_MODEL_TYPEReranker model type (e.g. flashrank)
PAGES_LIMITMax pages per user for ETL servicesunlimited

Docker Services

ServiceDescription
dbPostgreSQL with pgvector extension
redisMessage broker for Celery
backendFastAPI application server
celery_workerBackground task processing (document indexing, etc.)
celery_beatPeriodic task scheduler (connector sync)
electricElectric SQL (real-time sync for the frontend)
frontendNext.js web application

All services start automatically with docker compose up -d.

The backend includes a health check. Dependent services (workers, frontend) wait until the API is fully ready before starting. You can monitor startup progress with docker compose ps (look for (health: starting)(healthy)).


Useful Commands

# View logs (all services)
docker compose logs -f

# View logs for a specific service
docker compose logs -f backend
docker compose logs -f electric

# Stop all services
docker compose down

# Restart a specific service
docker compose restart backend

# Stop and remove all containers + volumes (destructive!)
docker compose down -v

Troubleshooting

  • Ports already in use: Change the relevant *_PORT variable in .env and restart.
  • Permission errors on Linux: You may need to prefix docker commands with sudo.
  • Electric SQL not connecting: Check docker compose logs electric. If it shows domain does not exist: db, ensure ELECTRIC_DATABASE_URL is not set to a stale value in .env.
  • Real-time updates not working in browser: Open DevTools → Console and look for [Electric] errors. Check that NEXT_PUBLIC_ELECTRIC_URL matches the running Electric SQL address.
  • Line ending issues on Windows: Run git config --global core.autocrlf true before cloning.

On this page