Overview
Your Bible requires several environment variables to connect to external services including API.Bible, Google Gemini AI, Redis, and various authentication providers.Environment Variables
Create a.env file in your project root with the following variables:
API.Bible Configuration
Your Bible uses API.Bible to access multiple Bible translations and search capabilities.Getting Your API Key
Create an Account
Visit API.Bible and create a free account.
API.Bible Features Used
- Bible Translations: Access to multiple Bible versions
- Chapter Content: Retrieve full chapter text
- Verse Search: Keyword search across Bible text
- Metadata: Book names, chapter counts, and verse references
The free tier of API.Bible includes 1,000 requests per day, which is sufficient for most use cases.
Google Gemini AI Configuration
Google Gemini AI powers the AI story generation feature.Getting Your API Key
Access Google AI Studio
Go to Google AI Studio and sign in with your Google account.
Supported Models
Your Bible is configured to usegemini-1.5-flash by default, which provides:
- Fast response times
- Cost-effective operation
- High-quality story generation
- Support for long context windows
Usage and Costs
Gemini API pricing (as of 2024):- gemini-1.5-flash: Free tier includes 15 requests per minute
- gemini-1.5-pro: Free tier includes 2 requests per minute
The application includes rate limiting to prevent excessive API usage. See the Redis configuration section below.
Redis Configuration for Rate Limiting
Redis is used to implement rate limiting for the AI story generation feature, preventing abuse and managing API costs.Using Vercel KV (Recommended)
Create Vercel KV Database
- Go to your Vercel Dashboard
- Navigate to the Storage tab
- Create a new KV database
Using Upstash Redis
Alternatively, you can use Upstash Redis:Create Upstash Account
Sign up at Upstash and create a new Redis database.
Rate Limiting Rules
The application implements the following rate limits for story generation:- Per User: Limited number of story generations per hour
- Global: Maximum total generations across all users
Database Configuration
Your Bible uses PostgreSQL for storing user data, authentication information, notes, and other persistent data.Using Neon (Recommended)
Create Neon Account
Sign up at Neon for a free PostgreSQL database.
Alternative Database Providers
You can also use:- Vercel Postgres: Integrated with Vercel deployments
- Supabase: PostgreSQL with additional features
- Railway: Simple PostgreSQL hosting
- Self-hosted: Your own PostgreSQL instance
Ensure your database supports SSL connections, which is required by most hosting platforms.
Authentication Configuration
Better Auth Setup
Configure Better Auth for user authentication:GitHub OAuth (Optional)
If you want to enable GitHub login:Create OAuth App
Go to GitHub Developer Settings and create a new OAuth App.
Configure URLs
- Homepage URL:
http://localhost:5173(development) or your production URL - Callback URL:
http://localhost:5173/api/auth/callback/github
Convex Configuration
Convex is used for real-time data synchronization for collections, notes, and stories. See the Convex Setup Guide for detailed instructions.UploadThing Configuration (Optional)
If you plan to implement file upload features:Create UploadThing Account
Sign up at UploadThing.
UploadThing configuration is optional and only needed if you implement custom file upload features.
Environment-Specific Configuration
Development Environment
Production Environment
Verifying Configuration
After setting up your environment variables, verify the configuration:Configuration Checklist
Use this checklist to ensure all services are properly configured:- API.Bible API key obtained and added
- Google Gemini API key configured
- Redis/KV database created and connected
- PostgreSQL database provisioned
- Better Auth secret generated
- Better Auth URL set correctly
- Convex project created and linked
- GitHub OAuth configured (if using)
- All environment variables added to
.env - Application starts without errors
Troubleshooting
Missing Environment Variables
If you see errors about missing environment variables:- Check that your
.envfile is in the project root - Verify all required variables are present
- Restart your development server
Database Connection Issues
If the database fails to connect:- Verify the
DATABASE_URLformat is correct - Check that your database is running and accessible
- Ensure SSL mode is enabled if required
API Rate Limits
If you hit rate limits:- Check your usage on the respective service dashboards
- Consider upgrading to a paid tier if needed
- Verify rate limiting is working correctly with Redis
CORS Errors
If you encounter CORS issues:- Verify
BETTER_AUTH_URLmatches your current domain - Check that all API endpoints allow your origin
- Ensure callback URLs are correctly configured