Core Concepts
New CLI Commands
Grit v3 adds operational commands inspired by Laravel/Goravel: route listing, maintenance mode, and one-command deployment.
grit routes
List all registered API routes in a formatted table. Parses your routes.go file and shows the HTTP method, path, handler function, and middleware group.
Terminal
$ grit routesMETHOD PATH HANDLER GROUP────── ──── ─────── ─────GET /api/health func1 publicPOST /api/auth/register authHandler.Register publicPOST /api/auth/login authHandler.Login publicPOST /api/auth/refresh authHandler.Refresh publicGET /api/auth/me authHandler.Me protectedPOST /api/auth/logout authHandler.Logout protectedPOST /api/auth/totp/setup totpHandler.Setup protectedGET /api/auth/totp/status totpHandler.Status protectedGET /api/users/:id userHandler.GetByID protectedPOST /api/uploads uploadHandler.Create protectedPOST /api/ai/chat aiHandler.Chat protectedDELETE /api/admin/users/:id userHandler.Delete admin16 routes total
Works for both monorepo (apps/api/internal/routes/) and single app (internal/routes/) projects.
grit down / grit up
Toggle maintenance mode. When enabled, all API requests receive a 503 Service Unavailable response.
Enable maintenance
$ grit downApplication is now in maintenance mode.All requests will receive 503.Run 'grit up' to bring it back online.
Disable maintenance
$ grit upApplication is back online!Normal request handling has resumed.
How it works
- 1.
grit downcreates a.maintenancefile in the project root - 2.The scaffolded
Maintenance()middleware checks for this file on every request - 3.
grit upremoves the file, resuming normal operation
middleware/maintenance.go
func Maintenance() gin.HandlerFunc {return func(c *gin.Context) {if _, err := os.Stat(".maintenance"); err == nil {c.JSON(http.StatusServiceUnavailable, gin.H{"error": gin.H{"code": "MAINTENANCE","message": "Application is in maintenance mode.",},})c.Abort()return}c.Next()}}
grit deploy
One-command production deployment. See the dedicated Deploy Command guide for full details.
Terminal
# Deploy with flagsgrit deploy --host user@server.com --domain myapp.com# Or set env vars in .envDEPLOY_HOST=user@server.comDEPLOY_DOMAIN=myapp.comDEPLOY_KEY_FILE=~/.ssh/id_rsagrit deploy
Complete command reference
| Command | Description |
|---|---|
| grit new <name> | Create a new project (interactive) |
| grit new-desktop <name> | Create a Wails desktop app |
| grit generate resource <Name> | Generate full-stack CRUD resource |
| grit remove resource <Name> | Remove a generated resource |
| grit add role <ROLE> | Add a new role to the project |
| grit sync | Sync Go types to TypeScript |
| grit start | Start development servers |
| grit start server | Start Go API only |
| grit start client | Start frontend only |
| grit compile | Build desktop app (Wails) |
| grit studio | Open GORM Studio |
| grit migrate | Run database migrations |
| grit migrate --fresh | Drop all tables + re-migrate |
| grit seed | Run database seeders |
| grit routes | List all API routes |
| grit down | Enable maintenance mode (503) |
| grit up | Disable maintenance mode |
| grit deploy | Deploy to production server |
| grit upgrade | Upgrade project templates |
| grit update | Update Grit CLI to latest |
| grit version | Print CLI version |