Back to Gofr

GoFR Command Line Interface

docs/references/gofrcli/page.md

1.56.51.6 KB
Original Source

GoFR Command Line Interface

Managing repetitive tasks and maintaining consistency across large-scale applications is challenging!

GoFr CLI provides the following:

  • All-in-one command-line tool designed specifically for GoFr applications
  • Simplifies database migrations management
  • Store Layer Generator for type-safe data access code from YAML configurations
  • Abstracts tracing, metrics and structured logging for GoFr's gRPC server/client
  • Enforces standard GoFr conventions in new projects

Prerequisites

  • Go 1.25 or above. To check Go version use the following command:
bash
  go version

Installation

To get started with GoFr CLI, use the below commands

bash
  go install gofr.dev/cli/gofr@latest

To check the installation:

bash
  gofr version

Usage

The CLI can be run directly from the terminal after installation. Here’s the general syntax:

bash
  gofr <subcommand> [flags]=[arguments]

Commands

The CLI groups its functionality into four commands. See each subpage for full reference:

  • gofr init — initialize a new GoFr project with the standard layout.
  • gofr migrate — create database migration templates with timestamped filenames and an auto-generated registry.
  • gofr wrap grpc — generate gRPC server/client wrappers with built-in tracing, metrics, and logging.
  • gofr store — generate a type-safe data-access layer from YAML schema definitions.