Skip to content

Environment Variables

This page lists all environment variables required and optional for running 2KRIKA.

Required Variables

Application

Variable Description Example
NODE_ENV Application environment development, production, test
PORT Server port 3000
APP_NAME Application name 2KRIKA
FRONTEND_URL Frontend application URL http://localhost:5173

Database

Variable Description Example
SQL_DATABASE_URL SQL database connection string postgres://user:pass@localhost:5432/2krika
MONGODB_URI MongoDB connection string mongodb://localhost:27017/2krika
REDIS_URL Redis connection string redis://localhost:6379

Authentication

Variable Description Example
JWT_SECRET Secret key for JWT tokens your-super-secret-jwt-key
JWT_ACCESS_EXPIRES_IN JWT access token expiration time 7d, 24h
JWT_REFRESH_EXPIRES_IN JWT refresh token expiration time 7d, 30d

Email

Variable Description Example
MAIL_HOST Email service provider smtp.gmail.com
MAIL_USERNAME Email account username your-email@gmail.com
MAIL_PASSWORD Email account password your-app-password
MAIL_FROM Default sender email noreply@2krika.com

Payment Gateway (Paystack)

Variable Description Example
PAYSTACK_SECRET_KEY Paystack secret key sk_test_xxxxx

Optional Variables

Storage

Variable Description Default
APP_STORAGE_DIR File upload directory ./storage/uploads

Logging

Variable Description Default
APP_LOG_FILE Application log file path logs/combined.log
APP_ERROR_LOG_FILE Error log file path logs/error.log
APP_QUERY_LOG_FILE Database query log file logs/query.log

CORS

Variable Description Default
ALLOWED_ORIGINS Comma-separated list of allowed origins http://localhost:3000

Example ENV File

Create an ENV file in your project root:

# Application
export NODE_ENV=development
export PORT=3000
export APP_NAME="2KRIKA"
export FRONTEND_URL="http://localhost:5173"

# Database
export SQL_DATABASE_URL="sqlite:///$(pwd)/db.sqlite"
export MONGODB_URI="mongodb://localhost:27017/2krika"
export REDIS_URL="redis://localhost:6379"

# Authentication
export JWT_SECRET="your-super-secret-jwt-key-change-in-production"
export JWT_EXPIRES_IN="7d"

# Email
export MAIL_HOST="smtp.gmail.com"
export MAIL_USERNAME="your-email@gmail.com"
export MAIL_PASSWORD="your-app-password"
export MAIL_FROM="noreply@2krika.com"

# Payment Gateway
export PAYSTACK_SECRET_KEY="sk_test_xxxxx"

# Storage
export APP_STORAGE_DIR="./storage/uploads"

# Logging
export APP_LOG_FILE="logs/combined.log"
export APP_ERROR_LOG_FILE="logs/error.log"
export APP_QUERY_LOG_FILE="logs/query.log"

# CORS
export ALLOWED_ORIGINS="http://localhost:3000 http://localhost:5173"

Load the variables:

source ENV

Security Notes

Security

  • Never commit .env or ENV files to version control
  • Use strong, unique values for JWT_SECRET in production
  • Rotate secrets regularly
  • Use environment-specific values for different deployments

Next Steps