Repository navigation
Expand file tree
/
Copy path.env.example
More file actions
269 lines (243 loc) · 13.7 KB
/
Copy path.env.example
File metadata and controls
269 lines (243 loc) · 13.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# ═══════════════════════════════════════════════════════
# Deft — Environment Configuration
# Copy this to .env and fill in your values.
#
# Required for Docker first boot: POSTGRES_PASSWORD, JWT_SECRET, JWT_REFRESH_SECRET, ENCRYPTION_KEY
# AI features need at least one provider key (see section 3) or per-org BYOK.
# Everything else is optional unless noted.
# ═══════════════════════════════════════════════════════
# ── 1. Database ───────────────────────────────────────
# REQUIRED. Password the docker-compose stack uses and Deft authenticates with.
# NEVER ship 'postgres' or any common password in production — port 5432 is the
# most-scanned port on the internet. Generate with: openssl rand -hex 32
POSTGRES_PASSWORD=
# DATABASE_URL only matters when running Deft against external Postgres (not
# the bundled compose stack). With the compose stack:
# - Inside containers: docker-compose.yml builds DATABASE_URL from POSTGRES_PASSWORD.
# - Host-side (pnpm db:push, pnpm db:seed): the scripts do the same fallback
# when DATABASE_URL is unset or still carries the CHANGE_ME placeholder.
# Uncomment and fill in only when pointing at an external database.
# DATABASE_URL=postgres://user:password@host:5432/deft
# Optional. A Postgres connection keeps the memory it used until it closes, so
# the API closes each pooled connection once it is this many seconds old (when
# next idle, never mid-request; 30 to 86400) and one idle this long (1 to 3600).
# DEFT_DATABASE_POOL_MAX_LIFETIME_SECONDS=300
# DEFT_DATABASE_POOL_IDLE_TIMEOUT_SECONDS=10
# ── 2. Auth secrets ───────────────────────────────────
# Both REQUIRED. Generate each with: openssl rand -hex 32
# Production: distinct, non-template keys of at least 32 characters; no surrounding whitespace.
JWT_SECRET=change-me-to-a-random-string
JWT_REFRESH_SECRET=change-me-to-another-random-string
# Symmetric key for encrypting per-org BYOK API keys at rest in orgs.ai_config.
# Docker runs in production mode, including local evaluation. REQUIRED: a unique,
# non-placeholder value of at least 32 characters. Generate: openssl rand -hex 32
ENCRYPTION_KEY=CHANGE_ME_WITH_AT_LEAST_32_RANDOM_CHARACTERS
# Hosted service only — leave all of these unset on a self-hosted install.
# DEFT_HOSTED=true marks this install as one customer's cell on the hosted
# Deft service. The first signup must then carry the one-time setup token from
# the buyer's setup link (/signup#setup=<token>). The cell holds only the
# token's SHA-256 hash (64 lowercase hex characters) and an expiry time
# (ISO 8601 with a zone); the token itself is never stored here. With
# DEFT_HOSTED=true and no hash, signup is refused. Hash a token with:
# printf '%s' "$TOKEN" | sha256sum | cut -d' ' -f1
# The API refuses to start if DEFT_HOSTED is set to anything but exactly true
# or false, or if any setting in this section is present without DEFT_HOSTED=true.
# DEFT_HOSTED=true
# DEFT_SETUP_TOKEN_SHA256=
# DEFT_SETUP_TOKEN_EXPIRES_AT=2026-12-04T10:00:00Z
#
# Seats: a hosted cell fetches a signed seat statement from the control plane
# and refuses to add people beyond its paid seats (guests and agents do not
# count). With DEFT_HOSTED=true the API refuses to start unless all four are
# set and usable; a hosted cell that has no valid statement adds nobody, and
# nobody is ever removed.
# DEFT_CELL_ID=
# Comma-separated Ed25519 public keys (base64url, 43 characters each).
# DEFT_SEAT_PUBLIC_KEYS=
# https only; fetched with GET and the bearer token below.
# DEFT_SEAT_STATEMENT_URL=
# DEFT_SEAT_FETCH_TOKEN=
# Optional: the control plane's page where an owner buys more seats (https
# only). When set, owners see a "Buy more seats" link; when unset, nobody does.
# DEFT_HOSTED_SEATS_URL=
# ── 3. AI provider keys (optional fallbacks) ──────────
# Per-org BYOK is the recommended path — admins paste keys in Settings → AI.
# These env values are used as fallbacks when an org hasn't configured its own.
# The app boots without any key; AI features stay disabled until at least one
# provider is configured (env or org).
ANTHROPIC_API_KEY=
# OpenAI: used by the agent (when an org picks OpenAI), embeddings (semantic
# search), and OpenAI Whisper transcription.
OPENAI_API_KEY=
# OpenRouter: one key, many models. Used when an org picks OpenRouter.
OPENROUTER_API_KEY=
# Self-hosted Ollama. Uncomment only when an Ollama server is actually running;
# otherwise fresh installs should correctly show AI features as off.
# OLLAMA_URL=http://localhost:11434
# ── 3a. Voice transcription (optional) ────────────────
# Default: 'local' — calls a Whisper container on $WHISPER_URL.
# Spin one up with:
# docker run -d -p 9000:9000 --name deft-whisper \
# onerahmet/openai-whisper-asr-webservice:latest-cpu
# Set TRANSCRIPTION_PROVIDER=openai (uses OPENAI_API_KEY) or 'deepgram' for
# managed alternatives. Org-level config in Settings → AI takes precedence.
# TRANSCRIPTION_PROVIDER=local
# WHISPER_URL=http://localhost:9000
DEEPGRAM_API_KEY=
# ── 4. URLs & ports ───────────────────────────────────
# Change when deploying behind a custom domain or reverse proxy.
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_WS_URL=http://localhost:3001
NEXT_PUBLIC_APP_URL=http://localhost:3000
# IP rate limits (all of them, Apps included, not only invites):
# comma-separated exact proxy IPs or DNS names.
# Leave unset for direct API access. The bundled Caddy overlay sets "caddy".
# DEFT_INVITE_TRUSTED_PROXIES=
# Build-time UI availability flag for self-host-only controls such as stdio
# connector fields. This does not enable stdio execution or grant App access.
NEXT_PUBLIC_DEFT_SELF_HOSTED=true
# Required when a public server runs modified code; use the exact Corresponding Source.
DEFT_SOURCE_CODE_URL=
# Source builds keep experimental voice huddles opt-in and bake this value into
# the web bundle. Official prebuilt release images explicitly enable them.
NEXT_PUBLIC_FEATURE_HUDDLES=false
# Build-time opt-in: standalone web app manifest, square icons and iPhone install hint.
NEXT_PUBLIC_FEATURE_WEB_APP_INSTALL=false
# ── 4a. Telemetry and help ─────────────────────────────
# Self-hosted Deft sends one anonymous ping to https://get.deft.ing when the
# workspace is created and each time someone joins: an install ID, the event,
# the version and the time. No names, emails or content. Nothing else is sent.
# Set DEFT_TELEMETRY=off to turn it off (see docs/self-hosting.md, "Telemetry").
# DEFT_TELEMETRY=off
# Optional: an address your people can write to for help ("Get help" in the
# user menu). Nothing is sent anywhere.
# DEFT_SUPPORT_EMAIL=
# ── Apps (all off by default; a flag is on only when exactly "true") ──
# Core install: leave every flag below false. See docs/self-hosting.md,
# "Apps feature flags", for the full checklist.
#
# Browser build flags. Build-time only: they are compiled into the web bundle,
# so changing them needs a rebuild or a published image built with them.
NEXT_PUBLIC_FEATURE_APPS=false
# Build-time only. Requires NEXT_PUBLIC_FEATURE_APPS.
NEXT_PUBLIC_FEATURE_APP_RESOURCE_SYNC=false
# Build-time only. Requires NEXT_PUBLIC_FEATURE_APP_RESOURCE_SYNC.
NEXT_PUBLIC_FEATURE_APP_ATTACHMENT_BROKER=false
# Build-time only. Requires NEXT_PUBLIC_FEATURE_APP_RESOURCE_SYNC.
NEXT_PUBLIC_FEATURE_APP_PRIVATE_SHARING=false
# Build-time only. Requires NEXT_PUBLIC_FEATURE_APP_PRIVATE_SHARING.
NEXT_PUBLIC_FEATURE_APP_PRIVATE_MCP=false
# Build-time only. Has no effect in this release.
NEXT_PUBLIC_FEATURE_APP_PRIVATE_DEFTY=false
#
# Server flags, in dependency order.
# Apps API.
DEFT_APPS_ENABLED=false
# Requires DEFT_APPS_ENABLED.
DEFT_APP_DEVELOPER_PAIRING_ENABLED=false
# Needs DEFT_APP_RUN_KEYRINGS (below); startup fails without a valid one.
DEFT_APP_RUNS_ENABLED=false
# Single-line JSON; generation command is in docs/self-hosting.md.
DEFT_APP_RUN_KEYRINGS=
# Requires DEFT_APPS_ENABLED and DEFT_APP_RUNS_ENABLED; startup fails otherwise.
DEFT_APP_RUN_APP_ORIGIN_ENABLED=false
# Requires DEFT_APP_RUNS_ENABLED; startup fails otherwise.
DEFT_APP_RUN_LEGACY_MCP_CUTOVER_ENABLED=false
# Requires Apps, Runs and App-origin; startup fails otherwise.
DEFT_APP_AUTOMATIONS_ENABLED=false
# Requires Runs and App-origin.
DEFT_APP_RUNTIME_CHANNEL_ENABLED=false
# Requires DEFT_APP_RUNTIME_CHANNEL_ENABLED.
DEFT_APP_V5_RUNTIME_ACTIONS_ENABLED=false
# Requires Apps, Runs and App-origin.
DEFT_APP_NATIVE_CALENDAR_ENABLED=false
# Requires Apps, Runs and App-origin.
DEFT_APP_RESOURCE_SYNC_CHANNEL_ENABLED=false
# Requires DEFT_APP_RESOURCE_SYNC_CHANNEL_ENABLED.
DEFT_APP_RESOURCE_SYNC_SCHEDULER_ENABLED=false
# Requires DEFT_APP_RESOURCE_SYNC_CHANNEL_ENABLED.
DEFT_APP_EXPERIENCE_RESOURCE_EXPOSURE_ENABLED=false
# Requires DEFT_APP_EXPERIENCE_RESOURCE_EXPOSURE_ENABLED.
DEFT_APP_PRIVATE_STATE_ENABLED=false
# Requires DEFT_APP_RESOURCE_SYNC_CHANNEL_ENABLED.
DEFT_APP_ATTACHMENT_BROKER_ENABLED=false
# Requires DEFT_APP_ATTACHMENT_BROKER_ENABLED.
DEFT_APP_OWNER_CONNECTIONS_ENABLED=false
# Requires DEFT_APP_RESOURCE_SYNC_CHANNEL_ENABLED.
DEFT_APP_PRIVATE_SHARING_ENABLED=false
# Requires DEFT_APP_PRIVATE_SHARING_ENABLED.
DEFT_APP_PRIVATE_MCP_ENABLED=false
# Requires DEFT_APP_RESOURCE_SYNC_CHANNEL_ENABLED.
DEFT_APP_PRIVATE_DEFTY_ENABLED=false
# Requires DEFT_APPS_ENABLED. Mounts /api/public/apps.
# DEFT_APP_PUBLIC_INGRESS_ENABLED=false
API_PORT=3001
# MCP connector network policy. HTTPS public origins are the default.
# Self-host operators may allowlist exact private/insecure origins (no wildcards).
DEFT_MCP_PRIVATE_ORIGIN_ALLOWLIST=
# Stdio is host-code execution: DEFT_SELF_HOSTED plus this opt-in and an exact
# command list are required. The public UI flag above does not satisfy them.
DEFT_SELF_HOSTED=true
DEFT_MCP_ENABLE_UNSAFE_STDIO=false
MCP_STDIO_ALLOWED_COMMANDS=
# Internal calendar feeds (self-hosted only; ignored unless DEFT_SELF_HOSTED is
# exactly true). JSON array of exact feed URLs, e.g.
# ["http://radicale.lan:5232/team/work.ics"]. Every account that knows a listed
# URL (members and guests) can have the server fetch that exact URL repeatedly
# and import its events. List only read-only feed URLs and update an entry when
# its feed token rotates. A malformed value disables the list.
DEFT_CALENDAR_PRIVATE_URL_ALLOWLIST=
# Optional Docker host port overrides. The app still listens on 3000/3001
# inside the container; these control the host-side published ports.
DEFT_WEB_PORT=3000
DEFT_API_PORT=3001
DEFT_BIND_HOST=127.0.0.1
DEFT_POSTGRES_PORT=5432
# Optional local-only helper for heavy audit/certification runs.
# When set outside production, requests with x-deft-audit-token matching this
# value bypass API rate-limit middleware. Leave unset in normal dev and prod.
DEFT_AUDIT_BYPASS_TOKEN=
# ── 5. File storage ───────────────────────────────────
# Default: local filesystem at ./uploads (persisted via Docker volume).
# For Cloudflare R2, uncomment and fill in all four vars:
# R2_ENDPOINT=
# R2_ACCESS_KEY=
# R2_SECRET_KEY=
# R2_BUCKET=deft-uploads
# GitHub sync schedule (optional)
# Minutes between scheduled syncs of each connected GitHub account (merged
# pull requests move their referenced tasks to Done). 0 or off disables the
# schedule; the manual Sync button still works.
DEFT_GITHUB_SYNC_INTERVAL_MIN=10
# Section 6. Metrics scrape token (optional)
# Static bearer token Prometheus / Grafana Agent sends to GET /api/metrics and
# operators send to GET /health/queue for detailed queue telemetry.
# Leave unset to disable both detailed telemetry endpoints (returns 503).
# Generate with: openssl rand -hex 32
METRICS_SCRAPE_TOKEN=
# ── 7. Browser notifications (optional) ───────────────
# Generate once with: pnpm --filter @deft/api exec web-push generate-vapid-keys
# Keep this keypair stable; rotating it invalidates browser subscriptions.
VAPID_PUBLIC_KEY=
VAPID_PRIVATE_KEY=
VAPID_SUBJECT=mailto:admin@example.com
# Opt in to sender + up to 100 characters of readable chat text on lock screens.
# Existing subscribers keep generic text when false; non-chat pushes stay generic.
PUSH_MESSAGE_PREVIEWS_ENABLED=false
# Paused start: set to exactly true to start read-only (after a restore or
# upgrade). No scheduler, no background jobs, no startup recovery work, and no
# outbound call from this process (AI and embedding providers, transcription,
# outside tool servers, the App Runtime, URL and calendar fetches, web push).
# The agent channel and calendar feeds are closed; every other change except
# login, refresh and logout gets 503 PAUSED. Any value other than exactly true
# or false refuses to start. /health and /health/ready answer 200 with
# "paused": true so an operator can reach the copy: a load balancer must check
# that field and must not treat a paused copy as serving. Leave unset normally.
# Private onboarding bookkeeping stays open. Realtime connections and reads
# that mutate shared state are refused. The deployment must also stop the
# separate Email helper process and block egress before restoring a cell.
# DEFT_PAUSED_START=true
# Why it is paused, shown to signed-in people in a banner: restore_review
# (the default when unset), billing (payment overdue) or emergency_stop (the
# hosted service stopped outgoing activity). Any other value refuses to start.
# DEFT_PAUSED_REASON=restore_review