Skip to content

Commands Overview

Goca provides a comprehensive set of commands to generate Clean Architecture components and manage your project structure.

Command Categories

Project Initialization

  • goca init - Initialize a new Clean Architecture project

Complete Features

Layer-Specific Generation

Domain Layer

Application Layer

Infrastructure Layer

Adapter Layer

Utilities

Quick Reference

CommandPurposeAuto-Integration
goca initCreate new projectComplete setup
goca featureGenerate full featureAutomatic
goca integrateWire existing featuresAutomatic
goca entityCreate entities onlyManual
goca usecaseCreate use cases onlyManual
goca repositoryCreate repositories onlyManual
goca handlerCreate handlers onlyManual
goca diGenerate DI containerManual

Common Workflows

bash
# Initialize project
goca init myproject --module github.com/user/myproject

# Generate complete features
goca feature User --fields "name:string,email:string"
goca feature Product --fields "name:string,price:float64"

# Everything is integrated automatically!
go run cmd/server/main.go

Workflow 2: Layer-by-Layer

bash
# Generate entity
goca entity Order --fields "customer:string,total:float64"

# Generate use case
goca usecase OrderService --entity Order

# Generate repository
goca repository Order --database postgres

# Generate handler
goca handler Order --type http

# Wire everything together
goca integrate --all

Workflow 3: Add to Existing Project

bash
# Generate new feature
goca feature Payment --fields "amount:float64,method:string"

# Automatically integrated with existing features

Global Flags

All commands support these flags:

bash
--help, -h      Show help for command
--verbose, -v   Enable verbose output
--dry-run       Show what would be generated without creating files

Examples by Use Case

Building a REST API

bash
goca init ecommerce-api --module github.com/user/ecommerce
cd ecommerce-api

goca feature Product --fields "name:string,price:float64,stock:int"
goca feature Order --fields "customer:string,total:float64,status:string"
goca feature User --fields "name:string,email:string,role:string"

Building a Microservice

bash
goca init payment-service --module github.com/user/payment
cd payment-service

goca feature Payment --fields "amount:float64,currency:string,status:string"
goca handler Payment --type grpc
goca handler Payment --type http

Building a CLI Tool

bash
goca init data-processor --module github.com/user/processor
cd data-processor

goca feature DataProcessor --fields "input:string,output:string"
goca handler DataProcessor --type cli

Next Steps

Choose a command to learn more:

Essential Commands

Detailed Generation

Utilities

Released under the MIT License.