Env Variables
Configure environment variables for Plainform
Environment variables are essential for configuring Plainform Dev's integrations and ensuring secure, environment-specific settings.
Plainform uses the t3-env library to validate these variables at runtime and build time.
If any required variables are missing or invalid, the application won't start, preventing potential errors or security issues. This validation enforces type safety and required fields, making your setup more reliable.
To set up your environment variables:
Create a .env file in the project root (or use .env.local for
development).
Populate it with the necessary values from your service providers.
The t3-env schema (typically in a file like env.mjs) will automatically
validate them when you run the app.
Application
The env variables your application needs to run.
Application Variables
| Env Variable | Type | Default |
|---|---|---|
SITE_URL? | string | http://localhost:3000 |
NEXT_PUBLIC_SITE_URL? | string | http://localhost:3000 |
Clerk (Authentication)
Reference: Clerk Environment Variables;
Clerk handles user authentication and management. Set these variables to enable secure sign-ups, logins, and sessions.
Clerk Variables
| Env Variable | Type | Default |
|---|---|---|
NEXT_PUBLIC_CLERK_SIGN_IN_URL | string | /sign-in |
NEXT_PUBLIC_CLERK_SIGN_UP_URL | string | /sign-up |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | string | pk_test_xxxx |
CLERK_SECRET_KEY | string | sk_test_xxxx |
Stripe (Payments)
Stripe enables payment processing and subscriptions. Set these in your .env to handle transactions securely via the lib/stripe folder.
Stripe Variables
| Env Variable | Type | Default |
|---|---|---|
STRIPE_SECRET_KEY | string | sk_test_xxxx |
STRIPE_PUBLISHABLE_KEY | string | pk_test_xxxx |
STRIPE_WEBHOOK_SECRET | string | whsec_xxxx |
Supabase (Backend)
Reference: Supabase Environment Variables
Supabase provides PostgreSQL database, authentication, and storage. These variables connect your app to Supabase for data persistence and file uploads.
Supabase Variables
| Env Variable | Type | Default |
|---|---|---|
DATABASE_URL | string | postgresql://user:password@host:port/dbname/postgres?pgbouncer=true |
DIRECT_URL | string | postgresql://user:password@host:port/dbname/postgres |
AWS S3 (Storage)
Reference: AWS Environment Variables
AWS integration (e.g., via S3 for file storage) requires credentials for secure cloud operations. These are used in the lib/amazon folder for services like S3 buckets.
AWS S3 Variables
| Env Variable | Type | Default |
|---|---|---|
AWS_ACCESS_KEY_ID | string | - |
AWS_SECRET_ACCESS_KEY | string | - |
AWS_S3_ENDPOINT | string | https://<yourAppName>.s3.<region>.amazonaws.com |
AWS_S3_REGION | string | - |
AWS_S3_BUCKET | string | - |
Resend (Emails)
Reference: Resend API Keys Introduction
Resend is used for sending transactional emails (via lib/resend). This integration requires an API key for email delivery.
Resend Variables
| Env Variable | Type | Default |
|---|---|---|
RESEND_API_KEY | string | re_xxxx |
RESEND_AUDIENCE_ID | string | - |
PostHog (Analytics)
Reference: PostHog Environment Variables
PostHog tracks user behavior and analytics to monitor app performance and usage.
Posthog Variables
| Env Variable | Type | Default |
|---|---|---|
NEXT_PUBLIC_POSTHOG_KEY | string | phc_xxxx |
NEXT_PUBLIC_POSTHOG_HOST | string | https://us.i.posthog.com |
How is this guide ?
Last updated on