Skip to the page
Social CrawlDocs

Environment variables

Updated
View as Markdown

Every setting the Social Crawl API, the web app, Docker Compose and this docs site read, with its default, its limits and what it does.

On this page

The API checks its environment when it starts (apps/api/src/config/env.ts, a zod schema) and refuses to start, saying which value is wrong. Values are cleaned first: surrounding spaces and quotes are removed, because environment panels and copy and paste often add them.

In Dokploy set them under Environment. With plain Docker put them in a .env file next to docker-compose.yml. .env.example in the repository lists the common ones with comments.

Needed to start#

VariableDefaultMeaning
JWT_SECRETnone, requiredSigns logins and encrypts the saved WebDAV password. At least 32 characters. openssl rand -base64 48. Changing it ends every login and makes the saved WebDAV password unreadable.
ADMIN_PASSWORD_HASHnone, requiredYour password as scrypt:<salt>:<hash>, 120 characters. See Install the server.
DATABASE_URLIn Compose: the stack's own db serviceA PostgreSQL address. In Compose it is built from POSTGRES_USER, POSTGRES_PASSWORD and POSTGRES_DB. The API refuses an address that points at sc-db with an empty password.

Database (Compose)#

VariableDefaultMeaning
POSTGRES_PASSWORDemptyThe stack's own database password. Letters and numbers only. Needed while the stack uses its own database, and once on a brand-new install even when DATABASE_URL is set.
POSTGRES_USERsocialcrawlUser of the stack's database.
POSTGRES_DBsocialcrawlName of the stack's database.
DB_SYNCHRONIZEfalse in the API, true in ComposeLets TypeORM create and alter tables at start. There are no migrations. See Data model.
MIGRATE_TO_DATABASE_URLunsetA second address that Settings → Database copies into. Read only when you press Check or Copy. Remove it afterwards.
OLD_DATABASE_URLunsetThe address of the database you left, for Settings → Database to delete its data. Remove it afterwards.

Server#

VariableDefaultMeaning
PORT4000The API's port.
CORS_ORIGINSemptyOrigins allowed to call the API from a browser, comma separated. The extension uses its own origin.
RESTRICTED_PASSWORD_HASHunsetSecond password for the restricted part, same format as ADMIN_PASSWORD_HASH. Without it the part cannot be opened.
EXTENSION_DIR../extension/distThe built extension offered in Settings. In the Docker image it is built in.
LAB_ENABLEDoffTurns on the /lab routes (testing only; they can write 12 GB per test to WebDAV). Leave off.

Storage#

VariableDefaultMeaning
STORAGE_DRIVERlocallocal or s3.
STORAGE_DIR./storage (/data/bundles in Compose)Where bundles live with the local driver.
S3_ENDPOINTnoneRequired with s3. Must start with https://. For R2: https://<account id>.r2.cloudflarestorage.com.
S3_BUCKETnoneRequired with s3.
S3_REGIONautoRegion.
S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEYnoneRequired with s3.

Videos#

VariableDefaultMeaning
MAX_VIDEO_MB4096 (1 to 5000)The largest video the extension may send. Settings → Videos overrides it. While a post is saved the server needs about twice this free on its temp disk.
UPLOAD_DIRthe system's temp folderWhere uploaded videos wait until their post is saved.
VIDEO_CACHE_MB2048 (0 = off, up to 1,000,000)How much of the videos kept on WebDAV the server holds on its disk.
VIDEO_CACHE_DIRthe system's temp folderWhere those parts are kept.

Speech recognition#

All optional. See Captions and transcripts.

VariableDefaultMeaning
API_TARGETruntimeCompose build target. runtime-speech builds the image with Whisper (about 3 GB).
SPEECH_MODEL_NAMEbaseWhich model the speech image carries (base, small, ...).
SPEECH_COMMANDunset (set for you with runtime-speech)The program that listens. Both this and SPEECH_MODEL are needed.
SPEECH_MODELunset (set for you with runtime-speech)The model file.
SPEECH_THREADS4 in the API, 2 in Compose (1 to 64)Processor threads it uses.
SPEECH_LANGUAGEautoauto or a code such as en.
SPEECH_MAX_MINUTES240 (1 to 1440)The longest video or sound it listens to.

The web app#

VariableDefaultMeaning
API_URLhttp://127.0.0.1:4000 (http://sc-api:4000 in Compose)Where the web app reaches the API from the server side. Never exposed to the browser.

Optional, and not tested against the real YouTube. All are environment variables of the API; an empty one means "not set". Defaults in parentheses.

VariableMeaning
YT_LINKoff turns the whole experiment off. Its routes then answer 404.
YTS_MAX_HEIGHT (2160)Tallest picture it takes, 144 to 4320.
YTS_CODEC_ORDER (avc1,av01,vp09)The most wanted picture codec first.
YTS_YT_PROXYhost:port of an HTTP proxy used for YouTube only. YTS_WARP_ROTATE=1 asks for a new address when blocked.
YTS_SLICE_MB (5), YTS_PIECE_MB (8), YTS_PART_MB (256), YTS_PARALLEL (2)Read slice, upload piece, big-video part, slices read side by side.
YTS_SLICE_TRIES (4), YTS_PART_TRIES (3)Retries per slice and per part.
YTS_SMALL_MB (0)Videos up to this size go the normal way. 0 means the server's own limit.
YTS_DOCTOR_EVERY_HOURS (24; 0 = off), YTS_DOCTOR_VIDEOSThe daily self-check.
YTS_CLIENTS_FILE, YTS_STREAM_UA, YTS_STATE_DIRA JSON copy of the clients table, the user agent for stream requests, and where its files are kept.

This docs site#

Read when the docs are built (see Maintain these docs).

VariableDefaultMeaning
DOCS_SITE_URLhttps://docs.example.comThe public address of the docs. Used in llms.txt, the sitemap, robots.txt, canonical addresses and Open Graph tags. Set it to your real address.
NEXT_PUBLIC_DOCS_APP_URLunsetThe address of your app. When set, an Open the app button appears in the docs header.