Overview
Lawn requires several environment variables to integrate with external services. These variables are used for authentication, video processing, payments, and backend functionality.Required Services
To run Lawn, you’ll need accounts with:- Convex - Backend and database (convex.dev)
- Clerk - Authentication (clerk.com)
- Mux - Video processing and streaming (mux.com)
- Stripe - Payment processing (stripe.com)
Environment Variables
Convex
Convex provides the backend infrastructure and database for Lawn.Create a Convex project
Sign up at convex.dev and create a new project.
Get your deployment URL
Run
bunx convex dev in your project directory. The CLI will provide your VITE_CONVEX_URL.For production deployments, you’ll also need
CONVEX_DEPLOY_KEY. See the Deployment guide for details.Clerk
Clerk handles user authentication and management.Create a Clerk application
Sign up at clerk.com and create a new application.
Mux
Mux handles video upload, processing, transcoding, and streaming.Create a Mux account
Sign up at mux.com and create a new environment.
Generate API access tokens
Go to Settings > Access Tokens and create a new token with Video permissions. This gives you
MUX_TOKEN_ID and MUX_TOKEN_SECRET.Create signing keys
Go to Settings > Signing Keys and create a new key. This gives you
MUX_SIGNING_KEY (key ID) and MUX_PRIVATE_KEY (private key).Legacy variable names: Lawn also supports
MUX_SIGNING_KEY_ID and MUX_SIGNING_PRIVATE_KEY for backward compatibility.Private Key Format
TheMUX_PRIVATE_KEY should be the full private key from Mux. If you’re setting it in Vercel or another platform that doesn’t support multiline values, you can use \n for line breaks:
\n to actual newlines.
Stripe
Stripe manages subscriptions and payments for Lawn’s pricing plans.Create a Stripe account
Sign up at stripe.com and complete account setup.
Create pricing plans
Go to Products and create two products with monthly subscriptions:
- Basic plan
- Pro plan
Configure webhooks
Go to Developers > Webhooks and add your Convex Stripe webhook endpoint:Listen for these events:
customer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.payment_succeededinvoice.payment_failed
STRIPE_WEBHOOK_SECRET.Example .env File
Here’s a complete example of a.env file for local development:
Convex Environment Variables
Some environment variables need to be configured in Convex directly:Open Convex dashboard
Navigate to your project at dashboard.convex.dev
Add environment variables
Go to Settings > Environment Variables and add:
CLERK_SECRET_KEYCLERK_JWT_ISSUER_DOMAIN(if using custom JWT)MUX_TOKEN_IDMUX_TOKEN_SECRETMUX_WEBHOOK_SECRETMUX_SIGNING_KEYMUX_PRIVATE_KEYSTRIPE_SECRET_KEYSTRIPE_WEBHOOK_SECRETSTRIPE_PRICE_BASIC_MONTHLYSTRIPE_PRICE_PRO_MONTHLY
Variables prefixed with
VITE_ are bundled into your frontend code and accessible in the browser. Only use this prefix for non-sensitive, public values.Production Considerations
When deploying to production:- Use production keys - Replace all test/development keys with production keys
- Secure storage - Use your platform’s secrets management (e.g., Vercel Environment Variables)
- Webhook URLs - Update all webhook URLs to point to your production Convex deployment
- CORS settings - Ensure Clerk and other services allow your production domain
Troubleshooting
Missing Environment Variable Errors
If you see errors like “Missing required environment variable”:- Ensure the variable is set in your
.envfile - Restart your dev server (
bun run dev) - For Convex variables, ensure they’re set in the Convex dashboard
Webhook Verification Failures
If webhooks from Mux or Stripe are failing:- Verify the webhook secret matches what’s in your service’s dashboard
- Ensure your Convex deployment URL is correct
- Check that the webhook endpoint is accessible (not behind a firewall)
Clerk Authentication Issues
If authentication isn’t working:- Verify both
VITE_CLERK_PUBLISHABLE_KEYandCLERK_SECRET_KEYare set - Ensure your domain is allowed in Clerk’s CORS settings
- Check that
CLERK_JWT_ISSUER_DOMAINmatches your Clerk instance
Next Steps
Installation
Set up Lawn for local development
Deployment
Deploy Lawn to production with Vercel
