Skip to content

AI-powered virtual executive team — a single coherent executive persona backed by 8 specialist agents (FastAPI + Next.js).

fix: bridge repo-root .env into the UI for make dev and docker compose

Claudef9951e421eb8
diff --git a/.env.example b/.env.example
index 3eb53743..01cdee50 100644
--- a/.env.example
+++ b/.env.example
@@ -12,15 +12,17 @@ ANTHROPIC_API_KEY=sk-ant-your-key-here
# ALLOWED_EMAILS = comma-separated list of Google-account emails permitted to
# sign in. Other emails (even with a valid Google login) are rejected.
# AUTH_TRUST_HOST = "true" is required when running behind a reverse proxy.
-# AUTH_URL = public origin of the UI. Required on Fly; AUTH_TRUST_HOST alone
+# AUTH_URL = public origin of the UI. LEAVE BLANK for local dev (localhost is
+# inferred). Required on Fly / any public deployment; AUTH_TRUST_HOST alone
# isn't enough — without AUTH_URL the post-callback redirect lands on the
-# container's bind address (0.0.0.0) instead of the public hostname.
+# container's bind address (0.0.0.0) instead of the public hostname,
+# e.g. AUTH_URL=https://your-ui-app.fly.dev
AUTH_SECRET=
AUTH_GOOGLE_ID=
AUTH_GOOGLE_SECRET=
AUTH_TRUST_HOST=true
-AUTH_URL=https://openexec-ui-dev.fly.dev
+AUTH_URL=
# Shared secret between the Next.js proxy and the FastAPI backend. The UI
# attaches this as `x-api-key`; the API requires it on every non-exempt
diff --git a/Makefile b/Makefile
index 74170f7f..678ec80b 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,10 @@ install:
dev:
@echo "Starting Open Executive..."
@cd packages/core && uv run uvicorn openexecutive.api.main:app --reload --port 8000 &
- @cd packages/ui && npm run dev
+ @# Export the repo-root .env into the UI process: Next.js only auto-loads
+ @# packages/ui/.env*, so without this Auth.js never sees AUTH_SECRET etc.
+ @# (issue #44). packages/ui/.env.local still works and takes precedence.
+ @if [ -f .env ]; then set -a; . ./.env; set +a; fi; cd packages/ui && npm run dev
stop:
@lsof -ti :8000 -ti :3000 2>/dev/null | xargs kill -9 2>/dev/null || true
@@ -24,11 +27,16 @@ eval:
--scenarios ../../evals/scenarios/ \
--output ../../evals/results/
+# --env-file makes ${VAR} interpolation in docker-compose.yml read the
+# repo-root .env (compose only auto-reads docker/.env otherwise). The
+# containers additionally load the full .env via each service's env_file.
+COMPOSE_ENV_FILE := $(if $(wildcard .env),--env-file .env,)
+
docker:
- docker compose -f docker/docker-compose.yml up --build
+ docker compose $(COMPOSE_ENV_FILE) -f docker/docker-compose.yml up --build
docker-down:
- docker compose -f docker/docker-compose.yml down
+ docker compose $(COMPOSE_ENV_FILE) -f docker/docker-compose.yml down
clean:
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
diff --git a/README.md b/README.md
index f945ec67..1a8876c0 100644
--- a/README.md
+++ b/README.md
@@ -108,11 +108,18 @@ cd OpenExecutive
# Set your Anthropic API key
cp .env.example .env
# Edit .env and add ANTHROPIC_API_KEY=sk-ant-...
+# For the web UI's Google sign-in, also fill in the AUTH_* block
+# (see docs/auth.md for the Google Cloud Console steps).
# Start everything
make dev
```
+All configuration lives in that repo-root `.env` — `make dev` and `make docker`
+both load it for the API *and* the UI (Auth.js needs `AUTH_SECRET` /
+`AUTH_GOOGLE_ID` / `AUTH_GOOGLE_SECRET` at runtime). A
+`packages/ui/.env.local` is also supported and overrides the root file.
+
Open http://localhost:3000 to start chatting with your executive. The API runs on port 8000 and the UI on 3000.
> **First run:** requires Python 3.11+ and Node 22+. The initial `uv sync` pulls heavy
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index de3f8851..728b4608 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -3,10 +3,20 @@ services:
build:
context: ..
dockerfile: docker/Dockerfile
+ # Load the full repo-root .env (the file README's quickstart has you
+ # create) into the container: model providers, integrations, auth, etc.
+ # `required: false` keeps shell-export-only setups working without one.
+ # NOTE: anything listed under `environment:` below SHADOWS the same key
+ # from this env_file — don't add a key in both places.
+ env_file:
+ - path: ../.env
+ required: false
ports:
- "8000:8000"
environment:
- - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
+ # ${VAR} interpolation resolves from the shell, or from the repo-root
+ # .env when invoked as `make docker` (the Makefile passes --env-file).
+ - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
- VECTOR_STORE_PATH=/data/chroma_db
- COMPANY_PROFILE_PATH=/data/company/profile.yaml
- EPISODIC_DB_PATH=/data/episodic_memory.db
@@ -28,6 +38,13 @@ services:
image: node:22-alpine
working_dir: /app
command: sh -c "npm install && npm run dev"
+ # Auth.js reads AUTH_SECRET / AUTH_GOOGLE_ID / AUTH_GOOGLE_SECRET (and
+ # ALLOWED_EMAILS, BACKEND_SHARED_SECRET, ...) from process.env — without
+ # this env_file the sign-in flow fails with [auth] MissingSecret because
+ # the root .env never reached the UI container (issue #44).
+ env_file:
+ - path: ../.env
+ required: false
ports:
- "3000:3000"
volumes:
@@ -37,6 +54,7 @@ services:
- NODE_ENV=development
# Reach the API over the compose network (the UI proxy/auth default of
# localhost:8000 resolves to the UI container itself, not the API).
+ # Deliberately overrides any BACKEND_BASE_URL from the root .env.
- BACKEND_BASE_URL=http://api:8000
depends_on:
- api
diff --git a/docs/auth.md b/docs/auth.md
index 442a441a..805537a2 100644
--- a/docs/auth.md
+++ b/docs/auth.md
@@ -53,27 +53,31 @@ See [`_UNAUTHENTICATED_PATHS`](../packages/core/openexecutive/api/main.py) — a
- **Authorized redirect URIs**: `http://localhost:3000/api/auth/callback/google`, `https://openexec-ui-dev.fly.dev/api/auth/callback/google`
4. Copy the Client ID and Client secret immediately — the secret is shown only once.
-### Local dev (`packages/ui/.env.local`, gitignored)
+### Local dev (repo-root `.env`, gitignored)
+
+Put everything in the repo-root `.env` (the file the README quickstart has you
+create from `.env.example`). Both `make dev` and `make docker` load it into the
+API **and** the UI:
```bash
AUTH_GOOGLE_ID=<from google>
AUTH_GOOGLE_SECRET=<from google>
AUTH_SECRET=$(openssl rand -base64 32)
AUTH_TRUST_HOST=true
+# AUTH_URL stays blank for local dev — set it only on public deployments.
-BACKEND_BASE_URL=http://localhost:8000
BACKEND_SHARED_SECRET=$(openssl rand -hex 32)
-```
-
-And in `packages/core/.env` (also gitignored):
-
-```bash
ANTHROPIC_API_KEY=sk-ant-...
-BACKEND_SHARED_SECRET=<same value as in packages/ui/.env.local>
```
Then `make dev` and visit http://localhost:3000.
+A `packages/ui/.env.local` (also gitignored) still works and **overrides** the
+root `.env` for the UI — useful if you want UI-only overrides such as
+`BACKEND_BASE_URL=http://localhost:8000`. Note that plain `npm run dev` in
+`packages/ui` (without `make dev`) only reads `packages/ui/.env*`, not the
+root `.env`.
+
### Production (Fly secrets)
```bash