Environment Variables

Reference for all environment variables used by NuxtHub for database, blob storage, KV, cache, and deployment configuration.

NuxtHub automatically detects and configures resources based on environment variables. The following reference covers all supported variables, organized by feature.

Database

PostgreSQL

VariableDescriptionPriority
POSTGRES_URLPostgreSQL connection string1st
POSTGRESQL_URLPostgreSQL connection string2nd
DATABASE_URLGeneric database connection string3rd

MySQL

VariableDescriptionPriority
MYSQL_URLMySQL connection string1st
DATABASE_URLGeneric database connection string2nd

SQLite / Turso

VariableDescriptionPriority
TURSO_DATABASE_URLTurso database URL1st
TURSO_AUTH_TOKENTurso authentication token-
LIBSQL_URLlibSQL database URL2nd
LIBSQL_AUTH_TOKENlibSQL authentication token-
DATABASE_URLGeneric database connection string3rd
When no environment variables are set, NuxtHub falls back to a local SQLite file at .data/db/sqlite.db.

D1 over HTTP

These variables are required when using the d1-http driver to access Cloudflare D1 from non-Cloudflare hosts.

VariableDescription
NUXT_HUB_CLOUDFLARE_ACCOUNT_IDYour Cloudflare account ID
NUXT_HUB_CLOUDFLARE_API_TOKENCloudflare API token with D1 permissions
NUXT_HUB_CLOUDFLARE_DATABASE_IDThe ID of your D1 database

Blob Storage

S3 / R2

VariableDescriptionRequired
S3_ACCESS_KEY_IDAWS or R2 access key IDYes
S3_SECRET_ACCESS_KEYAWS or R2 secret access keyYes
S3_BUCKETBucket nameYes
S3_REGIONAWS region (use auto for R2)Yes
S3_ENDPOINTCustom endpoint URL (required for R2)R2 only

Vercel Blob

VariableDescription
BLOB_READ_WRITE_TOKENVercel Blob read/write token

Key-Value Storage

Upstash Redis

VariableDescription
UPSTASH_REDIS_REST_URLUpstash Redis REST URL
UPSTASH_REDIS_REST_TOKENUpstash Redis REST token

Redis

VariableDescription
REDIS_URLRedis connection URL

Cache DevTools

These variables are required for cache management in Nuxt DevTools when self-hosting on Cloudflare.

VariableDescription
NUXT_HUB_CLOUDFLARE_ACCOUNT_IDYour Cloudflare account ID
NUXT_HUB_CLOUDFLARE_API_TOKENCloudflare API token with KV permissions
NUXT_HUB_CLOUDFLARE_CACHE_NAMESPACE_IDKV namespace ID for cache storage
These variables are only required for DevTools cache management. Normal cache operations work directly through KV bindings without additional configuration.

Build & Deployment

VariableDescriptionUsed By
CLOUDFLARE_ENVWrangler environment to use during buildCloudflare
NUXT_HUB_PROJECT_KEYNuxtHub project key (deprecated)NuxtHub Admin
NUXT_HUB_USER_TOKENNuxtHub user token (deprecated)NuxtHub Admin

Detection Priority

NuxtHub checks environment variables in a specific order and uses the first one found. If none are set, it falls back to local development defaults where available.

PostgreSQL

POSTGRES_URLPOSTGRESQL_URLDATABASE_URL → PGlite (local)

MySQL

MYSQL_URLDATABASE_URL → error (no local fallback available)

SQLite

TURSO_DATABASE_URLLIBSQL_URLDATABASE_URL → local file

KV

UPSTASH_REDIS_REST_URLREDIS_URL → filesystem

Blob

S3 variables → BLOB_READ_WRITE_TOKEN → filesystem

Configure environment variables in your hosting provider's dashboard or in a .env file for local development. Never commit .env files to version control.