Environment Configuration
Configure environment variables for your ShipSaaS application
ShipSaaS requires a few environment variables to function correctly. This document will walk you through setting up these environment variables step-by-step.
Environment Variables
Website Configuration
| Variable | Description |
|---|---|
| VITE_BASE_URL | The URL of your website, e.g., http://localhost:3000 for development, or https://your-domain.com for production |
Cloudflare
Learn how to get and configure tokens in the Cloudflare document.
| Variable | Description |
|---|---|
| CLOUDFLARE_ACCOUNT_ID | Cloudflare Account ID (used by Wrangler CLI and Cloudflare REST API) |
| CLOUDFLARE_API_TOKEN | Cloudflare API Token (used by Wrangler CLI and Cloudflare REST API) |
Database
Learn how to set up the database in the Database Configuration document.
| Variable | Description |
|---|---|
| CLOUDFLARE_DATABASE_ID | Cloudflare D1 Database ID (used for Drizzle Kit remote operations) |
Storage
Learn how to set up storage in the Storage Configuration document.
ShipSaaS uses Cloudflare R2 bindings for storage, so no additional environment variables are required.
Authentication
Learn how to set up authentication in the Authentication document.
| Variable | Description |
|---|---|
| BETTER_AUTH_SECRET | A random string used for hashing tokens and signing cookies |
| GOOGLE_CLIENT_ID | Google OAuth Client ID (optional) |
| GOOGLE_CLIENT_SECRET | Google OAuth Client Secret (optional) |
Learn how to set up email functionality in the Email document.
ShipSaaS supports Resend and Cloudflare Email Service as email service providers.
Cloudflare Email
| Variable | Description |
|---|---|
| RESEND_API_KEY | API Key for the Resend email service |
Note: When using Resend, the RESEND_API_KEY can be shared between the email module and the newsletter subscription module.
Resend
| Variable | Description |
|---|---|
| CLOUDFLARE_ACCOUNT_ID | Cloudflare Account ID |
| CLOUDFLARE_API_TOKEN | Cloudflare API Token, requiring Email Sending Write permissions |
Payments
Learn how to set up payments in the Payment Configuration document.
ShipSaaS supports Stripe and Creem as payment providers.
Stripe
Learn how to set up Stripe in the Stripe Configuration document.
| Variable | Description |
|---|---|
| VITE_PAYMENT_PROVIDER | Set to stripe to enable the Stripe payment provider |
| STRIPE_SECRET_KEY | Stripe Secret Key |
| STRIPE_WEBHOOK_SECRET | Stripe Webhook Signature Secret |
| VITE_STRIPE_PRICE_PRO_MONTHLY | Stripe Price ID for the Pro Plan monthly subscription |
| VITE_STRIPE_PRICE_PRO_YEARLY | Stripe Price ID for the Pro Plan yearly subscription |
| VITE_STRIPE_PRICE_LIFETIME | Stripe Price ID for the Lifetime Plan |
Creem
Learn how to set up Creem in the Creem Configuration document.
| Variable | Description |
|---|---|
| VITE_PAYMENT_PROVIDER | Set to creem to enable the Creem payment provider |
| CREEM_API_KEY | Creem API Key |
| CREEM_WEBHOOK_SECRET | Creem Webhook Signature Secret |
| CREEM_DEBUG | Set to true to use the Creem sandbox testing environment (optional) |
| VITE_CREEM_PRODUCT_PRO_MONTHLY | Creem Product ID for the Pro Plan monthly subscription |
| VITE_CREEM_PRODUCT_PRO_YEARLY | Creem Product ID for the Pro Plan yearly subscription |
| VITE_CREEM_PRODUCT_LIFETIME | Creem Product ID for the Lifetime Plan |
AI
Learn how to set up AI features in the AI document.
| Variable | Description |
|---|---|
| FAL_API_KEY | fal.ai API Key for image generation, created in the fal.ai Dashboard |
Newsletter
Learn how to set up newsletter subscriptions in the Newsletter document.
ShipSaaS supports Resend and Beehiiv as newsletter service providers.
Resend
| Variable | Description |
|---|---|
| RESEND_API_KEY | Resend API Key for newsletter subscription service (shared with email module) |
Note: When using Resend, the RESEND_API_KEY can be shared between the email module and the newsletter subscription module.
Beehiiv
| Variable | Description |
|---|---|
| BEEHIIV_API_KEY | Beehiiv API Key for newsletter subscription service |
| BEEHIIV_PUBLICATION_ID | Beehiiv Publication ID for newsletter subscription service |
Notifications
Learn how to set up notifications in the Notification document.
| Variable | Description |
|---|---|
| DISCORD_WEBHOOK_URL | Discord Webhook URL for receiving notifications |
| FEISHU_WEBHOOK_URL | Feishu Webhook URL for receiving notifications |
Analytics
Learn how to set up analytics in the Analytics document.
| Variable | Description |
|---|---|
| VITE_GOOGLE_ANALYTICS_ID | Google Analytics ID |
| VITE_UMAMI_WEBSITE_ID | Umami Analytics Website ID |
| VITE_UMAMI_SCRIPT | Umami Analytics Script URL |
| VITE_PLAUSIBLE_SCRIPT | Plausible Analytics Script URL |
| VITE_CLARITY_PROJECT_ID | Clarity Analytics Project ID |
Chatbox
Learn how to set up the Crisp Chatbox in the Chatbox document.
| Variable | Description |
|---|---|
| VITE_CRISP_WEBSITE_ID | Crisp Chat ID, used for the live chat function on your website |
Affiliate Marketing
Learn how to set up affiliate marketing in the Affiliate document.
| Variable | Description |
|---|---|
| VITE_AFFILIATE_AFFONSO_ID | Affonso Affiliate Marketing ID |
| VITE_AFFILIATE_PROMOTEKIT_ID | PromoteKit Affiliate Marketing ID |
Verifying Environment Variables
To verify that your environment variables are correctly configured, run:
bun run devIf everything is correctly configured, your application should start and run normally without any environment-related errors.
Next Steps
Now that your environment is configured, explore these related topics:
- Website Configuration - Configure website settings
- Get ShipSaaS - Quick start with the ShipSaaS template
- Database Configuration - Configure your database
- Deployment - Deploy to Cloudflare Workers