Development Server Configuration

Development server configuration in Azu CLI manages the development environment, including hot reloading, file watching, debugging options, and development-specific settings. This enables fast development cycles with automatic rebuilding and reloading.

Overview

The development server provides:

  • Hot Reloading: Automatic rebuild and restart on file changes

  • File Watching: Monitor source files for changes

  • Live Reloading: Browser refresh on template changes

  • Debug Mode: Enhanced debugging capabilities

  • Development Tools: Built-in development utilities

Development Server Configuration Structure

Base Development Configuration

# config/development.yml
development:
  # Server settings
  server:
    host: <%= ENV["AZU_HOST"] || "localhost" %>
    port: <%= ENV["AZU_PORT"] || 4000 %>
    workers: 1
    backlog: 1024

  # Hot reloading
  hot_reload:
    enabled: true
    rebuild_on_change: true
    restart_on_change: true
    browser_reload: true

  # File watching
  file_watcher:
    enabled: true
    watch_paths:
      - src/
      - config/
      - public/templates/
    ignored_paths:
      - .git/
      - node_modules/
      - .crystal/
      - bin/
      - tmp/
      - log/
    ignored_extensions:
      - .tmp
      - .swp
      - .swo

  # Compilation
  compilation:
    incremental: true
    parallel: true
    cache_dir: .crystal/
    debug: true
    warnings: true

  # Debugging
  debugging:
    enabled: true
    port: 5005
    suspend: false
    log_level: debug

  # Development tools
  tools:
    inspector: true
    profiler: true
    memory_tracker: true
    performance_monitor: true

Server Configuration

Basic Server Settings

Advanced Server Settings

Hot Reloading Configuration

Hot Reload Settings

Hot Reload Implementation

File Watching Configuration

File Watcher Settings

File Watcher Implementation

Compilation Configuration

Compilation Settings

Compiler Implementation

Debugging Configuration

Debug Settings

Debug Implementation

Development Tools Configuration

Development Tools

Environment-Specific Configuration

Development Environment

Test Environment

Development Server Commands

Server Management Commands

Development Tools Commands

Environment Variables

Development Environment Variables

Best Practices

Development Workflow

  1. Hot Reloading: Enable hot reloading for fast development cycles

  2. File Watching: Configure appropriate watch paths and ignored paths

  3. Incremental Compilation: Use incremental compilation for faster builds

  4. Debug Mode: Enable debug mode during development

  5. Development Tools: Use built-in development tools for debugging

Performance

  1. Watch Paths: Limit watch paths to necessary directories

  2. Ignored Paths: Exclude unnecessary directories from watching

  3. Debouncing: Use appropriate debounce times for file changes

  4. Compilation Cache: Enable compilation caching

  5. Parallel Compilation: Use parallel compilation when possible

Debugging

  1. Debug Mode: Enable debug mode for detailed error information

  2. Profiling: Use profiling tools to identify performance bottlenecks

  3. Memory Tracking: Monitor memory usage during development

  4. Logging: Use appropriate log levels for debugging

  5. Error Handling: Implement proper error handling and reporting

Last updated