SkillAgentSearch skills...

Bee

Bee is a tool for helping develop with beego app framework.

Install / Use

/learn @beego/Bee
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

bee

Bee is a command-line tool facilitating development of Beego-based application.

Build Status Build Status

Requirements

  • Go version >= 1.13

Installation

To install or update bee use the go install command:

go install github.com/beego/bee/v2@latest

Then you can add bee binary to PATH environment variable in your ~/.bashrc or ~/.bash_profile file:

export PATH=$PATH:<your_main_gopath>/bin

Installing and updating bee prior Go version 1.17

To install bee use the go get command:

go get github.com/beego/bee/v2

If you already have bee installed, updating bee is simple:

go get -u github.com/beego/bee/v2

Basic commands

Bee provides a variety of commands which can be helpful at various stages of development. The top level commands include:

    version     Prints the current Bee version
    migrate     Runs database migrations
    api         Creates a Beego API application
    bale        Transforms non-Go files to Go source files
    fix         Fixes your application by making it compatible with newer versions of Beego
    pro         Source code generator
    dlv         Start a debugging session using Delve
    dockerize   Generates a Dockerfile and docker-compose.yaml for your Beego application
    generate    Source code generator
    hprose      Creates an RPC application based on Hprose and Beego frameworks
    new         Creates a Beego application
    pack        Compresses a Beego application into a single file
    rs          Run customized scripts
    run         Run the application by starting a local development server
    server      serving static content over HTTP on port
    update      Update Bee

bee version

To display the current version of bee, beego and go installed on your machine:

$ bee version
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.0.4

├── Beego     : 2.0.4
├── GoVersion : go1.14.1
├── GOOS      : darwin
├── GOARCH    : amd64
├── NumCPU    : 4
├── GOPATH    : /home/beeuser/.go
├── GOROOT    : /usr/local/Cellar/go/1.14.1/libexec
├── Compiler  : gc
└── Published : 2020-09-13

You can also change the output format using -o flag:

$ bee version -o json
{
    "GoVersion": "go1.14.1",
    "GOOS": "darwin",
    "GOARCH": "amd64",
    "NumCPU": 4,
    "GOPATH": "/home/beeuser/.go",
    "GOROOT": "/usr/local/Cellar/go/1.14.1/libexec",
    "Compiler": "gc",
    "BeeVersion": "2.0.4",
    "BeegoVersion": "2.0.4",
    "Published": "2020-09-13"
}

For more information on the usage, run bee help version.

bee new

To create a new Beego web application:

$ bee new my-web-app
2020/09/14 22:28:51 INFO     ▶ 0001 generate new project support go modules.
2020/09/14 22:28:51 INFO     ▶ 0002 Creating application...
	create	 /Users/beeuser/learn/my-web-app/go.mod
	create	 /Users/beeuser/learn/my-web-app/
	create	 /Users/beeuser/learn/my-web-app/conf/
	create	 /Users/beeuser/learn/my-web-app/controllers/
	create	 /Users/beeuser/learn/my-web-app/models/
	create	 /Users/beeuser/learn/my-web-app/routers/
	create	 /Users/beeuser/learn/my-web-app/tests/
	create	 /Users/beeuser/learn/my-web-app/static/
	create	 /Users/beeuser/learn/my-web-app/static/js/
	create	 /Users/beeuser/learn/my-web-app/static/css/
	create	 /Users/beeuser/learn/my-web-app/static/img/
	create	 /Users/beeuser/learn/my-web-app/views/
	create	 /Users/beeuser/learn/my-web-app/conf/app.conf
	create	 /Users/beeuser/learn/my-web-app/controllers/default.go
	create	 /Users/beeuser/learn/my-web-app/views/index.tpl
	create	 /Users/beeuser/learn/my-web-app/routers/router.go
	create	 /Users/beeuser/learn/my-web-app/tests/default_test.go
	create	 /Users/beeuser/learn/my-web-app/main.go
2020/09/14 22:28:51 SUCCESS  ▶ 0003 New application successfully created!

For more information on the usage, run bee help new.

bee run

To run the application we just created, you can navigate to the application folder and execute:

$ cd my-web-app && bee run

For more information on the usage, run bee help run.

bee pack

To compress a Beego application into a single deployable file:

$ bee pack
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.0.0
2016/12/26 22:29:29 INFO     ▶ 0001 Packaging application on '/home/beeuser/.go/src/github.com/user/my-web-app'...
2016/12/26 22:29:29 INFO     ▶ 0002 Building application...
2016/12/26 22:29:29 INFO     ▶ 0003 Using: GOOS=linux GOARCH=amd64
2016/12/26 22:29:31 SUCCESS  ▶ 0004 Build Successful!
2016/12/26 22:29:31 INFO     ▶ 0005 Writing to output: /home/beeuser/.go/src/github.com/user/my-web-app/my-web-app.tar.gz
2016/12/26 22:29:31 INFO     ▶ 0006 Excluding relpath prefix: .
2016/12/26 22:29:31 INFO     ▶ 0007 Excluding relpath suffix: .go:.DS_Store:.tmp
2016/12/26 22:29:32 SUCCESS  ▶ 0008 Application packed!

