RisWis Environment Variables for Production

This document lists all the environment variables used in the RisWis application for both backend and frontend components. These variables should be configured properly in your production environment.

Backend Environment Variables

Database Configuration

Variable
Description
Example

DATABASE_URL

PostgreSQL connection string

postgresql://user:password@host:port/database?sslmode=require

DATABASE_SSL

Whether to use SSL for database connections

true

DB_NAME

Database name

riswis_db

DB_USER

Database username

doadmin

DB_PASSWORD

Database password

your-password

DB_HOST

Database host

your-db-host.db.ondigitalocean.com

DB_PORT

Database port

25060

HOST

Backend host

api.example.com

DB_POOL_MAX

Maximum database connections

5

DB_POOL_MIN

Minimum database connections

0

DB_POOL_ACQUIRE

Connection acquisition timeout (ms)

30000

DB_POOL_IDLE

Idle connection timeout (ms)

10000

Server Configuration

Variable
Description
Example

PORT

Server port

5000

NODE_ENV

Environment (production/development)

production

API_PREFIX

API endpoint prefix

/api

API_URL

Full API URL

https://api.example.com/api

CORS_ORIGIN

Allowed origins for CORS

https://app.example.com,https://www.example.com

Authentication & Security

Variable
Description
Example

JWT_SECRET

Secret key for JWT tokens

your-secure-jwt-secret

JWT_EXPIRES_IN

JWT token expiration

7d

JWT_EXPIRES_IN_SECONDS

JWT expiration in seconds

86400

REFRESH_TOKEN_EXPIRY

Refresh token expiration

7d

ENCRYPTION_KEY

Key for encrypting sensitive data (32 chars)

C9rKLp7eQt2nMcD5sF8xA6zHj3bV1gYw

DISABLE_PERMISSION_CHECK

Disable RBAC (dev only)

false

API_SERVER_TOKEN

Token for internal API calls

your-secure-api-server-token

ADMIN_SECRET_TOKEN

Secret token for admin operations

your-admin-secret-token

Redis Configuration

Variable
Description
Example

REDIS_URL

Redis connection URL

rediss://default:password@host:port

REDIS_USERNAME

Redis username

default

REDIS_PASSWORD

Redis password

your-redis-password

REDIS_TLS_ENABLED

Whether Redis uses TLS

true

WebSocket Configuration

Variable
Description
Example

DISABLE_WEBSOCKET

Disable WebSocket functionality

false

WEBSOCKET_BYPASS_AUTH

Bypass WebSocket authentication (dev only)

false

WEBSOCKET_URL

WebSocket server URL

wss://api.example.com/ws

Logging & Monitoring

Variable
Description
Example

LOG_LEVEL

Log level (debug/info/warn/error)

info

LOG_DIR

Directory for log files

logs

Email Configuration

Variable
Description
Example

EMAIL_HOST

SMTP server host

smtp.gmail.com

EMAIL_PORT

SMTP server port

465

EMAIL_USER

SMTP username

your-email@example.com

EMAIL_PASSWORD

SMTP password

your-email-password

EMAIL_FROM

From address for emails

noreply@example.com

EMAIL_TO

Default recipient

admin@example.com

EMAIL_TEMPLATES_DIR

Email templates directory

./src/email-templates

EMAIL_TEMPLATES_CACHE_DIR

Email templates cache directory

./src/email-templates/cache

EMAIL_TEMPLATES_CACHE_TTL

Email templates cache TTL (ms)

3600000

SMS Gateway Configuration

Variable
Description
Example

AFRICAS_TALKING_API_URL

Africa's Talking API URL

https://api.africastalking.com/version1/messaging

AFRICAS_TALKING_API_KEY

Africa's Talking API key

your-africas-talking-api-key

AFRICAS_TALKING_USERNAME

Africa's Talking username

your-username

SMS_SENDER_ID

SMS sender ID

RisWis

SMS_CONFIG_PATH

SMS configuration file path

config/sms-config.json

SMS_TEST_MODE

Enable SMS test mode

false

ENABLE_SMS_NOTIFICATIONS

Enable SMS notifications

true

Mobile Money Configuration (MTN MoMo)

Variable
Description
Example

MOMO_ENVIRONMENT

MoMo environment (sandbox/production)

production

MOMO_API_URL

MoMo API URL

https://api.momodeveloper.mtn.com

MOMO_API_USER_ID

MoMo API user ID

your-momo-user-id

MOMO_API_KEY

MoMo API key

your-momo-api-key

MOMO_API_SECRET

MoMo API secret

your-momo-api-secret

MOMO_PRIMARY_KEY

MoMo primary key

your-momo-primary-key

MOMO_SECONDARY_KEY

