Configuration
Learn how to configure your SaaS boilerplate for development and production environments.
Environment Variables
Your boilerplate requires several environment variables to function properly. Copy .env.example
to .env.local
and configure the following:
Required Variables
# App Configuration
NEXT_PUBLIC_APP_NAME="Your SaaS App"
NEXT_PUBLIC_APP_URL="http://localhost:3000"
# Convex Backend
CONVEX_DEPLOYMENT=
NEXT_PUBLIC_CONVEX_URL=
# Authentication
AUTH_SECRET= # Generate with: openssl rand -base64 32
# Google OAuth (Optional)
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
# Stripe Payments
STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
# Email (Resend)
RESEND_API_KEY=
# File Storage
NEXT_PUBLIC_CONVEX_SITE_URL=
Optional Variables
# Analytics (Optional)
NEXT_PUBLIC_GA_MEASUREMENT_ID=
# Feature Flags
NEXT_PUBLIC_ENABLE_BETA_FEATURES=false
# Development
NODE_ENV=development
App Configuration
The main app configuration is located in config/app.ts
. This file contains:
Basic Settings
export const appConfig = {
name: 'Your SaaS App',
description: 'Build amazing SaaS applications faster',
url: process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000',
// Social Links
social: {
twitter: 'https://twitter.com/yourapp',
github: 'https://github.com/yourorg/yourapp',
},
// Feature Flags
features: {
enableBetaFeatures: process.env.NEXT_PUBLIC_ENABLE_BETA_FEATURES === 'true',
enableAnalytics: !!process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID,
},
};
Subscription Plans
Configure your subscription plans in config/plans.ts
:
export const plans = [
{
id: 'free',
name: 'Free',
description: 'Perfect for getting started',
price: 0,
features: ['1 workspace', 'Up to 5 team members', 'Basic features'],
stripePriceId: null,
},
{
id: 'pro',
name: 'Pro',
description: 'For growing teams',
price: 19,
features: [
'Unlimited workspaces',
'Unlimited team members',
'Advanced features',
'Priority support',
],
stripePriceId: 'price_pro_monthly',
},
];
Database Configuration
Your Convex schema is defined in convex/schema.ts
. The boilerplate includes:
- Users - User accounts and profiles
- Workspaces - Multi-tenant workspaces
- Members - Workspace membership
- Subscriptions - Billing and subscription data
- Notifications - Real-time notifications
- Activity - Audit logs and activity tracking
Authentication Providers
Configure authentication providers in convex/auth.config.ts
:
export default {
providers: [
Google({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
// Add more providers as needed
],
};
Email Configuration
Email templates are configured in config/email.ts
. The boilerplate supports:
- Welcome emails
- Workspace invitations
- Password reset emails
- Billing notifications
- Activity summaries
Development vs Production
Development Settings
For local development, ensure:
NODE_ENV=development
- Convex deployment in dev mode
- Stripe test keys
- Local file storage
Production Settings
For production deployment:
NODE_ENV=production
- Convex production deployment
- Stripe live keys
- Secure environment variables
- CDN configuration
Custom Configuration
You can extend the configuration by:
- Adding new environment variables
- Updating the app config object
- Creating feature flags
- Customizing email templates
- Modifying subscription plans
Security Considerations
- Never commit
.env.local
to version control - Use strong, unique secrets for production
- Rotate API keys regularly
- Enable webhook signature verification
- Configure CORS policies appropriately
Next: Learn about Authentication setup and user management.
Last updated on