Note
A comprehensive, production-ready Go application framework and CLI for rapid database, gRPC, and service scaffolding.
The GoForge CLI is a powerful command-line tool designed to accompany the GoForge application framework template. It provides a universal utility for rapidly scaffolding new services, generating database migrations, compiling protocol buffers, and managing application-specific console commands effortlessly out-of-the-box.
- 🚀 Zero-Configuration Awareness: The CLI dynamically analyzes your project's
.envandgo.modfiles for context; it executes tasks directly against your application state without complicated tooling setup. - 🏗️ Service Scaffolding: Automatically generate complete service skeletons, including database models, service contracts, gRPC stubs, API handlers, and routes.
- 🗄️ Database Tooling: Effortlessly integrate with
atlasandsqlcfor clean database migrations and typed SQL query generation! - 🔌 Extensibility: Bootstrap custom local CLI tools to provide application specific console actions (e.g. running daily cronjobs, admin backfills, cache clearers, etc).
A typical GoForge project follows a clean, modular architecture:
.
├── cmd/ # Application entry points (main.go)
├── internal/ # Private application code
│ ├── cache/ # Caching drivers (Redis, Ristretto, Multi-tier)
│ ├── client/ # internal gRPC and HTTP clients
│ ├── config/ # Configuration loaders and types
│ ├── console/ # Application-specific CLI commands
│ ├── database/ # Database core, migrations, and SQLC queries
│ ├── server/ # HTTP and gRPC server setups & middleware
│ └── services/ # Domain-specific business logic & services
├── proto/ # Protocol Buffer definitions
├── tests/ # Unit, integration, and client tests
├── air.toml # Air configuration for live reloading
├── atlas.hcl # Atlas migration configuration
├── goforge.sh # Helper shell script for CLI proxying
└── sqlc.yaml # SQLC configuration
Ensure you have the following installed:
Install the GoForge CLI globally:
go install github.com/mmycin/GoForge@latestEnsure your $GOPATH/bin is in your $PATH.
goforge new my-awesome-project
cd my-awesome-project| Command | Description |
|---|---|
goforge new |
Create a new GoForge project from the template. |
goforge gen:key |
Generates and sets a secure APP_KEY in .env. |
goforge rem:key |
Removes the active APP_KEY from .env. |
goforge readme |
Displays the recommended GoForge workflow. |
goforge version |
Displays the CLI version. |
Scaffold domain logic rapidly:
goforge gen:service [name]: Scaffolds a complete service ininternal/services/<name>.goforge rem:service [name]: Safely removes a service and un-registers it.
goforge gen:proto [name]: Compiles specific or all.protofiles usingprotoc.goforge rem:proto: Scrubs all generated.pb.gofiles.
Bridge the gap between global tools and project-specific execution:
goforge gen:command [name]: Creates a Cobra CLI command ininternal/console.goforge app serve [args]: Proxies the local compiler. Runninggoforge app serveinvokesgo run cmd/main.go serve, loading the full environment.
Native support for gorm, atlas, and sqlc:
goforge migrate: Applies SQL migrations using Atlas.goforge gen:migration [name]: Generates schema differences using Atlas and GORM.goforge rem:migration: Reverts the most recent migration.goforge gen:sqlc: Compilesinternal/database/queries/*.sqlinto type-safe Go.
The goforge CLI is licensed under the Apache License 2.0. See the LICENSE file for more details.
