gofasta dev
Starts the development server with automatic hot reload powered by Air . When you change any .go file, the server automatically rebuilds and restarts, giving you a fast feedback loop during development.
Usage
gofasta dev [flags]Run this command from the root directory of your Gofasta project.
Flags
| Flag | Short | Default | Description |
|---|---|---|---|
--port | -p | 8080 | Port number for the HTTP server |
--host | -H | 0.0.0.0 | Host address to bind to |
--no-reload | false | Disable hot reload and run the server directly |
Examples
Start the dev server with default settings:
gofasta devStart on a custom port:
gofasta dev --port 3000Start on localhost only (not exposed to the network):
gofasta dev --host 127.0.0.1Start without hot reload:
gofasta dev --no-reloadCombine flags:
gofasta dev -p 9090 -H 127.0.0.1How It Works
The gofasta dev command wraps the Air live reloader. When you run it:
- Air watches all
.gofiles in your project for changes - On any file change, it rebuilds the binary
- The previous server process is stopped
- The new binary is started automatically
The Air configuration is stored in .air.toml at the project root. You can customize watched directories, excluded paths, build commands, and delay settings by editing this file.
Available Endpoints
Once the dev server is running, the following endpoints are available:
| Endpoint | URL |
|---|---|
| REST API | http://localhost:8080/api/v1/ |
| GraphQL | http://localhost:8080/graphql |
| GraphQL Playground | http://localhost:8080/graphql-playground |
| Health Check | http://localhost:8080/health |
| Swagger UI | http://localhost:8080/swagger/index.html |
Replace 8080 with your custom port if you used the --port flag.
Using Docker
If you prefer running inside Docker with hot reload, use the provided Makefile command instead:
make devThis starts the Docker Compose development profile, which includes both the application with Air hot reload and the database service.
Troubleshooting
Port already in use — If you see bind: address already in use, another process is using the port. Either stop that process or use a different port with --port.
Air not found — The gofasta dev command handles Air internally. If you encounter issues, make sure you have run gofasta init to install all dependencies.
Related
- gofasta serve — start the production server
- gofasta new — create a new project
- Quick Start