azu serve
The azu serve command starts the development server with hot reloading capabilities. This is the primary command for development, automatically recompiling and restarting your application when files change.
Overview
azu serve [options]Basic Usage
Start Development Server
# Start server on default port (4000)
azu serve
# Start on custom port
azu serve --port 4000
# Start with specific environment
azu serve --env developmentDevelopment with Hot Reloading
# Start server with file watching
azu serve
# Output:
# π Starting Azu development server...
# π¦ Compiling application...
# β
Compilation successful!
# π Server running at: http://localhost:4000
# π₯ Hot reloading enabled
# π Watching for file changes...
#
# Press Ctrl+C to stop the serverCommand Options
--port <port>
Server port
4000
--host <host>
Server host
localhost
--no-watch
Disable file watching
false
--verbose
Enable verbose output
false
Development Server Features
Hot Reloading
The development server automatically detects file changes and recompiles your application:
Watched File Patterns:
src/**/*.cr- Crystal source filesconfig/**/*.cr- Configuration filespublic/templates/**/*.jinja- Jinja templatespublic/templates/**/*.html- HTML templatespublic/assets/**/*.css- CSS filespublic/assets/**/*.js- JavaScript files
Error Reporting
The server provides detailed error information during development:
Environment Configuration
Server Configuration
Port and Host
Verbose Mode
File Watching
Automatic File Detection
The server watches for changes in:
Manual File Watching
Performance Options
Worker Processes
Memory and CPU Limits
Environment-Specific Configuration
Development Environment
Production Environment
Examples
Basic Development
Custom Configuration
Team Development
Mobile Development
Troubleshooting
Port Already in Use
Compilation Errors
File Watching Issues
Memory Issues
SSL Certificate Issues
Best Practices
1. Development Workflow
2. Environment Management
3. Performance Optimization
4. Security
5. Monitoring
Integration with Other Tools
VS Code Integration
Docker Development
The azu serve command is essential for Azu development, providing a fast, reliable development server with hot reloading capabilities.
Next Steps:
Development Workflows - Learn development patterns
Database Commands - Manage your database
Generate Command - Create new components
Last updated