create-gin-api

command module
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 8 Imported by: 0

README

create-gin-api

Scaffold a Gin API project (GORM/Postgres, Redis, Zap, Air, Swagger) with a custom name.

Install

go install github.com/oriensx/create-gin-api@latest

Requires Go 1.25+.

Or clone and run locally:

git clone https://github.com/oriensx/create-gin-api.git
cd create-gin-api
go run . <name>

Usage

create-gin-api
create-gin-api my-api
create-gin-api -module github.com/acme/my-api my-api
create-gin-api -out ~/work -title "Order Service API" order-svc

No <name> on a TTY enters interactive mode: prompts for name, module, parent directory, title, and description. Press Enter to accept the bracketed default. Flags still apply as defaults in interactive mode.

Flag Default Meaning
-module <name> Go module path
-out . Parent directory
-title derived from name Swagger title
-desc Gin API server for <name> Swagger description

Flags go before <name>. Name must match ^[a-z][a-z0-9-]*$. Non-TTY + no <name> prints usage and exits.

After generate

cd my-api
cp .env.example .env
make run              # local
make docker-up        # api + Postgres + Redis
make swagger          # if swag was not on PATH during scaffold
make docker-down      # stop compose

Optional tools:

go install github.com/air-verse/air@latest
go install github.com/swaggo/swag/cmd/swag@latest

Template

Project layout lives in internal/scaffold/template/. Edit it to change what future projects look like.

See DEVELOP.md for maintainer notes.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
scaffold/template/cmd/server command
Package main is the {{.Name}} API server entrypoint.
Package main is the {{.Name}} API server entrypoint.
scaffold/template/docs
Package docs is a stub.
Package docs is a stub.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL