Environment Variables Reference
Configuration reference for Almafrica services.
Backend (.NET)
File: backend/.env or environment
Database
| Variable | Required | Description | Example |
|---|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string | Host=localhost;Database=almafrica;Username=postgres;Password=secret |
DATABASE_POOL_SIZE | No | Connection pool size | 100 |
Authentication
| Variable | Required | Description | Example |
|---|---|---|---|
JWT_SECRET | Yes | Secret key for JWT signing | your-256-bit-secret-key-here |
JWT_EXPIRY_HOURS | No | Token expiration time | 24 |
JWT_ISSUER | No | Token issuer | almafrica-api |
JWT_AUDIENCE | No | Token audience | almafrica-web |
Application
| Variable | Required | Description | Example |
|---|---|---|---|
ASPNETCORE_ENVIRONMENT | Yes | Environment name | Development, Staging, Production |
ASPNETCORE_URLS | No | Listen URLs | http://localhost:5000 |
CORS_ORIGINS | No | Allowed CORS origins (comma-separated) | http://localhost:3000,https://app.almafrica.com |
Email (Optional)
| Variable | Required | Description | Example |
|---|---|---|---|
SMTP_HOST | No | SMTP server host | smtp.gmail.com |
SMTP_PORT | No | SMTP port | 587 |
SMTP_USER | No | SMTP username | noreply@almafrica.com |
SMTP_PASSWORD | No | SMTP password | app-password |
EMAIL_FROM | No | From email address | noreply@almafrica.com |
Storage (Optional)
| Variable | Required | Description | Example |
|---|---|---|---|
STORAGE_TYPE | No | Storage backend | local, s3, azure |
S3_BUCKET | No | S3 bucket name | almafrica-uploads |
S3_REGION | No | S3 region | us-east-1 |
AWS_ACCESS_KEY_ID | No | AWS access key | AKIA... |
AWS_SECRET_ACCESS_KEY | No | AWS secret key | ... |
Web Dashboard (Next.js)
File: web/almafrica-web/.env.local
API Configuration
| Variable | Required | Description | Example |
|---|---|---|---|
NEXT_PUBLIC_API_URL | Yes | Backend API URL | http://localhost:5000 |
NEXT_PUBLIC_API_TIMEOUT | No | API request timeout (ms) | 30000 |
Application
| Variable | Required | Description | Example |
|---|---|---|---|
NEXT_PUBLIC_APP_NAME | No | Application name | Almafrica |
NEXT_PUBLIC_APP_URL | No | Application URL | http://localhost:3000 |
NEXT_PUBLIC_ENVIRONMENT | No | Environment name | development |
Authentication
| Variable | Required | Description | Example |
|---|---|---|---|
AUTH_SECRET | Yes | NextAuth secret | your-secret-key |
Analytics (Optional)
| Variable | Required | Description | Example |
|---|---|---|---|
NEXT_PUBLIC_GA_ID | No | Google Analytics ID | G-XXXXXXXXXX |
NEXT_PUBLIC_SENTRY_DSN | No | Sentry DSN | https://...@sentry.io/... |
Mobile App (Flutter)
Configuration in: mobile/mon_jardin/lib/core/config/
API Configuration
| Variable | Required | Description | Example |
|---|---|---|---|
API_BASE_URL | Yes | Backend API URL | https://api.almafrica.com |
API_TIMEOUT | No | Request timeout (seconds) | 30 |
Sync Configuration
| Variable | Required | Description | Example |
|---|---|---|---|
SYNC_INTERVAL | No | Background sync interval (minutes) | 15 |
OFFLINE_MODE | No | Force offline mode for testing | false |
MAX_RETRIES | No | Max sync retry attempts | 3 |
Docker Compose
File: docker-compose.local.yml, docker-compose.staging.yml, etc.
PostgreSQL
| Variable | Default | Description |
|---|---|---|
POSTGRES_USER | postgres | Database username |
POSTGRES_PASSWORD | postgres | Database password |
POSTGRES_DB | almafrica | Database name |
Redis (if used)
| Variable | Default | Description |
|---|---|---|
REDIS_PASSWORD | - | Redis password |
Environment-Specific Values
Development
ASPNETCORE_ENVIRONMENT=Development
NEXT_PUBLIC_API_URL=http://localhost:5000
DATABASE_URL=Host=localhost;Database=almafrica_dev;Username=postgres;Password=postgres
Staging
ASPNETCORE_ENVIRONMENT=Staging
NEXT_PUBLIC_API_URL=https://api-staging.almafrica.com
DATABASE_URL=Host=staging-db;Database=almafrica;Username=...
Production
ASPNETCORE_ENVIRONMENT=Production
NEXT_PUBLIC_API_URL=https://api.almafrica.com
DATABASE_URL=Host=prod-db;Database=almafrica;Username=...
Security Notes
- Never commit
.envfiles to version control - Rotate secrets regularly, especially after team member changes
- Use strong, unique JWT secrets (256+ bits)
- Restrict database access by IP in production
- Use managed secrets in cloud deployments (AWS Secrets Manager, Azure Key Vault)