Skip to main content
Copy .env.example to .env and set the values below before starting Postcard.
cp .env.example .env

Required

VariableDescription
GOOGLE_GENERATIVE_AI_API_KEYGemini API key used by the forensic pipeline in live mode. Get a free key at aistudio.google.com/api-keys.

AI configuration

VariableDefaultDescription
GOOGLE_GENERATIVE_AI_MODEL_IDgemini-2.0-flashThe Gemini model string used by the forensic agents. Change this to use a different model available in your API account.
NEXT_PUBLIC_FAKE_PIPELINEtrueSet to "true" to use mock data for all forensic stages. No API key or live scraping is required. Set to "false" to run the real pipeline.
NEXT_PUBLIC_FAKE_PIPELINE_DELAYArtificial delay in milliseconds applied during fake pipeline execution. Useful for simulating realistic loading states during UI development.
NEXT_PUBLIC_FAKE_PIPELINE_FAILSet to "true" to simulate a pipeline failure in fake mode. Useful for testing error states and UI recovery flows.
NEXT_PUBLIC_ variables are embedded in the browser bundle at build time. Changing them requires restarting the development server or rebuilding the application.

Database

VariableDescription
TURSO_DATABASE_URLlibSQL connection URL for a Turso cloud database (e.g. libsql://your-database.turso.io). If omitted, Postcard falls back to a local SQLite file (local.db).
TURSO_AUTH_TOKENAuthentication token for the Turso cloud database. Required when TURSO_DATABASE_URL is set to a libsql:// URL.
See Database for setup instructions.

Pipeline tuning

These variables let you adjust the forensic pipeline’s behavior without modifying source code.
VariableDefaultDescription
POSTCARD_MAX_TOOL_CALLS5Maximum number of AI tool calls the corroboration agent can make per analysis. Lower values reduce API usage and speed up analysis; higher values allow deeper corroboration.
POSTCARD_MAX_SOURCES10Maximum number of sources the corroboration agent collects during a single trace.
POSTCARD_WEIGHT_ORIGIN0.3Weight applied to the origin score when calculating the overall Postcard Score.
POSTCARD_WEIGHT_CORROBORATION0.25Weight applied to the corroboration score.
POSTCARD_WEIGHT_BIAS0.25Weight applied to the bias score.
POSTCARD_WEIGHT_TEMPORAL0.2Weight applied to the temporal alignment score.
The four scoring weights (POSTCARD_WEIGHT_ORIGIN, POSTCARD_WEIGHT_CORROBORATION, POSTCARD_WEIGHT_BIAS, POSTCARD_WEIGHT_TEMPORAL) must sum to exactly 1.0. The default values add up to 1.0 (0.3 + 0.25 + 0.25 + 0.2). Deviating from this will skew the Postcard Score calculation.

Social media API keys (optional)

These keys improve ingestion accuracy for specific platforms. If omitted, Postcard falls back to Jina Reader for best-effort ingestion.

Reddit

VariableDescription
REDDIT_CLIENT_IDClient ID from your Reddit script app.
REDDIT_CLIENT_SECRETClient secret from your Reddit script app.
REDDIT_USERNAMEReddit account username used for authentication.
REDDIT_PASSWORDReddit account password used for authentication.

X / Twitter

VariableDescription
TWITTER_BEARER_TOKENBearer token from the Twitter API v2 developer portal. Defined in .env.example for future use; the current X ingestion client uses the public oEmbed API and does not require this token.

Instagram

VariableDescription
INSTAGRAM_ACCESS_TOKENAccess token from your Meta for Developers app. Required for high-fidelity Instagram results.

TikTok

VariableDescription
TIKTOK_ACCESS_TOKENTikTok API access token. Optional — Postcard uses oEmbed as a fallback.

Base URL

VariableDescription
NEXT_PUBLIC_APP_URLThe public URL of your deployed Postcard instance (e.g. https://postcard.example.com). Used for metadata resolution and OG image generation. If omitted, Postcard falls back to the VERCEL_URL environment variable, then http://localhost:3000.

Build docs developers (and LLMs) love