Skip to main content

Environment Variables Reference

Configuration reference for Almafrica services.

Backend (.NET)

File: backend/.env or environment

Database

VariableRequiredDescriptionExample
DATABASE_URLYesPostgreSQL connection stringHost=localhost;Database=almafrica;Username=postgres;Password=secret
DATABASE_POOL_SIZENoConnection pool size100

Authentication

VariableRequiredDescriptionExample
JWT_SECRETYesSecret key for JWT signingyour-256-bit-secret-key-here
JWT_EXPIRY_HOURSNoToken expiration time24
JWT_ISSUERNoToken issueralmafrica-api
JWT_AUDIENCENoToken audiencealmafrica-web

Application

VariableRequiredDescriptionExample
ASPNETCORE_ENVIRONMENTYesEnvironment nameDevelopment, Staging, Production
ASPNETCORE_URLSNoListen URLshttp://localhost:5000
CORS_ORIGINSNoAllowed CORS origins (comma-separated)http://localhost:3000,https://app.almafrica.com

Email (Optional)

VariableRequiredDescriptionExample
SMTP_HOSTNoSMTP server hostsmtp.gmail.com
SMTP_PORTNoSMTP port587
SMTP_USERNoSMTP usernamenoreply@almafrica.com
SMTP_PASSWORDNoSMTP passwordapp-password
EMAIL_FROMNoFrom email addressnoreply@almafrica.com

Storage (Optional)

VariableRequiredDescriptionExample
STORAGE_TYPENoStorage backendlocal, s3, azure
S3_BUCKETNoS3 bucket namealmafrica-uploads
S3_REGIONNoS3 regionus-east-1
AWS_ACCESS_KEY_IDNoAWS access keyAKIA...
AWS_SECRET_ACCESS_KEYNoAWS secret key...

Web Dashboard (Next.js)

File: web/almafrica-web/.env.local

API Configuration

VariableRequiredDescriptionExample
NEXT_PUBLIC_API_URLYesBackend API URLhttp://localhost:5000
NEXT_PUBLIC_API_TIMEOUTNoAPI request timeout (ms)30000

Application

VariableRequiredDescriptionExample
NEXT_PUBLIC_APP_NAMENoApplication nameAlmafrica
NEXT_PUBLIC_APP_URLNoApplication URLhttp://localhost:3000
NEXT_PUBLIC_ENVIRONMENTNoEnvironment namedevelopment

Authentication

VariableRequiredDescriptionExample
AUTH_SECRETYesNextAuth secretyour-secret-key

Analytics (Optional)

VariableRequiredDescriptionExample
NEXT_PUBLIC_GA_IDNoGoogle Analytics IDG-XXXXXXXXXX
NEXT_PUBLIC_SENTRY_DSNNoSentry DSNhttps://...@sentry.io/...

Mobile App (Flutter)

Configuration in: mobile/mon_jardin/lib/core/config/

API Configuration

VariableRequiredDescriptionExample
API_BASE_URLYesBackend API URLhttps://api.almafrica.com
API_TIMEOUTNoRequest timeout (seconds)30

Sync Configuration

VariableRequiredDescriptionExample
SYNC_INTERVALNoBackground sync interval (minutes)15
OFFLINE_MODENoForce offline mode for testingfalse
MAX_RETRIESNoMax sync retry attempts3

Docker Compose

File: docker-compose.local.yml, docker-compose.staging.yml, etc.

PostgreSQL

VariableDefaultDescription
POSTGRES_USERpostgresDatabase username
POSTGRES_PASSWORDpostgresDatabase password
POSTGRES_DBalmafricaDatabase name

Redis (if used)

VariableDefaultDescription
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

  1. Never commit .env files to version control
  2. Rotate secrets regularly, especially after team member changes
  3. Use strong, unique JWT secrets (256+ bits)
  4. Restrict database access by IP in production
  5. Use managed secrets in cloud deployments (AWS Secrets Manager, Azure Key Vault)