Ecbot Docs
Developers

Configuration

Every Ecbot app reads its settings from a .env file. This page lists the files, the variables that matter, and what pnpm setup:local fills in for you.

Each app in the repository reads its settings from its own .env file: apps/api/.env, apps/app/.env and apps/ai/.env. Each has a commented .env.example next to it. Run pnpm setup:local to create the files and fill every value that only has to be consistent between apps; you then add the keys only you can get.

pnpm setup:local

FlagWhat it does
(none)Creates missing .env files, fills generated values, and prompts for the keys you must supply.
--yesAccepts the defaults without prompting and lists the keys you still need.
--checkReports missing or mismatched values and changes nothing.
--origin <url>Adds another origin the API accepts, for example a second frontend. Repeatable.
--client-env <path>Writes the default API key pair into another frontend's .env too.

Filled for you: the JWT signing keys (written to apps/api/keys) and key ids, CORS origins, the API key pair shared by the API and the web app, the key pair between the API and the AI service, and internal secrets.

API (apps/api/.env)

GroupVariablesPurpose
AppAPP_*, HOME_URL, HTTP_PORTName, web app URL used in emails and links, port (8080).
Public URLAPI_BACKEND_URLPublic origin of the API, used for channel webhooks such as Telegram.
CORSMIDDLEWARE_CORS_ORIGINAllowed web app origins.
DatabaseDATABASE_URLPostgres with the pgvector extension.
AuthAUTH_JWT_*JWKS URL, key ids and key paths.
RedisREDIS_*Cache and queues.
StorageAWS_S3_PUBLIC_*, AWS_S3_PRIVATE_*Buckets for uploads, knowledge files and skills.
EmailRESEND_API_KEY, EMAIL_FROM, EMAIL_SUPPORTSign-up codes, invitations and alerts. EMAIL_SUPPORT is the support address shown in emails; leave it empty to leave the line out.
ChannelsFACEBOOK_*, INSTAGRAM_*, ZALO_*, TELEGRAM_WEBHOOK_SECRET_TOKENChannel apps and webhook verification.
AI serviceAI_BACKEND_URL, AI_SERVICE_API_KEY, AI_SERVICE_API_SECRET, API_INTERNAL_TOKENCalls between the API and the AI service.
Background jobsCLOUD_TASKS_*Cloud Tasks project, queues, and CLOUD_TASKS_EMULATOR_HOST for local runs.
MarketplaceCOMPOSIO_*Marketplace tools.
SecurityTURNSTILE_SECRET_KEY, OAUTH_TOKEN_ENCRYPT_KEYBot protection on sign-up and login, and encryption of stored channel tokens.

Web app (apps/app/.env)

VariablePurpose
VITE_API_URLAPI origin, for example http://localhost:8080.
VITE_API_KEY, VITE_API_KEY_SECRETThe API key pair the app sends with every request.
VITE_TURNSTILE_SITE_KEYBot protection widget.
VITE_FACEBOOK_*, VITE_INSTAGRAM_*, VITE_WHATSAPP_CONFIG_ID, VITE_ZALO_*Sign-in popups for connecting channels. Instagram stays hidden until VITE_INSTAGRAM_APP_ID is set.

AI service (apps/ai/.env)

VariablePurpose
OPENROUTER_API_KEY, OPENROUTER_BASE_URLThe language models. Required.
POSTGRES_URL, RAG_POSTGRES_URLDatabase and vector store for the knowledge base.
API_BASE_URL, AI_SERVICE_API_KEY, AI_SERVICE_API_SECRET, API_INTERNAL_TOKENCalls back to the API. Must match the API's values.
EMBEDDING_MODEL, EMBEDDING_DIMENSIONS, CHUNK_SIZE, CHUNK_OVERLAPHow documents are split and embedded.
FIRECRAWL_API_KEYReading web pages added as URL items.
ENV, LOG_LEVEL, LANGSMITH_*Environment, logging and optional tracing.

Ports

ServicePort
API8080
Web app5173
AI service8000
Docs5175
Postgres / Redis5432 / 6379
Cloud Tasks emulator8123
JWKS server / Bull board3011 / 3010

Frequently asked questions

On this page