Skip to content

Environment Variables ​

NuxtPro uses environment variables to manage sensitive information and per-environment configuration (development, staging, production). This prevents hard-coding API keys and database credentials in the codebase and improves security.

The .env file ​

The core configuration file is .env in the project root. It must not be committed to version control (e.g. Git). We provide .env.example as a template—copy it and rename to .env to get started.

bash
cp .env.example .env

Then fill in the variables in .env based on your setup.

Common variables ​

These are required for the app to run.

NUXT_PUBLIC_APP_URL ​

  • Description: Public URL of your deployed app.
  • Used for: Absolute links, sitemap generation, and SEO meta tags.
  • Example: NUXT_PUBLIC_APP_URL=https://myapp.com

Database variables ​

NuxtPro uses Prisma as the ORM and can work with multiple databases.

DATABASE_URL ​

  • Description: Your database connection string.
  • Used for: Prisma connects with this URL for migrations and queries.
  • Format: postgresql://USER:PASSWORD@HOST:PORT/DATABASE
  • Example: DATABASE_URL="postgresql://postgres:password@localhost:5432/nuxtpro?schema=public"

Payments (Stripe) ​

If you plan to use payments, configure the Stripe-related environment variables.

NUXT_PUBLIC_STRIPE_PUBLISHABLE_KEY ​

  • Description: Stripe publishable key.
  • Used for: Secure communication with Stripe API on the client side.
  • Example: NUXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_xxxxxxxxxxxx

STRIPE_SECRET_KEY ​

  • Description: Stripe secret key.
  • Used for: Server-side payment/subscription operations. Do not leak this key.
  • Example: STRIPE_SECRET_KEY=sk_test_xxxxxxxxxxxx

STRIPE_WEBHOOK_SECRET ​

  • Description: Stripe webhook signing secret.
  • Used for: Verifying webhook events are genuinely from Stripe.
  • Example: STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxx

Email (Resend) ​

Used for transactional emails such as welcome emails and password resets.

RESEND_API_KEY ​

  • Description: Resend API key.
  • Used for: Sending email through the Resend API.
  • Example: RESEND_API_KEY=re_xxxxxxxxxxxx

After setting required environment variables, restart your dev server for changes to take effect. Correct env configuration is a key step to running NuxtPro successfully.