Overview
SmartEat AI uses environment variables for configuration. Copy.env.example to .env in the project root and customize the values for your environment.
Never commit the
.env file to version control. It contains sensitive credentials and should be kept secret.Database Configuration
PostgreSQL database connection settings.PostgreSQL username for database authentication.Default:
smarteataiExample: smarteataiPostgreSQL password for database authentication.Default:
smarteataiExample: my_secure_password_123Use a strong password in production environments.
Name of the PostgreSQL database.Default:
smarteataiExample: smarteataiFull PostgreSQL connection URL used by the backend.Format:
postgresql://[user]:[password]@[host]:[port]/[database]Default: postgresql://smarteatai:smarteatai@db:5432/smarteataiIn Docker, use
db as the host (service name). For local development, use localhost.ChromaDB Configuration
Vector database settings for recipe embeddings.Path to ChromaDB persistence directory for storing recipe embeddings.Default:
backend/app/data/chroma_db_recipesExample: backend/app/data/chroma_db_recipesChromaDB integration is currently not active in production. Queries use PostgreSQL directly instead.
Ollama model used for generating embeddings.Default:
llama3Example: llama3, llama3.1, mistralJWT Authentication
JSON Web Token configuration for user authentication.Secret key used to sign JWT tokens. Must be at least 32 characters.Default:
your-super-secret-key-change-this-in-production-min-32-charsSecurity: Generate a strong random key for production:CRITICAL: Change this value in production! Using the default key is a severe security risk.
Algorithm used for JWT token signing.Default:
HS256Options: HS256, HS384, HS512, RS256Number of minutes before access tokens expire.Default:
30Example: 30 (30 minutes), 1440 (24 hours)Backend Configuration
Backend service URLs.Base URL where the backend API is accessible.Default:
http://localhost:8000Example: http://localhost:8000, https://api.smarteatai.comBase URL where the frontend application is accessible.Default:
http://localhost:3000Example: http://localhost:3000, https://smarteatai.comUsed for CORS configuration and redirects.Ollama Configuration
Large Language Model (LLM) server settings.Name of the Ollama model to use for chat and recommendations.Default:
llama3.1Options: llama3, llama3.1, mistral, mixtral, phi3Note: Model must be downloaded first:Base URL for the Ollama API server.Default:
http://ollama:11434Example: http://ollama:11434 (Docker), http://localhost:11434 (Local)In Docker, use the service name
ollama. For local development, use localhost.Complete Example
Here’s a complete.env file example for development:
Environment-Specific Configuration
Development
Local (No Docker)
Production
Security Best Practices
Follow these security guidelines for production deployments:
-
Change Default Credentials
- Never use default database passwords
- Generate strong random passwords
-
Secure Secret Keys
- Generate a cryptographically secure
SECRET_KEY - Minimum 32 characters, use random bytes
- Generate a cryptographically secure
-
Environment Isolation
- Use different
.envfiles for dev/staging/production - Never commit
.envfiles to version control - Add
.envto.gitignore
- Use different
-
Token Expiration
- Use shorter expiration times for sensitive operations
- Balance security with user experience
-
HTTPS in Production
- Always use HTTPS URLs in production
- Enable SSL/TLS for database connections
Troubleshooting
Database Connection Failed
JWT Token Errors
Ollama Connection Issues
CORS Errors
Next Steps
- Follow the Installation guide to set up locally
- Use Docker Setup for containerized development
- Review the API documentation at http://localhost:8000/docs
