Environment Setup
Create a .env.local file in your project root.
You can generate a BETTER_AUTH_SECRET key here: Generate here
Environment Variables
.env.local
Terminal
Service Setup Guides
Database Setup (Neon.tech)
- 1Go to Neon.tech and create an account
- 2Create a new project
- 3Once created, go to the "Connection Details" tab
- 4Copy the connection string
- 5Replace DATABASE_URL in your .env.local with the connection string
Email Setup (Resend)
- 1Visit Resend and create an account
- 2Go to the API Keys section
- 3Generate a new API key
- 4Copy the API key and add it to RESEND_API_KEY in your .env.local
- 5Add your verified email address to RESEND_EMAIL
Make sure to verify your domain or email in Resend's dashboard
File Storage Setup (AWS S3)
- 1Create an AWS Account if you don't have one
- 2Go to AWS IAM and create a new user with S3 access
- 3Generate Access Key and Secret Key
- 4Create a new S3 bucket
- 5Configure your .env.local with AWS credentials and bucket details
Important: Make sure to configure CORS settings in your S3 bucket
Rate Limiting Setup (Upstash Redis)
- 1Go to Upstash and create an account
- 2Create a new Redis database
- 3Go to the βREST APIβ section
- 4Copy the UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN
- 5Add these values to your .env.local
Payment Setup (Stripe)
- 1Create a Stripe account
- 2Get your API keys from the Stripe Dashboard
- 3Create your products and price IDs
- 4Set up webhook endpoints
- 5Add the Stripe credentials to your .env.local
Authentication Setup (Google OAuth)
- 1Go to Google Cloud Console
- 2Create a new project or select an existing one
- 3Enable the Google OAuth2 API
- 4Configure the OAuth consent screen
- 5Fill 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)
- 6Create OAuth 2.0 credentials (Web application type)
- 7Add authorized redirect URIs:
- http://localhost:3000/api/auth/callback/google (for development)
- https://your-domain.com/api/auth/callback/google (for production)
- 8Copy the Client ID and Client Secret
- 9Add them to your .env.local as:
GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret
For production, make sure to verify your domain and add it to the authorized domains list
Authentication Setup (GitHub OAuth)
- 1Go to GitHub Developer Settings
- 2Click on 'OAuth Apps' and then 'New OAuth App'
- 3Fill 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
- 4Click 'Register application'
- 5On the next screen, you'll see your Client ID
- 6Click 'Generate a new client secret' to create your Client Secret
- 7Copy the Client ID and Client Secret to your .env.local file
- 8Add them to your .env.local as:
GITHUB_CLIENT_ID=your_github_client_id GITHUB_CLIENT_SECRET=your_github_client_secret
Make sure to keep your Client Secret secure and never expose it in client-side code
Essential Services
ποΈ
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