jaspr serve command starts a development server with hot reload capabilities, allowing you to see changes instantly as you code.
Basic Usage
- Server runs on
http://localhost:8080 - Hot reload enabled for both client and server code
- Automatic browser refresh on changes
Hot Reload
Jaspr provides intelligent hot reload for both client and server code:- Client Hot Reload
- Server Hot Reload
Changes to client-side code trigger automatic browser updates:
- Module reload (default) - Reloads JavaScript modules without full page refresh
- Full refresh - Performs complete page reload including server restart
Server Options
Specify the port for the development server.You can also set the default port in
pubspec.yaml:Specify the server entry point file. Must end in By default, the CLI searches for:
.server.dart.lib/main.server.dart- First
*.server.dartfile inbin/ - First
*.server.dartfile inlib/
Specify the port for the internal webdev server.
Change this if running multiple Jaspr projects simultaneously.
Specify the port for the internal proxy server.
Change this if running multiple Jaspr projects simultaneously.
Reload Modes
Sets the reload/refresh behavior when files change.Options:
reload- Reloads JavaScript modules without server reload (loses current state)refresh- Performs full page refresh and server reload
- Refresh Mode (Default)
- Reload Mode
Full page refresh including server restart on file changes.Pros:
- Ensures complete state refresh
- More reliable for complex changes
- Restarts server with new code
- Loses current application state
- Slightly slower than reload
Build Configuration
Serve the app in debug mode with pause on start.The server will pause on startup, waiting for a debugger to attach.
Serve the app in release mode with optimizations.Changes:
- Compiles with
dart2jsinstead ofdartdevc - Disables server hot reload
- Enables all optimizations
- Removes assert statements
Compile to WebAssembly instead of JavaScript.
Browser Integration
Automatically launch the app in Chrome with debugging enabled.This enables:
- Automatic Chrome launch
- Dart DevTools integration
- VM service for debugging
Advanced Options
Skip running the server, only run the client workflow.
Let Jaspr manage build_runner options automatically.Disable this to manually configure builders in
build.yaml.Enable verbose logging for detailed output.
Dart Defines
Pass custom compile-time constants to your application:Define environment variables available at compile time.
Load dart-define variables from a JSON file.
config.json
Complete Examples
Development Workflow
Hot Reload Behavior
Understand what triggers rebuilds and reloads:Client Code Changes
Client Code Changes
Files in Result: Browser reloads (refresh mode) or hot-reloads (reload mode)
lib/ (imported by web/main.dart) or web/:Server Code Changes
Server Code Changes
Files ending in Result: Server hot-reloads, browser refreshes
.server.dart in lib/:Asset Changes
Asset Changes
Changes to files in Result: Assets are rebuilt and browser refreshes
web/ (HTML, CSS, images):Build Configuration
Build Configuration
Changes to
build.yaml or pubspec.yaml:Action required: Stop and restart jaspr serveTroubleshooting
Port already in use
Port already in use
Change the port if 8080 is occupied:
Server hot reload not working
Server hot reload not working
Ensure your server entry point is in Entry points in
lib/:bin/ cannot use hot reload.Build errors persist
Build errors persist
Stop the server and clean build artifacts:
Changes not detected
Changes not detected
Enable verbose mode to see file watching logs:
Multiple projects conflict
Multiple projects conflict
Use different ports for each project:
Performance Tips
Next Steps
Build Command
Build your app for production deployment
Project Structure
Learn about the Jaspr project structure
Components
Build reusable components
Debugging
Debug your Jaspr application