Getting started

Extending

Rest APIs
GraphQL APIs

Contributing

Frontend Development
Backend Development

User Guide

Environment Variables

Environment Variables

Environment Variables
In this article

Setup Messaging & Calendar sync

Twenty offers integrations with Gmail and Google Calendar. To enable these features, you need to connect to register the following recurring jobs:

# from your worker container
yarn command:prod cron:messaging:messages-import
yarn command:prod cron:messaging:message-list-fetch
yarn command:prod cron:calendar:calendar-event-list-fetch

Setup Environment Variables

Frontend

VariableExampleDescription
REACT_APP_SERVER_BASE_URLhttp://localhost:3000Url of backend server
GENERATE_SOURCEMAPfalseGenerate source maps for debugging
CHROMATIC_PROJECT_TOKENChromatic token used for CI

Backend

Config

VariableExampleDescription
PG_DATABASE_URLpostgres://user:pw@localhost:5432/default?connection_limit=1Database connection
PG_SSL_ALLOW_SELF_SIGNEDfalseAllow self signed certificates
REDIS_HOST127.0.0.1Redis connection host
REDIS_PORT6379Redis connection port
REDIS_USERNAMEredis_usernameRedis connection username
REDIS_PASSWORDredis_pwdRedis connection password
FRONT_BASE_URLhttp://localhost:3001Url to the hosted frontend
SERVER_URLhttp://localhost:3000Url to the hosted server
PORT3000Port
CACHE_STORAGE_TYPEmemoryCache type (memory, redis...)
CACHE_STORAGE_TTL3600 * 24 * 7Cache TTL in seconds

Security

VariableExampleDescription
API_RATE_LIMITING_TTL100API rate limiting time window
API_RATE_LIMITING_LIMIT200API rate limiting max requests

Tokens

VariableExampleDescription
ACCESS_TOKEN_SECRET<random>Secret used for the access tokens
ACCESS_TOKEN_EXPIRES_IN30mAccess token expiration time
LOGIN_TOKEN_SECRET<random>Secret used for the login tokens
LOGIN_TOKEN_EXPIRES_IN15mLogin token expiration time
REFRESH_TOKEN_SECRET<random>Secret used for the refresh tokens
REFRESH_TOKEN_EXPIRES_IN90dRefresh token expiration time
REFRESH_TOKEN_COOL_DOWN1mRefresh token cooldown
FILE_TOKEN_SECRET<random>Secret used for the file tokens
FILE_TOKEN_EXPIRES_IN1dFile token expiration time
API_TOKEN_EXPIRES_IN1000yApi token expiration time

Auth

VariableExampleDescription
MESSAGING_PROVIDER_GMAIL_ENABLEDfalseEnable Gmail API connection
CALENDAR_PROVIDER_GOOGLE_ENABLEDfalseEnable Google Calendar API connection
AUTH_GOOGLE_APIS_CALLBACK_URLGoogle APIs auth callback
AUTH_PASSWORD_ENABLEDfalseEnable Email/Password login
AUTH_GOOGLE_ENABLEDfalseEnable Google SSO login
AUTH_GOOGLE_CLIENT_IDGoogle client ID
AUTH_GOOGLE_CLIENT_SECRETGoogle client secret
AUTH_GOOGLE_CALLBACK_URLGoogle auth callback
AUTH_MICROSOFT_ENABLEDfalseEnable Microsoft SSO login
AUTH_MICROSOFT_CLIENT_IDMicrosoft client ID
AUTH_MICROSOFT_TENANT_IDMicrosoft tenant ID
AUTH_MICROSOFT_CLIENT_SECRETMicrosoft client secret
AUTH_MICROSOFT_CALLBACK_URLMicrosoft auth callback
FRONT_AUTH_CALLBACK_URLhttp://localhost:3001/verify Callback used for Login page
IS_SIGN_UP_DISABLEDfalseDisable sign-up
PASSWORD_RESET_TOKEN_EXPIRES_IN5mPassword reset token expiration time

Email

VariableExampleDescription
EMAIL_FROM_ADDRESS[email protected]Global email From: header used to send emails
EMAIL_FROM_NAMEJohn from YourDomainGlobal name From: header used to send emails
EMAIL_SYSTEM_ADDRESS[email protected]Email address used as a destination to send internal system notification
EMAIL_DRIVERloggerEmail driver: 'logger' (to log emails in console) or 'smtp'
EMAIL_SMTP_HOSTEmail Smtp Host
EMAIL_SMTP_PORTEmail Smtp Port
EMAIL_SMTP_USEREmail Smtp User
EMAIL_SMTP_PASSWORDEmail Smtp Password

Email SMTP Server configuration examples

Gmail
Office365
Smtp4dev

