A fast and simple CLI tool for generating Go project boilerplates.
# Build from source
git clone https://github.com/luigimorel/gogen.git
cd gogen
make buildgo install github.com/luigimorel/gogen@latestAfter building or downloading the binary, gogen can install itself to your system PATH:
# Auto-detect best installation method for your system
./gogen install
# Force reinstallation if already installed
./gogen install --forceThe install command supports:
- Linux/macOS: Installs to
~/.local/binwith PATH configuration help - Windows: Installs to
%USERPROFILE%\AppData\Local\gogenwith PATH setup instructions - Auto-detection: Automatically chooses the best method for your system
gogen --help # Show all available commands
gogen -h # Short form of help
gogen --version # Show version information
gogen -v # Short form of version| Flag | Short | Description | Default |
|---|---|---|---|
--help |
-h |
Show help for the command | false |
--version |
-v |
Show version information | false |
--verbose |
Enable verbose output | false |
The new command creates a new Go project with proper structure and initialization.
Generate an API server (default):
gogen new --name my-projectGenerate a CLI application:
gogen new --name my-cli --template cliGenerate a web server:
gogen new --name my-web-app --template webCreate a web project with React frontend:
gogen new --name my-fullstack --template web --frontend reactCreate a web project with Vue.js and TypeScript:
gogen new --name my-vue-app --template web --frontend vue --tsCreate an API with Chi router:
gogen new --name my-api --template api --router chiCreate a fullstack project with Chi router, docker, bun runtime and React for the frontend:
gogen new --name my-app --docker --template web --router chi --tsSpecify custom module name and directory:
gogen new --name my-project --module github.com/username/my-project --dir custom-dirgogen new --help| Flag | Short | Description | Default |
|---|---|---|---|
--name |
-n |
Project name | |
--module |
-m |
Go module path | project name |
--template |
-t |
Project template (api, web, cli) | "api" |
--router |
-r |
Router type (stdlib, chi, gorilla, httprouter) | "stdlib" |
--frontend |
--fe |
Frontend framework (react, vue, svelte, etc.) | |
--dir |
-d |
Directory name for the project | project name |
--typescript |
--ts |
Use TypeScript for frontend projects | false |
--docker |
Create dockerfiles and dockercompose | false |
- api (default) - REST API server with JSON responses
- cli - CLI application using urfave/cli/v2
- web - HTTP web server with optional frontend integration
- stdlib (default) - Go standard library http.ServeMux
- chi - Chi lightweight router with middleware support
- gorilla - Gorilla Mux with advanced routing features
- httprouter - High-performance HttpRouter
- react - React with Vite build tool
- vue - Vue.js with Vite
- svelte - Svelte with Vite
- solidjs - SolidJS with Vite
- angular - Angular with Angular CLI
The install command automatically installs gogen to your system PATH for easy access from anywhere.
# Auto-detect best installation method
gogen install
# Force reinstallation
gogen install --force
# Specify installation method
gogen install --method binary- stdlib - Go standard library http.ServeMux with pattern matching
- chi - Lightweight router with built-in middleware (Logger, Recoverer, RequestID)
- gorilla - Full-featured router with path variables and advanced matching
- httprouter - Ultra-fast router with zero memory allocation and path parameters
- react - React 18+ with Vite, hot reloading, and modern tooling
- vue - Vue 3 with Composition API, Vite, and TypeScript support
- svelte - Svelte with SvelteKit and Vite integration
- solidjs - SolidJS with fine-grained reactivity and Vite
- angular - Angular with CLI, TypeScript, and modern build tools
Create a complete full-stack application with Go backend and React frontend:
# Create web project with React frontend and all features
gogen new --name my-app --template web --frontend react --typescript \
--router chi --cors --auth --logging --tailwind --testing
cd my-app
# Start the API server (in one terminal)
cd api
go run main.go
# Start the frontend dev server (in another terminal)
cd frontend
npm run devCreate a high-performance API service with comprehensive features:
# Create API project with full microservice setup
gogen new --name my-service --template microservice --router gin \
--module github.com/company/my-service --middleware --cors \
--metrics --rate-limit --swagger --docker
cd my-service
go run main.go
# Test the API
curl http://localhost:8080/
curl http://localhost:8080/healthCreate a comprehensive CLI tool:
gogen new --name my-cli --template cli --module github.com/company/my-cli
cd my-cli
go run main.go --help| Command | Description | Example |
|---|---|---|
gogen new |
Create a new project | gogen new -n my-app -t web --fe react |
gogen install |
Install gogen to PATH | gogen install --force |
| Template | Description | Use Case |
|---|---|---|
api |
REST API server | Microservices, APIs, backends |
web |
Web server | Full-stack applications, websites |
cli |
CLI application | Command-line tools, utilities |
| Router | Description | Best For |
|---|---|---|
stdlib |
Go standard library | Simple applications, learning |
chi |
Lightweight with middleware | Most web applications |
gorilla |
Full-featured router | Complex routing requirements |
httprouter |
High-performance | High-throughput APIs |
| Framework | Description | TypeScript | Build Tool | State Management |
|---|---|---|---|---|
react |
React 18+ | ✅ | Vite | Redux, Zustand |
vue |
Vue 3 | ✅ | Vite | Pinia, Vuex |
svelte |
Svelte/SvelteKit | ✅ | Vite | Svelte stores |
solidjs |
SolidJS | ✅ | Vite | Built-in stores |
angular |
Angular | ✅ | Angular CLI | NgRx, Services |
- Go 1.21.13 or later
- Make (optional, for build automation)
- Node.js and npm (required for frontend features)
git clone https://github.com/luigimorel/gogen.git
cd gogen
make build# Run in development mode with hot reloading
make dev
# Run tests
make test
# Format and lint code
make check
# Build for all platforms
make build-allmake build- Build the applicationmake run- Build and run the applicationmake dev- Start development server with hot reloadingmake test- Run testsmake fmt- Format codemake lint- Lint codemake vet- Vet codemake check- Run all code quality checksmake clean- Clean build artifactsmake build-all- Build for multiple platforms
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and checks (
make check test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.