Core ConceptsConfiguration

Configuration

Complete environment variable reference for the backend, admin dashboard, public portal, inventory agent, and MCP server.

Configuration

Each service in the platform reads its configuration from environment variables. Copy the corresponding .env.example file to .env and fill in the values before starting the stack.

All .env.example files are in their respective service directories: root .env.example, backend/.env.example, frontend/admin/.env.example, frontend/public/.env.example, inventory-agent/.env.example, and inventory-mcp/.env.example.

Backend

The backend configuration is loaded from backend/.env and parsed by the config module. Variables are grouped by function.

Authentication

VariableDefaultDescription
JWT_SECRET_KEYRequiredAccess token signing key. Minimum 32 characters.
JWT_EXPIRES_IN15mAccess token lifetime.
JWT_REFRESH_SECRET_KEYRequiredRefresh token signing key. Minimum 32 characters.
JWT_REFRESH_EXPIRES_IN7dRefresh token lifetime.
JWT_ISSUERshopee-autoredeemerJWT issuer claim.
JWT_AUDIENCEshopee-autoredeemer-adminJWT audience claim.

Server and CORS

VariableDefaultDescription
PORT_NUMBER8080Backend listen port.
ALLOWED_CORS_HOSTNAMESRequiredComma-separated list of allowed CORS origins.
PUBLIC_REDEMPTION_PORTAL_HOSTNAMERequiredPublic portal URL used to construct /r/:directory_key links.

PostgreSQL

VariableDefaultDescription
PG_HOSTdbPostgreSQL host.
PG_PORT5432PostgreSQL port.
PG_DATABASEshopeedbDatabase name.
PG_USERRequiredDatabase user.
PG_PASSWORDRequiredDatabase password.

Redis

VariableDefaultDescription
REDIS_HOSTredisRedis host.
REDIS_PORT6379Redis port.
REDIS_PASSWORDEmptyRedis password, if required.

Shopee

VariableDefaultDescription
SHOPEE_ENVIRONMENT_HOSTNAMEhttps://openplatform.sandbox.test-stable.shopee.sg/Shopee API base URL. Use the production URL for live shops.
SHOPEE_REDIRECT_URIhttp://localhost:8080/api/shopee/token/callbackOAuth callback URL.

Per-shop Shopee credentials, including the partner ID, partner key, and shop ID, are stored in the shops table, not in environment variables.

Worker

VariableDefaultDescription
TOKEN_REFRESH_WORKERfalseSet to true to enable the token refresh and product sync worker.
TOKEN_REFRESH_WORKER_CONCURRENCY3Number of concurrent BullMQ jobs the worker processes.

Admin Dashboard

Configure the admin dashboard in frontend/admin/.env.

VariableDefaultDescription
VITE_BACKEND_API_HOSTNAMEhttp://localhost:8080Backend API URL.
VITE_ANALYTICS_PROVIDERnoneAnalytics provider. Set to rybbit to enable analytics.
VITE_RYBBIT_SITE_IDEmptyRybbit site ID.
VITE_RYBBIT_SCRIPT_URLhttps://app.rybbit.io/api/script.jsRybbit script URL.

Public Portal

Configure the public portal in frontend/public/.env. The public portal uses the same variables as the admin dashboard.

VariableDefaultDescription
VITE_BACKEND_API_HOSTNAMEhttp://localhost:8080Backend API URL.
VITE_ANALYTICS_PROVIDERnoneAnalytics provider.
VITE_RYBBIT_SITE_IDEmptyRybbit site ID.
VITE_RYBBIT_SCRIPT_URLhttps://app.rybbit.io/api/script.jsRybbit script URL.

Inventory Agent

Configure the inventory agent in inventory-agent/.env. The agent authenticates as a shop-scoped seller account.

Backend connection

VariableDescription
BACKEND_URLBackend API URL.
BACKEND_EMAILSeller account email, not an administrator account.
BACKEND_PASSWORDSeller account password.

Google Drive

VariableDescription
SOURCE_PROVIDERSet to google-drive.
GOOGLE_AUTH_MODEAuthentication mode: service-account or oauth.
GOOGLE_APPLICATION_CREDENTIALSPath to the service account JSON file when using service-account mode.
GOOGLE_CLIENT_IDOAuth client ID when using OAuth mode.
GOOGLE_CLIENT_SECRETOAuth client secret.
GOOGLE_REFRESH_TOKENOAuth refresh token.
DRIVE_ROOT_IDSComma-separated Google Drive folder IDs to index.
DRIVE_SHARED_DRIVE_IDShared drive ID, if applicable.

Optional AI matching

VariableDefaultDescription
OPENROUTER_API_KEYEmptyAPI key for OpenRouter LLM matching.
OPENROUTER_MODELEmptyModel name for semantic matching.
LLM_MATCHINGfalseEnable LLM-based matching.
MATCH_MODEautoMatching mode: auto or manual.
AGENT_MAX_STEPS20Maximum steps for the conversation agent.
LLM_MAX_REQUESTS50Maximum LLM API requests per run.

Scheduling and state

VariableDefaultDescription
SCHEDULE_INTERVAL_SECONDS3600Run interval in seconds. The default is one hour.
STATE_PATH./state/agent.sqlitePath to the SQLite state file.
BATCH_SIZE200Batch size for backend submissions.
PAGE_SIZE500Page size for Drive API pagination.
SOURCE_CONCURRENCY4Number of concurrent Drive API requests.

MCP Server

Configure the MCP server in inventory-mcp/.env.

VariableDefaultDescription
BACKEND_API_URLhttp://127.0.0.1:8080/apiBackend API URL.
BACKEND_EMAILRequiredSeller account email.
BACKEND_PASSWORDRequiredSeller account password.
MCP_HTTP_KEYRequiredLong random secret used for HTTP authentication.
MCP_HOST127.0.0.1HTTP listen host.
MCP_PORT8081HTTP listen port.
MCP_ALLOWED_HOSTSlocalhost,127.0.0.1,[::1]Allowed hostnames.
MCP_ALLOWED_ORIGINSEmptyAllowed CORS origins.

For Docker Compose deployment details, see Deployment. For JWT token settings and authentication flows, see Authentication.