For more information on the usage, run bee help pack.

bee rs

Inspired by makefile / npm scripts. Run script allows you to run arbitrary commands using Bee. Custom commands are provided from the "scripts" object inside bee.json or Beefile.

To run a custom command, use: $ bee rs mycmd ARGS

$ bee help rs

USAGE
  bee rs

DESCRIPTION
  Run script allows you to run arbitrary commands using Bee.
  Custom commands are provided from the "scripts" object inside bee.json or Beefile.

  To run a custom command, use: $ bee rs mycmd ARGS
  
AVAILABLE SCRIPTS
  gtest
      APP_ENV=test APP_CONF_PATH=$(pwd)/conf go test -v -cover
  gtestall
      APP_ENV=test APP_CONF_PATH=$(pwd)/conf go test -v -cover $(go list ./... | grep -v /vendor/)

Run your scripts with: $ bee rs gtest tests/*.go $ bee rs gtestall

bee api

To create a Beego API application:

$ bee api my-api
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.0.0
2020/09/14 22:35:11 INFO     ▶ 0001 generate api project support go modules.
2020/09/14 22:35:11 INFO     ▶ 0002 Creating API...
	create	 /Users/beeuser/code/learn/my-api/go.mod
	create	 /Users/beeuser/code/learn/my-api
	create	 /Users/beeuser/code/learn/my-api/conf
	create	 /Users/beeuser/code/learn/my-api/controllers
	create	 /Users/beeuser/code/learn/my-api/tests
	create	 /Users/beeuser/code/learn/my-api/conf/app.conf
	create	 /Users/beeuser/code/learn/my-api/models
	create	 /Users/beeuser/code/learn/my-api/routers/
	create	 /Users/beeuser/code/learn/my-api/controllers/object.go
	create	 /Users/beeuser/code/learn/my-api/controllers/user.go
	create	 /Users/beeuser/code/learn/my-api/tests/default_test.go
	create	 /Users/beeuser/code/learn/my-api/routers/router.go
	create	 /Users/beeuser/code/learn/my-api/models/object.go
	create	 /Users/beeuser/code/learn/my-api/models/user.go
	create	 /Users/beeuser/code/learn/my-api/main.go
2020/09/14 22:35:11 SUCCESS  ▶ 0003 New API successfully created!

For more information on the usage, run bee help api.

bee hprose

To create an Hprose RPC application based on Beego:

$ bee hprose my-rpc-app
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.0.0
2020/09/14 22:36:39 INFO     ▶ 0001 generate api project support go modules.
2020/09/14 22:36:39 INFO     ▶ 0002 Creating Hprose application...
	create	 /Users/beeuser/code/learn/my-rpc-app/go.mod
	create	 /Users/beeuser/code/learn/my-rpc-app
	create	 /Users/beeuser/code/learn/my-rpc-app/conf
	create	 /Users/beeuser/code/learn/my-rpc-app/conf/app.conf
	create	 /Users/beeuser/code/learn/my-rpc-app/models
	create	 /Users/beeuser/code/learn/my-rpc-app/models/object.go
	create	 /Users/beeuser/code/learn/my-rpc-app/models/user.go
	create	 /Users/beeuser/code/learn/my-rpc-app/main.go
2020/09/14 22:36:39 SUCCESS  ▶ 0003 New Hprose application successfully created!

For more information on the usage, run bee help hprose.

bee bale

To pack all the static files into Go source files:

$ bee bale
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.0.0
2020/09/14 22:37:56 SUCCESS  ▶ 0001 Baled resources successfully!

For more information on the usage, run bee help bale.

bee migrate

For database migrations, use bee migrate.

For more information on the usage, run bee help migrate.

bee generate

Bee also comes with a source code generator which speeds up the development.

For example, to generate a new controller named hello:

$ bee generate controller hello
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.0.0
2020/09/14 22:38:44 INFO     ▶ 0001 Using 'Hello' as controller name
2020/09/14 22:38:44 INFO     ▶ 0002 Using 'controllers' as package name
	create	 /Users/beeuser/code/learn/my-api/controllers/hello.go
2020/09/14 22:38:44 SUCCESS  ▶ 0003 Controller successfully generated!

For more information on the usage, run bee help generate.

bee dockerize

Bee also helps you dockerize your Beego application by generating a Dockerfile and a docker-compose.yaml file.

For example, to generate a Dockerfile with golang:1.20.1 baseimage and exposing port 9000:

$ bee dockerize -baseimage=golang:1.20.1 -expose=9000
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.0.4
2023/05/02 21:03:05 INFO     ▶ 0001 Generating Dockerfile and docker-compose.yaml...
2023/05/02 21:03:05 SUCCESS  ▶ 0002 Dockerfile generated.
2023/05/02 21:03:05 SUCCESS  ▶ 0003 docker-compose.yaml generated.

For more information on the usage, run bee help dockerize.

bee dlv

Bee can also he

View on GitHub
GitHub Stars1.5k
CategoryDevelopment
Updated5d ago
Forks906

Languages

Go

Security Score

100/100

Audited on Mar 24, 2026

No findings