Environment Setup
Configure environment variables and set up essential services for your application.
Service Configuration
This guide will help you set up all the necessary environment variables and external services required by The Boring Template.
Create Environment Variables
Create a .env.local
file in your project root.
Keep your environment file secure and never commit it to version control.
You can generate a BETTER_AUTH_SECRET key here: Generate Secret Key
Environment Variables
Service Setup Guides
Database
Configure PostgreSQL with Neon.tech
Authentication
Set up OAuth providers (Google, GitHub)
Configure Resend for transactional emails
Storage
Set up AWS S3 for file uploads
Rate Limiting
Configure Upstash Redis for API protection
Payments
Set up Stripe for subscription management
Database Setup (Neon.tech)
Neon.tech provides a serverless PostgreSQL database with a generous free tier.
- Go to Neon.tech and create an account
- Create a new project
- Once created, go to the "Connection Details" tab
- Copy the connection string
- Replace
DATABASE_URL
in your.env.local
with the connection string
Email Setup (Resend)
Resend is a developer-friendly email API service built for sending transactional emails.
- Visit Resend and create an account
- Go to the API Keys section
- Generate a new API key
- Copy the API key and add it to
RESEND_API_KEY
in your.env.local
- Add your verified email address to
RESEND_EMAIL
Make sure to verify your domain or email in Resend's dashboard before sending emails.
File Storage Setup (AWS S3)
- Create an AWS Account if you don't have one
- Go to AWS IAM and create a new user with S3 access
- Generate Access Key and Secret Key
- Create a new S3 bucket
- Configure your
.env.local
with AWS credentials and bucket details
Important
Make sure to configure CORS settings in your S3 bucket to allow uploads from your application domain.
Rate Limiting Setup (Upstash Redis)
- Go to Upstash and create an account
- Create a new Redis database
- Go to the "REST API" section
- Copy the
UPSTASH_REDIS_REST_URL
andUPSTASH_REDIS_REST_TOKEN
- Add these values to your
.env.local
Payment Setup (Stripe)
- Create a Stripe account
- Get your API keys from the Stripe Dashboard
- Create your products and price IDs
- Set up webhook endpoints
- Add the Stripe credentials to your
.env.local
Authentication Setup (Google OAuth)
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the Google OAuth2 API
- Configure the OAuth consent screen
- Fill in the application details:
- App name: Your application name
- User support email: Your email address
- Developer contact information: Your email address
- Authorized domains: Add your domain (or localhost for development)
- Create OAuth 2.0 credentials (Web application type)
- Add authorized redirect URIs:
http://localhost:3000/api/auth/callback/google
(for development)https://your-domain.com/api/auth/callback/google
(for production)
- Copy the Client ID and Client Secret
- Add them to your
.env.local
as:
For production, make sure to verify your domain and add it to the authorized domains list.
Authentication Setup (GitHub OAuth)
- Go to GitHub Developer Settings
- Click on 'OAuth Apps' and then 'New OAuth App'
- Fill in the application details:
- Application name: Your app name
- Homepage URL:
http://localhost:3000
(or your production URL) - Authorization callback URL:
http://localhost:3000/api/auth/callback/github
- Click 'Register application'
- On the next screen, you'll see your Client ID
- Click 'Generate a new client secret' to create your Client Secret
- Copy the Client ID and Client Secret to your
.env.local
file - Add them to your
.env.local
as:
Make sure to keep your Client Secret secure and never expose it in client-side code.
Essential Services
The Boring Template relies on several external services to provide a complete SaaS solution:
Service | Description |
---|---|
🗄️ Database | PostgreSQL database for storing application data |
📧 Email Service | Transactional email service for notifications |
🔐 Authentication | OAuth providers for secure user authentication |
📁 File Storage | S3-compatible storage for user uploads |
⏱️ Rate Limiting | Redis-based rate limiting for API protection |
💳 Payments | Stripe integration for subscription management |
Troubleshooting
Common Issues
If you encounter any issues with your environment setup, check these common solutions:
- Ensure all environment variables are correctly set without any typos
- Verify that your API keys have the correct permissions
- Check that your OAuth redirect URIs exactly match your application URLs
- Confirm that your database connection string includes all required parameters
- For production, ensure all services are configured for your production domain