|
| 1 | +--- |
| 2 | +display_name: Auto-Start Development Servers |
| 3 | +description: Automatically detect and start development servers for various project types |
| 4 | +icon: ../../../../.icons/server.svg |
| 5 | +verified: false |
| 6 | +tags: [development, automation, servers] |
| 7 | +--- |
| 8 | + |
| 9 | +# Auto-Start Development Servers |
| 10 | + |
| 11 | +Automatically detect and start development servers for various project types when a workspace starts. This module scans your workspace for common project structures and starts the appropriate development servers in the background without manual intervention. |
| 12 | + |
| 13 | +```tf |
| 14 | +module "auto_start_dev_servers" { |
| 15 | + source = "registry.coder.com/mavrickrishi/auto-start-dev-server/coder" |
| 16 | + version = "1.0.0" |
| 17 | + agent_id = coder_agent.main.id |
| 18 | +} |
| 19 | +``` |
| 20 | + |
| 21 | +## Features |
| 22 | + |
| 23 | +- **Multi-language support**: Detects and starts servers for Node.js, Python (Django/Flask), Ruby (Rails), Java (Spring Boot), Go, PHP, Rust, and .NET projects |
| 24 | +- **Smart script prioritization**: Prioritizes `dev` scripts over `start` scripts for better development experience |
| 25 | +- **Intelligent frontend detection**: Automatically identifies frontend projects (React, Vue, Angular, Next.js, Nuxt, Svelte, Vite) and prioritizes them for preview apps |
| 26 | +- **Devcontainer integration**: Respects custom start commands defined in `.devcontainer/devcontainer.json` |
| 27 | +- **Configurable scanning**: Adjustable directory scan depth and project type toggles |
| 28 | +- **Non-blocking startup**: Servers start in the background with configurable startup delay |
| 29 | +- **Comprehensive logging**: All server output and detection results logged to a central file |
| 30 | +- **Smart detection**: Uses project-specific files and configurations to identify project types |
| 31 | +- **Integrated live preview**: Automatically creates a preview app for the primary frontend project |
| 32 | + |
| 33 | +## Supported Project Types |
| 34 | + |
| 35 | +| Framework/Language | Detection Files | Start Commands (in priority order) | |
| 36 | +| ------------------ | -------------------------------------------- | ----------------------------------------------------- | |
| 37 | +| **Node.js/npm** | `package.json` | `npm run dev`, `npm run serve`, `npm start` (or yarn) | |
| 38 | +| **Ruby on Rails** | `Gemfile` with rails gem | `bundle exec rails server` | |
| 39 | +| **Django** | `manage.py` | `python manage.py runserver` | |
| 40 | +| **Flask** | `requirements.txt` with Flask | `python app.py/main.py/run.py` | |
| 41 | +| **Spring Boot** | `pom.xml` or `build.gradle` with spring-boot | `mvn spring-boot:run`, `gradle bootRun` | |
| 42 | +| **Go** | `go.mod` | `go run main.go` | |
| 43 | +| **PHP** | `composer.json` | `php -S 0.0.0.0:8080` | |
| 44 | +| **Rust** | `Cargo.toml` | `cargo run` | |
| 45 | +| **.NET** | `*.csproj` | `dotnet run` | |
| 46 | + |
| 47 | +## Examples |
| 48 | + |
| 49 | +### Basic Usage |
| 50 | + |
| 51 | +```hcl |
| 52 | +module "auto_start" { |
| 53 | + source = "./modules/auto-start-dev-server" |
| 54 | + version = "1.0.0" |
| 55 | + agent_id = coder_agent.main.id |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +### Advanced Usage |
| 60 | + |
| 61 | +```hcl |
| 62 | +module "auto_start_dev_servers" { |
| 63 | + source = "./modules/auto-start-dev-server" |
| 64 | + version = "1.0.0" |
| 65 | + agent_id = coder_agent.main.id |
| 66 | +
|
| 67 | + # Optional: Configure which project types to detect |
| 68 | + enable_npm = true |
| 69 | + enable_rails = true |
| 70 | + enable_django = true |
| 71 | + enable_flask = true |
| 72 | + enable_spring_boot = true |
| 73 | + enable_go = true |
| 74 | + enable_php = true |
| 75 | + enable_rust = true |
| 76 | + enable_dotnet = true |
| 77 | +
|
| 78 | + # Optional: Enable devcontainer.json integration |
| 79 | + enable_devcontainer = true |
| 80 | +
|
| 81 | + # Optional: Workspace directory to scan (supports environment variables) |
| 82 | + workspace_directory = "$HOME" |
| 83 | +
|
| 84 | + # Optional: Directory scan depth (1-5) |
| 85 | + scan_depth = 2 |
| 86 | +
|
| 87 | + # Optional: Startup delay in seconds |
| 88 | + startup_delay = 10 |
| 89 | +
|
| 90 | + # Optional: Log file path |
| 91 | + log_path = "/tmp/dev-servers.log" |
| 92 | +
|
| 93 | + # Optional: Enable automatic preview app (default: true) |
| 94 | + enable_preview_app = true |
| 95 | +} |
| 96 | +``` |
| 97 | + |
| 98 | +### Disable Preview App |
| 99 | + |
| 100 | +```hcl |
| 101 | +module "auto_start" { |
| 102 | + source = "./modules/auto-start-dev-server" |
| 103 | + version = "1.0.0" |
| 104 | + agent_id = coder_agent.main.id |
| 105 | +
|
| 106 | + # Disable automatic preview app creation |
| 107 | + enable_preview_app = false |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | +### Selective Project Types |
| 112 | + |
| 113 | +```hcl |
| 114 | +module "auto_start" { |
| 115 | + source = "./modules/auto-start-dev-server" |
| 116 | + version = "1.0.0" |
| 117 | + agent_id = coder_agent.main.id |
| 118 | +
|
| 119 | + # Only enable web development projects |
| 120 | + enable_npm = true |
| 121 | + enable_rails = true |
| 122 | + enable_django = true |
| 123 | + enable_flask = true |
| 124 | +
|
| 125 | + # Disable other project types |
| 126 | + enable_spring_boot = false |
| 127 | + enable_go = false |
| 128 | + enable_php = false |
| 129 | + enable_rust = false |
| 130 | + enable_dotnet = false |
| 131 | +} |
| 132 | +``` |
| 133 | + |
| 134 | +### Deep Workspace Scanning |
| 135 | + |
| 136 | +```hcl |
| 137 | +module "auto_start" { |
| 138 | + source = "./modules/auto-start-dev-server" |
| 139 | + version = "1.0.0" |
| 140 | + agent_id = coder_agent.main.id |
| 141 | +
|
| 142 | + workspace_directory = "/workspaces" |
| 143 | + scan_depth = 3 |
| 144 | + startup_delay = 5 |
| 145 | + log_path = "/var/log/dev-servers.log" |
| 146 | +} |
| 147 | +``` |
| 148 | + |
| 149 | +## License |
| 150 | + |
| 151 | +This module is provided under the same license as the Coder Registry. |
0 commit comments