go-duck-cli
v1.0.9
Published
go function generator
Downloads
797
Readme
GO-DUCK CLI
🦆 The Legend of the Century
In the legendary Silicon Valley of Code, a nomadic Gopher—lightning-fast and known for his tireless concurrency—crossed paths with a Duck from the Great Persistence Bayou. The Duck held the wisdom of adaptability and the secret to navigating ever-shifting business tides. They realized that while the Gopher built fast, the Duck built to survive. Together, they forged a pact to create the Generator of Kings.
Gin Gonic Tonic: The Refreshment of Performance
To fuel their grand design, they sought the Legendary Bottle of Gin. This magical brew wasn't just for hydration; it transformed their web routing into a crystalline, high-performance flow. Routes became fast, middleware became transparent, and the developer experience became as refreshing as a cold tonic on a summer's day. This gave GO-DUCK its distinctive, lightweight spirit.
The Armor of the Divine: Mark of Kratos
But speed without strength is a house made of cards. In the digital forge of the underworld, they recovered the Mark of Kratos. By stamping this sigil onto their internal services, they achieved gRPC industrial resilience. Every service became armored with strict Protocol Buffer contracts, ensuring that no matter how hard the system scaled, it would never break under the divine weight of technical debt.
The GDL Genesis
Thus, the GDL (Go-Duck Language) was hatched. A single, simple tongue that could command entire legions of code. From that day forth, every developer who whispered GDL into the CLI would see their architecture evolve—bringing the Gopher's speed, the Duck's wisdom, the Gin's clarity, and the Kratos' strength into a single, unified masterpiece.
✨ Features Overview (The 260% Milestone)
- Full-Stack Code Generation: Generates everything from REST and gRPC (Kratos) APIs to the internal repository layer.
- Dual-Protocol APIs: Multi-protocol support (Gin/REST & Kratos/gRPC) with OIDC/JWT security enforcement.
- Dynamic Multi-Tenancy: Side-by-side Database-pet-Tenant isolation with Hot-Swapping Connection Pools and a verified Master-Tenant Registry.
- High-Velocity Bulk Operations: Transactional
BulkCreate,BulkUpdate, andBulkPatchendpoints for all entities. - Deep JSON Querying: PostgREST-like RPC engine supporting arrow operators (
->,->>) for complex JSONB searches. - Stateful Incremental Updates: Intelligently applies schema deltas to your existing codebase without data loss.
- Rich Ecosystem Components:
- Persistence: GORM (PostgreSQL) + Liquibase migrations.
- GraphQL: Full schema and resolver generation.
- Real-time: Traced WebSocket envelopes & MQTT notifications.
- Resilience: Circuit Breakers (Sony/Gobreaker) & Rate Limiting.
- Observability: Full-stack tracing (Otelgin to Otelpgx) + Prometheus metrics.
- Gorgeous Automated Documentation: Auto-scaffolded "Apple-style" Developer Guide and High-Fidelity Swagger UI.
💾 Global Installation
To get started with GO-DUCK CLI, install it globally via npm:
npm install -g go-duck-cliEnvironment Specifications
Ensure your development environment meets the following requirements:
- Node.js: 18+
- Go: 1.21+
- Docker: v20+
- Composability: v2+
🚀 Scaffold & Run
Follow these steps to create and run a new microservice with GO-DUCK:
# 1. Create a new microservice
go-duck create -o ./my-app -c config.yaml
# 2. Enter the application directory and run
cd my-app
docker-compose up -d
go run main.goUsage
The go-duck-cli has two main commands: create and import-gdl.
go-duck create
This command scaffolds a new Go microservice.
go-duck create [options]Options:
-c, --config <path>: Path to theconfig.yamlfile (default:../CONFIG/config.yaml).-o, --output <path>: Path where the project will be generated (default: current directory).-g, --gdl <path>: Path to the directory containing your GDL files (default:../GDL).
Example:
go-duck create -c my-app/config.yaml -o my-app -g my-app/gdlgo-duck import-gdl <file>
This command imports a GDL file to an existing project, generating new entities, updating existing ones, and creating database migrations.
go-duck import-gdl <file> [options]Options:
-o, --output <path>: Path to the existing application root (default: current directory).
Example:
go-duck import-gdl new-entities.gdl -o my-existing-appGoDuck Definition Language (GDL)
GDL is a simple language for defining your application's entities, fields, and relationships.
Example (app.gdl):
entity Author {
name String required
email String unique
}
entity Book {
title String required
publishedDate LocalDate
}
relationship OneToMany {
Author{books} to Book{author}
}Configuration (config.yaml)
The config.yaml file contains the configuration for your generated application.
app:
name: my-app
datasource:
host: localhost
port: 5432
username: user
password: password
database: my_app_db
multitenancy:
enabled: true
security:
jwt:
secret: "your-jwt-secret"License
This project is licensed under the ISC License.
