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 routes
METHOD PATH HANDLER GROUP
────── ──── ─────── ─────
GET /api/health func1 public
POST /api/auth/register authHandler.Register public
POST /api/auth/login authHandler.Login public
POST /api/auth/refresh authHandler.Refresh public
GET /api/auth/me authHandler.Me protected
POST /api/auth/logout authHandler.Logout protected
POST /api/auth/totp/setup totpHandler.Setup protected
GET /api/auth/totp/status totpHandler.Status protected
GET /api/users/:id userHandler.GetByID protected
POST /api/uploads uploadHandler.Create protected
POST /api/ai/chat aiHandler.Chat protected
DELETE /api/admin/users/:id userHandler.Delete admin
16 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 down
Application is now in maintenance mode.
All requests will receive 503.
Run 'grit up' to bring it back online.
Disable maintenance
$ grit up
Application is back online!
Normal request handling has resumed.

How it works

  • 1.grit down creates a .maintenance file in the project root
  • 2.The scaffolded Maintenance() middleware checks for this file on every request
  • 3.grit up removes 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 flags
grit deploy --host user@server.com --domain myapp.com
# Or set env vars in .env
DEPLOY_HOST=user@server.com
DEPLOY_DOMAIN=myapp.com
DEPLOY_KEY_FILE=~/.ssh/id_rsa
grit deploy

Complete command reference

CommandDescription
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 syncSync Go types to TypeScript
grit startStart development servers
grit start serverStart Go API only
grit start clientStart frontend only
grit compileBuild desktop app (Wails)
grit studioOpen GORM Studio
grit migrateRun database migrations
grit migrate --freshDrop all tables + re-migrate
grit seedRun database seeders
grit routesList all API routes
grit downEnable maintenance mode (503)
grit upDisable maintenance mode
grit deployDeploy to production server
grit upgradeUpgrade project templates
grit updateUpdate Grit CLI to latest
grit versionPrint CLI version