ShipFree uses environment variables for configuration. All variables are validated at build time usingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/revokslab/shipfree/llms.txt
Use this file to discover all available pages before exploring further.
@t3-oss/env-nextjs and Zod for type safety.
Setup
- Copy
.env.exampleto.envin your project root:
- Fill in the required values for your environment
- Variables are validated in
src/config/env.ts
Validation
All environment variables are validated using Zod schemas:server object are only accessible server-side. Variables in client must be prefixed with NEXT_PUBLIC_ and are exposed to the browser.
Core Configuration
Database
PostgreSQL connection string used by Drizzle ORM.
Production database URL used when running migrations in production.
Application URL
Public URL of your application. Used for OAuth callbacks, email links, and API endpoints.Local development:Production:
Node Environment
Runtime environment. Values:
development, production, testValidated as:Client-side environment indicator exposed to the browser.
Authentication (Better-Auth)
Secret key used to encrypt sessions and sign tokens.Generate a secure secret:Never use the default in production!
Base URL of your application. Must match
NEXT_PUBLIC_APP_URL.Enable billing enforcement across the application.Validated as:
Require email verification for new user accounts.
OAuth Providers
All OAuth providers are optional. Configure only the ones you need.Google OAuth
Google OAuth client ID.Get credentials from: Google Cloud Console
Google OAuth client secret.
GitHub OAuth
GitHub OAuth application ID.Get credentials from: GitHub Developer Settings
GitHub OAuth application secret.
Microsoft OAuth
Microsoft/Azure AD application ID.Get credentials from: Azure Portal
Microsoft/Azure AD application secret.
Azure AD tenant ID. Use
common for multi-tenant applications.Facebook OAuth
Facebook app ID.Get credentials from: Facebook Developers
Facebook app secret.
Email Configuration
Email service provider to use for transactional emails.Options: Set to
resend, postmark, nodemailer, plunk, custom, logValidated as:log in development to print emails to console.Email Defaults
Default sender email address for outgoing emails.
Default sender name for outgoing emails.
Resend (Recommended)
Verified domain for sending emails via Resend.
Postmark
Plunk
Plunk API key.Get from: Plunk Settings
SMTP / Nodemailer
SMTP server hostname.
SMTP server port.Validated as:Common ports:
587 (TLS), 465 (SSL), 25 (unencrypted)SMTP authentication username.
SMTP authentication password.
Enable TLS/SSL. Set to
"true" for port 465, "false" for port 587.Payment Providers
ShipFree supports multiple payment providers. Configure only the one you’re using.Payment provider to use for billing and subscriptions.Options:
stripe, polar, lemonsqueezyValidated as:Stripe
Stripe webhook signing secret (starts with
whsec_).Used to verify webhook events from Stripe.Default Stripe price ID for subscriptions.
Stripe Price IDs (Public)
These are exposed to the client for displaying pricing.Stripe price ID for Starter plan (monthly billing).
Stripe price ID for Starter plan (yearly billing).
Stripe price ID for Pro plan (monthly billing).
Stripe price ID for Pro plan (yearly billing).
Stripe price ID for Enterprise plan (monthly billing).
Stripe price ID for Enterprise plan (yearly billing).
Polar
Polar API access token.Get from: Polar Settings
Polar webhook secret for verifying webhook events.
Your Polar organization ID.
Polar product ID for subscriptions.
Polar environment.Options:
production, sandboxValidated as:Polar Product IDs (Public)
Polar product ID for Starter plan (monthly).
Polar product ID for Pro plan (monthly).
Polar product ID for Enterprise plan (monthly).
Lemon Squeezy
Lemon Squeezy API key.Get from: Lemon Squeezy Settings
Your Lemon Squeezy store ID.
Lemon Squeezy webhook secret.
Lemon Squeezy Product IDs (Public)
Lemon Squeezy product ID for Starter plan (monthly).
Lemon Squeezy product ID for Pro plan (monthly).
Lemon Squeezy product ID for Enterprise plan (monthly).
Cloudflare R2 Storage
Optional file storage using Cloudflare R2 (S3-compatible).Your Cloudflare account ID.Get from: Cloudflare R2 Dashboard
R2 access key ID.
R2 secret access key.
R2 bucket URL.
Public storage domain for accessing files.
Name of the public R2 bucket.
Name of the private R2 bucket.
Observability
Sentry
Sentry DSN for error tracking (server-side).
Sentry DSN for client-side error tracking.
Sentry authentication token for uploading source maps.
Premium Template Purchase
These variables are for the premium template purchase feature. This is completely separate from your application’s payment system and can be removed if not needed. See the README for removal instructions.
Stripe secret key for template purchases (separate from app payments).
Stripe price ID for the one-time $90 premium template purchase.
Webhook secret for premium purchase webhooks.
Stripe publishable key for template purchases (client-side).
Discord invite link for premium template purchasers.
Utility Functions
ShipFree provides utility functions for working with environment variables insrc/config/feature-flags.ts:
Type Safety
Access environment variables through the validatedenv object:
env object ensures:
- All required variables are present at build time
- Values match expected types (string, number, boolean, enum)
- Default values are applied
- Client variables are properly prefixed