Environment Variables
NuxtHub automatically detects and configures resources based on environment variables. The following reference covers all supported variables, organized by feature.
Database
PostgreSQL
| Variable | Description | Priority |
|---|---|---|
POSTGRES_URL | PostgreSQL connection string | 1st |
POSTGRESQL_URL | PostgreSQL connection string | 2nd |
DATABASE_URL | Generic database connection string | 3rd |
MySQL
| Variable | Description | Priority |
|---|---|---|
MYSQL_URL | MySQL connection string | 1st |
DATABASE_URL | Generic database connection string | 2nd |
SQLite / Turso
| Variable | Description | Priority |
|---|---|---|
TURSO_DATABASE_URL | Turso database URL | 1st |
TURSO_AUTH_TOKEN | Turso authentication token | - |
LIBSQL_URL | libSQL database URL | 2nd |
LIBSQL_AUTH_TOKEN | libSQL authentication token | - |
DATABASE_URL | Generic database connection string | 3rd |
.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.
| Variable | Description |
|---|---|
NUXT_HUB_CLOUDFLARE_ACCOUNT_ID | Your Cloudflare account ID |
NUXT_HUB_CLOUDFLARE_API_TOKEN | Cloudflare API token with D1 permissions |
NUXT_HUB_CLOUDFLARE_DATABASE_ID | The ID of your D1 database |
Blob Storage
S3 / R2
| Variable | Description | Required |
|---|---|---|
S3_ACCESS_KEY_ID | AWS or R2 access key ID | Yes |
S3_SECRET_ACCESS_KEY | AWS or R2 secret access key | Yes |
S3_BUCKET | Bucket name | Yes |
S3_REGION | AWS region (use auto for R2) | Yes |
S3_ENDPOINT | Custom endpoint URL (required for R2) | R2 only |
Vercel Blob
| Variable | Description |
|---|---|
BLOB_READ_WRITE_TOKEN | Vercel Blob read/write token |
Key-Value Storage
Upstash Redis
| Variable | Description |
|---|---|
UPSTASH_REDIS_REST_URL | Upstash Redis REST URL |
UPSTASH_REDIS_REST_TOKEN | Upstash Redis REST token |
Redis
| Variable | Description |
|---|---|
REDIS_URL | Redis connection URL |
Cache DevTools
These variables are required for cache management in Nuxt DevTools when self-hosting on Cloudflare.
| Variable | Description |
|---|---|
NUXT_HUB_CLOUDFLARE_ACCOUNT_ID | Your Cloudflare account ID |
NUXT_HUB_CLOUDFLARE_API_TOKEN | Cloudflare API token with KV permissions |
NUXT_HUB_CLOUDFLARE_CACHE_NAMESPACE_ID | KV namespace ID for cache storage |
Build & Deployment
| Variable | Description | Used By |
|---|---|---|
CLOUDFLARE_ENV | Wrangler environment to use during build | Cloudflare |
NUXT_HUB_PROJECT_KEY | NuxtHub project key (deprecated) | NuxtHub Admin |
NUXT_HUB_USER_TOKEN | NuxtHub 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_URL → POSTGRESQL_URL → DATABASE_URL → PGlite (local)
MySQL
MYSQL_URL → DATABASE_URL → error (no local fallback available)
SQLite
TURSO_DATABASE_URL → LIBSQL_URL → DATABASE_URL → local file
KV
UPSTASH_REDIS_REST_URL → REDIS_URL → filesystem
Blob
S3 variables → BLOB_READ_WRITE_TOKEN → filesystem
.env file for local development. Never commit .env files to version control.