Skip to main content
Quark reads configuration from two sources: a .env file for service credentials and runtime settings, and compile-time constants in src/pipeline-processing/consts.ts that control pipeline behavior.

Environment variables

All variables are validated with Zod on startup. If any required variable is missing or invalid, Quark exits with an error message before doing anything else.

LLM provider

Register at https://console.groq.com (or any OpenAI-compatible provider) to obtain these credentials.
LLM_TOKEN
string
required
API key for your LLM provider. Passed as the Authorization: Bearer header to the inference endpoint.
LLM_URL
string
required
Base URL of the OpenAI-compatible inference endpoint. For Groq, this is https://api.groq.com/openai/v1.
LLM_MODEL
string
default:"meta-llama/llama-4-scout-17b-16e-instruct"
required
Model identifier to request from the provider. Must be a model name recognized by the endpoint at LLM_URL.

Embeddings (VoyageAI)

Register at https://www.voyageai.com/ to obtain your embedding API key.
EMBEDDDING_TOKEN
string
required
API key for VoyageAI. Note the intentional double-D spelling — this matches the variable name in .env.example and the Zod schema (EMBEDDING_TOKEN).
EMBEDDING_MODEL
string
default:"voyage-4-large"
required
VoyageAI model used to generate document and query embeddings. Changing this requires re-ingesting all documents so vector dimensions stay consistent.

Document parser (Unstructured.io)

Register at https://unstructured.io/?modal=try-for-free to obtain your API key and server URL.
UNSTRUCTURED_TOKEN
string
required
API key for the Unstructured.io document partitioning service.
UNSTRUCTURED_URL
string
required
Server URL for the Unstructured API. The default hosted endpoint is https://api.unstructuredapp.io/general/v0/general.

Vector database (Qdrant)

Register at https://qdrant.tech/ to create a free cloud cluster. The API key and cluster URL are available in the Qdrant dashboard.
VECTOR_DB_TOKEN
string
required
API key for your Qdrant cloud cluster.
VECTOR_DB_URL
string
required
Full URL of your Qdrant cluster, for example https://your-id.us-east4-0.gcp.cloud.qdrant.io.
COLLECTION_NAME
string
required
Name of the Qdrant collection where document vectors are stored. The collection is created automatically on first ingest if it does not exist.

Long-term memory (Mem0)

Register at https://mem0.ai/ to obtain your API key.
MEM0_API
string
required
API key for the Mem0 memory service. Mem0 stores user preferences and conversation history that persist across sessions.

Short-term memory (Redis)

Register at https://upstash.com/ and create a Redis database. Copy the REDIS_URL (including credentials) from the database details page.
REDIS_URL
string
required
Full connection URL for Redis, including credentials. For Upstash, this is in the form rediss://default:[email protected]:6379. Used for short-term session memory (STM).

Object storage (ElasticLake)

Register at https://app.elasticlake.com/ to create an object and obtain your access credentials.
OBJECT_NAME
string
required
The name of the object store bucket in ElasticLake where ingested files and extracted assets are uploaded.
OBJECT_ID
string
required
Access key ID for ElasticLake (equivalent to an AWS accessKeyId). Used to authenticate S3-compatible requests.
OBJECT_ACCESS_KEY
string
required
Secret access key for ElasticLake (equivalent to an AWS secretAccessKey). Keep this value private.

Database (Supabase)

Register at https://supabase.com/ and create a project. All four values are available under Project Settings → API and Project Settings → Database.
SUPERBASE_URL
string
required
The base URL of your Supabase project, for example https://your-ref.supabase.co. Used by the Supabase JS client.
SUPERBASE_KEY
string
required
The anon (public) API key for your Supabase project. Used for client-side operations with row-level security applied.
SUPERBASE_DEV_KEY
string
required
The service_role key for your Supabase project. This key bypasses row-level security — keep it private and never expose it to clients.
SUPABASE_DB_URL
string
required
Direct PostgreSQL connection string for running database migrations via psql. Format: postgresql://postgres.[REF]:[PASSWORD]@aws-0-[REGION].pooler.supabase.com:5432/postgres.

Runtime settings

ENV
string
default:"dev"
Runtime environment. Accepted values: dev, staging, prod. Controls behavior such as log verbosity and client initialization.
PINO_LOG_LEVEL
string
default:"debug"
Log level for the Pino logger. Standard levels: trace, debug, info, warn, error, fatal. Set to info or warn in production to reduce noise.

Pipeline constants

These values are defined in src/pipeline-processing/consts.ts and are compiled into the binary. To change them you must edit the source file and restart the process.
ConstantValueDescription
MAXCHAR1500Maximum character length of a single text chunk after partitioning. Chunks longer than this are split further before embedding.
BATCHSIZE12Number of chunks sent to VoyageAI in a single embedding request. Higher values improve throughput but increase latency per batch.
SIMILARITY_THRESHOLD0.2Minimum cosine similarity score for a Qdrant result to be included in the retrieved context. Results below this threshold are discarded.
VECTOR_LIMIT15Maximum number of vectors returned per Qdrant search query before similarity filtering.
MAX_MESSAGES20Maximum number of messages stored in Redis short-term memory (STM) for a session before the buffer is trimmed.
TTL_SECONDS1800Time-to-live in seconds for Redis STM keys. After 30 minutes of inactivity a session’s short-term context expires.
TRIM_TO10Number of messages to retain when the STM buffer is trimmed after exceeding MAX_MESSAGES. Oldest messages are dropped first.

Build docs developers (and LLMs) love