Environment variables

A list of environment variables required to run your project

Supabase credentials found on app.supabase.com

1. Supabase project URL found at "Supabase Project > Settings > API" - e.g. https://cgmqkubhecjkpoevomhd.supabase.co.

NEXT_PUBLIC_SUPABASE_URL

2. Supabase anon public key found at "Supabase Project > Settings > API". Indicated with "anon" and "public" tags. Safe to share publicly.

NEXT_PUBLIC_SUPABASE_ANON_KEY

3. Supabase service role key found at "Supabase Project > Settings > API". Indicated with "service_role" and "secret" tags. Never share it publicly.

SUPABASE_SERVICE_ROLE_KEY

Stripe credentials found on dashboard.stripe.com/apikeys

4. Stripe publishable key found at "Stripe Dashboard > Developers > API keys". Use the LIVE variable for deployed applications and the other variable for local applications. Keys are in the form of pk_live_... or pk_test_.... Safe to share publicly.

local
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY

-- OR --

deployed-application
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY_LIVE

5. Stripe secret key found at "Stripe Dashboard > Developers > API keys". Use the LIVE variable for deployed applications and the other variable for local applications. Keys are in the form of sk_live_... or sk_test_.... Never share it publicly.

local
STRIPE_SECRET_KEY

-- OR --

deployed-application
STRIPE_SECRET_KEY_LIVE

6. Stripe webhook secret found at "Stripe Dashboard > Developers > Webhooks > Your created webhook". Use the LIVE variable for deployed applications and the other variable for local applications. This key is only generated after you have configured a webhook. Click the "Reveal" button underneath "Signing secret" to view the key. Keys are in the form of whsec_.... Never share it publicly.

local
STRIPE_WEBHOOK_SECRET

-- OR --

deployed-application
STRIPE_WEBHOOK_SECRET_LIVE

Stripe redirect URLs - URLs belonging to your application that can be used to redirect a customer back to a specific page after interacting with Stripe

7. URL to redirect a customer to after managing their account on Stripe - usually in the case of account upgrades or cancellations.

STRIPE_SESSION_REDIRECT_URL

8. URL to redirect a customer to after successful checkout.

CHECKOUT_SUCCESS_REDIRECT_URL

9. URL to redirect a customer to after checkout cancellation.

CHECKOUT_CANCEL_REDIRECT_URL

Stripe price IDs found on the product page for each product

10. - 15. The names of these variables will depend on your pricing and naming structure. If you modify any of these variable names, update them in the pricing.tsx component as well. Price IDs are in the form of price_... and are safe to share publicly.

NEXT_PUBLIC_PRICE_BASIC_MONTHLY
NEXT_PUBLIC_PRICE_BASIC_YEARLY
NEXT_PUBLIC_PRICE_PRO_MONTHLY
NEXT_PUBLIC_PRICE_PRO_YEARLY
NEXT_PUBLIC_PRICE_MASTER_MONTHLY
NEXT_PUBLIC_PRICE_MASTER_YEARLY

Transactional email settings

Sendgrid

16. Sendgrid API key found on the Sendgrid API keys page.

SENDGRID_API_KEY

Mailgun

17. Mailgun API key found on the Mailgun API security page.

MAILGUN_API_KEY

18. Mailgun URL can only be one of 2 values. https://api.mailgun.net if you're using the US infrastructure or https://api.eu.mailgun.net if you're using the EU infrastructure. The default value is https://api.mailgun.net.

MAILGUN_URL

19. Mailgun domain - if you connected your custom domain to Mailgun this value should be your custom domain. Otherwise, it will be a sandbox domain provided by Mailgun e.g. sandbox5519009eb6444178dc94b9214036072.mailgun.org.

MAILGUN_DOMAIN

Postmark

20. Postmark API key found on the Postmark server API tokens page (https://account.postmarkapp.com/servers/{server-ID}/credentials).

POSTMARK_API_KEY

IMPORTANT: Ensure that these environment variables are used for deployed applications:

  • NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY_LIVE
  • STRIPE_SECRET_KEY_LIVE
  • STRIPE_WEBHOOK_SECRET_LIVE

For local development, these variables should be used:

  • NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
  • STRIPE_SECRET_KEY
  • STRIPE_WEBHOOK_SECRET
Last updated:

Stay up to date

Sign up for the Ship SaaS newsletter to get notifiedabout the latest updates and blog posts

We care about the protection of your data. Read our Privacy Policy and Terms & Conditions.