Skip to content

Configuration

This guide covers configuring AzharStore for different environments.

Environment Variables

AzharStore uses environment variables for configuration. See Environment Variables for a complete reference.

Required Variables

DATABASE_URL=postgresql://postgres:postgres@localhost:5432/medusa
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-jwt-secret
COOKIE_SECRET=your-cookie-secret
ADMIN_EMAIL=admin@azhar.store
ADMIN_PASSWORD=your-admin-password

CORS Configuration

STORE_CORS=http://localhost:3000,https://azhar.store
ADMIN_CORS=http://localhost:9000,https://admin.azhar.store

Development Configuration

For local development, use the .env.example as a template:

cp .env.example .env

Edit with your local values: - Use localhost for database and Redis - Use local frontend URLs for CORS - Use any strong secrets for JWT and cookies

Production Configuration

For production, create a production-specific .env:

cp .env.example .env.production

Production considerations: - Use strong, randomly generated secrets - Use production database and Redis instances - Use production URLs for CORS - Enable HTTPS - Use environment-specific secrets management

Medusa Configuration

The medusa-config.ts file contains additional configuration:

  • Database connection
  • Redis event bus
  • CORS settings
  • Module registration
  • Admin configuration

See the Infrastructure Guide for details.

Module Configuration

Custom modules are registered in medusa-config.ts:

modules: [
  {
    resolve: "./modules/advertisement"
  },
  {
    resolve: "./modules/settings"
  },
  {
    resolve: "./modules/translation"
  }
]

Frontend Configuration

The frontend uses VITE_API_BASE_URL to configure the API endpoint:

# In frontend/store/.env
VITE_API_BASE_URL=http://localhost:9000/store

Docker Configuration

Docker Compose configuration is in docker-compose.yml:

  • Service definitions
  • Volume mounts
  • Network configuration
  • Port mappings
  • Environment variables

See the Docker Services guide for details.

Validation

After configuration, validate:

  1. Check environment variables are loaded:

    docker compose config
    

  2. Test database connection:

    docker compose exec postgres pg_isready -U postgres
    

  3. Test Redis connection:

    docker compose exec redis redis-cli ping
    

  4. Test backend health:

    curl http://localhost:9000/health
    

Next Steps