MoMo secondary key

your-momo-secondary-key

MOMO_SUBSCRIPTION_KEY

MoMo subscription key

your-momo-subscription-key

MOMO_CALLBACK_URL

MoMo callback URL

https://api.example.com/api/momo/callback

RIA Money Transfer Configuration

Variable
Description
Example

RIA_API_USERNAME

RIA API username

your-ria-username

RIA_API_PASSWORD

RIA API password

your-ria-password

RIA_API_BASE_URL

RIA API base URL

https://api.riamoneytransfer.com

RIA_API_CLIENT_IP_ADDRESS

RIA API client IP address

your-client-ip

RIA_API_SERVER_IP_ADDRESS

RIA API server IP address

your-server-ip

Backup Configuration

Variable
Description
Example

BACKUP_DIR

Directory for backups

backups

BACKUP_RETENTION

Backup retention days

30

Feature Flags

Variable
Description
Example

OFFLINE_MODE

Enable offline mode

false

ENABLE_EMAIL_NOTIFICATIONS

Enable email notifications

true

ENABLE_PUSH_NOTIFICATIONS

Enable push notifications

true

Frontend Environment Variables

API Configuration

Variable
Description
Example

NEXT_PUBLIC_API_URL

Backend API URL

https://api.example.com/api

NEXT_PUBLIC_BACKEND_API_URL

Backend server URL

https://api.example.com

BACKEND_API_URL

Alternative backend API URL

https://api.example.com/api

BACKEND_URL

Alternative backend server URL

https://api.example.com

Authentication

Variable
Description
Example

NEXT_PUBLIC_JWT_SECRET

JWT secret (public)

your-public-jwt-secret

NEXT_AUTH_SECRET

NextAuth secret

your-nextauth-secret

NEXTAUTH_SECRET

NextAuth secret (alternative)

your-nextauth-secret

JWT_FALLBACK_SECRET

Fallback JWT secret

your-fallback-jwt-secret

NEXT_PUBLIC_JWT_FALLBACK_SECRET

Public fallback JWT secret

your-public-fallback-jwt-secret

WebSocket Configuration

Variable
Description
Example

NEXT_PUBLIC_DISABLE_WEBSOCKET

Disable WebSocket

true

NEXT_PUBLIC_WEBSOCKET_URL

WebSocket URL

wss://api.example.com/ws

NEXT_PUBLIC_ENABLE_SSE

Enable Server-Sent Events

true

NEXT_PUBLIC_USE_SMART_POLLING

Enable smart polling

true

NEXT_PUBLIC_POLLING_BASE_INTERVAL

Polling interval (ms)

15000

Mobile Money (MoMo) Configuration

Variable
Description
Example

NEXT_PUBLIC_MOMO_API_KEY

MoMo API key (public)

your-momo-api-key

NEXT_PUBLIC_MOMO_USER_ID

MoMo user ID (public)

your-momo-user-id

NEXT_PUBLIC_MOMO_PRIMARY_KEY

MoMo primary key (public)

your-momo-primary-key

NEXT_PUBLIC_MOMO_ENVIRONMENT

MoMo environment (public)

production

NEXT_PUBLIC_MOMO_CALLBACK_URL

MoMo callback URL (public)

https://app.example.com/api/momo/callback

NEXT_PUBLIC_RIA_API_BASE_URL

RIA API base URL (public)

https://api.riamoneytransfer.com

Application Configuration

Variable
Description
Example

NEXT_PUBLIC_APP_VERSION

Application version

1.0.0

NEXT_PUBLIC_LOG_LEVEL

Client-side log level

info

NEXT_PUBLIC_DISABLE_PERMISSION_CHECK

Disable permission checks (public)

false

NEXT_PUBLIC_ENABLE_DEVTOOLS

Enable developer tools

false

NEXT_PUBLIC_DISABLE_RATE_LIMIT

Disable rate limiting

false

NEXT_PUBLIC_OFFLINE_MODE

Enable offline mode (public)

false

Redis Configuration (Frontend)

Variable
Description
Example

REDIS_URL

Redis URL for frontend

redis://localhost:6379

NEXT_PUBLIC_REDIS_URL

Public Redis URL

redis://localhost:6379

Deployment Notes

  1. In production, all sensitive credentials should be provided as secure environment variables.

  2. Variables with NEXT_PUBLIC_ prefix are exposed to the browser and should NOT contain sensitive information.

  3. Backend variables should be kept secure and never exposed to the client.

  4. Variable values shown are examples only. Use strong, unique values in production.

Reference Files

For implementation details, refer to these configuration files:

  • backend/.env.production

  • frontend/.env.production

  • backend/src/config/index.ts

  • frontend/src/lib/config.ts

Last updated