You will need to provision an App Password.

  • EMAIL_SMTP_HOST=smtp.gmail.com
  • EMAIL_SMTP_PORT=465
  • EMAIL_SMTP_USER=gmail_email_address
  • EMAIL_SMTP_PASSWORD='gmail_app_password'

Storage

VariableExampleDescription
STORAGE_TYPElocalStorage driver: 'local' or 's3'
STORAGE_S3_REGIONStorage Region
STORAGE_S3_NAMEBucket Name
STORAGE_S3_ENDPOINTUse if a different Endpoint is needed (for example Google)
STORAGE_S3_ACCESS_KEY_IDOptional depending on the authentication method
STORAGE_S3_SECRET_ACCESS_KEYOptional depending on the authentication method
STORAGE_LOCAL_PATH.local-storagedata path (local storage)

Custom Code Execution

VariableExampleDescription
SERVERLESS_TYPElocalServerless driver type: 'local' or 'lambda'
SERVERLESS_LAMBDA_REGIONLambda Region
SERVERLESS_LAMBDA_ROLELambda Role
SERVERLESS_LAMBDA_ACCESS_KEY_IDOptional depending on the authentication method
SERVERLESS_LAMBDA_SECRET_ACCESS_KEYOptional depending on the authentication method

Message Queue

VariableExampleDescription
MESSAGE_QUEUE_TYPEpg-bossQueue driver: 'pg-boss' or 'bull-mq'

Logging

VariableExampleDescription
LOGGER_DRIVERconsoleCurrently, only supports 'console'
LOGGER_IS_BUFFER_ENABLEDtrueBuffer the logs before sending them to the logging driver
LOG_LEVELSerror,warnThe loglevels which are logged to the logging driver. Can include: 'log', 'warn', 'error'
EXCEPTION_HANDLER_DRIVERsentryThe exception handler driver can be: 'console' or 'sentry'
SENTRY_ENVIRONMENTmainThe sentry environment used if sentry logging driver is selected
SENTRY_RELEASElatestThe sentry release used if sentry logging driver is selected
SENTRY_DSNhttps://[email protected]/xxxThe sentry logging endpoint used if sentry logging driver is selected
SENTRY_FRONT_DSNhttps://[email protected]/xxxThe sentry logging endpoint used by the frontend if sentry logging driver is selected

Data enrichment and AI

VariableExampleDescription
OPENAI_API_KEYsk-proj-abcdabcd...OpenAI API key
LLM_CHAT_MODEL_DRIVERopenaiLLM provider
LLM_TRACING_DRIVERlangfuseWhere to output LangChain logs. 'langfuse' or 'console'.
LANGFUSE_SECRET_KEYsk-lf-abcdabcd-abcd...Langfuse secret key
LANGFUSE_PUBLIC_KEYpk-lf-abcdabcd-abcd...Langfuse public key

Serverless functions

This feature is WIP and is not yet useful for most users.

VariableExampleDescription
SERVERLESS_TYPElocalFunctions can either be executed through Lambda or directly by the main node process
SERVERLESS_LAMBDA_REGIONus-east-1If you use the Lambda driver, region of the Lambda function
SERVERLESS_LAMBDA_ROLEarn:aws:iam::121334:role/lambda-execution-roleIf you use the Lambda drive, name of the IAM role with the right permissions

Support Chat

VariableExampleDescription
SUPPORT_DRIVERfrontSupport driver ('front' or 'none')
SUPPORT_FRONT_HMAC_KEY<secret>Suport chat key
SUPPORT_FRONT_CHAT_ID<id>Support chat id

Telemetry

VariableExampleDescription
TELEMETRY_ENABLEDtrueChange this if you want to disable telemetry
TELEMETRY_ANONYMIZATION_ENABLEDtrueTelemetry is anonymized by default, you probably don't want to change this

Debug / Development

VariableExampleDescription
DEBUG_MODEtrueActivate debug mode
SIGN_IN_PREFILLEDtruePrefill the Signin form for usage in a demo or dev environment

Workspace Cleaning

VariableExampleDescription
WORKSPACE_INACTIVE_DAYS_BEFORE_NOTIFICATIONNumber of inactive days before sending workspace deleting warning email
WORKSPACE_INACTIVE_DAYS_BEFORE_DELETIONNumber of inactive days before deleting workspace

Captcha

VariableExampleDescription
CAPTCHA_DRIVERThe captcha driver can be 'google-recaptcha' or 'turnstile'
CAPTCHA_SITE_KEYThe captcha site key
CAPTCHA_SECRET_KEYThe captcha secret key

Noticed something to change?

As an open-source company, we welcome contributions through Github. Help us keep it up-to-date, accurate, and easy to understand by getting involved and sharing your ideas!

twenty github image
The #1 Open Source CRM
©2024 Twenty PBC