Need help with beego?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

25.4K Stars 5.0K Forks Other 4.0K Commits 469 Opened issues


beego is an open-source, high-performance web framework for the Go programming language.

Services available


Need anything else?

Contributors list

Beego Build Status GoDoc Foundation Go Report Card

beego is used for rapid development of RESTful APIs, web apps and backend services in Go. It is inspired by Tornado, Sinatra and Flask. beego has some Go-specific features such as interfaces and struct embedding.

More info at

If you could not open this website, go to beedoc

beego 1.x and 2.x

We recently release beego 2.0.0-beta, and its structure change a lot, so you may get some error

  1. If you are working on beego v1.x please try
    go get[email protected]
  2. If you want to try beego 2.0.0, run
    go get[email protected]

We are still working on fix bug and documentation of v2.x. And v2.x's doc will be released with v2.0.0.

Next version

v1.12.4 will be released on Jan 2021 And v2.0.0 will be released next month.

Quick Start

Please see Documentation for more.

Web Application

directory, cd

mkdir hello
cd hello

Init module

go mod init

Download and install

go get -u[email protected]

Now we are working on beego v2.0.0, so using


Create file

package main

import ""

func main(){ web.Run() }

Build and run

go build hello.go

Go to http://localhost:8080

Congratulations! You've just built your first beego app.

Using ORM module

package main

import ( "" "" _ "" )

// User - type User struct { ID int orm:"column(id)" Name string orm:"column(name)" }

func init() { // need to register models in init orm.RegisterModel(new(User))

// need to register db driver
orm.RegisterDriver("mysql", orm.DRMySQL)

// need to register default database
orm.RegisterDataBase("default", "mysql", "beego:[email protected](")


func main() { // automatically build table orm.RunSyncdb("default", false, true)

// create orm object, and it will use `default` database
o := orm.NewOrm()

// data
user := new(User)
user.Name = "mike"

// insert data
id, err := o.Insert(user)
if err != nil {

// ...


Using httplib as http client

package main

import ( "" "" )

func main() { // Get, more methods please read docs req := httplib.Get("") str, err := req.String() if err != nil { logs.Error(err) } logs.Info(str) }

Using config module

package main

import ( "context"



var ( ConfigFile = "./app.conf" )

func main() { cfg, err := config.NewConfig("ini", ConfigFile) if err != nil { logs.Critical("An error occurred:", err) panic(err) } res, _ := cfg.String(context.Background(), "name") logs.Info("load config name is", res) }

Using logs module

package main

import ( "" )

func main() { err := logs.SetLogger(logs.AdapterFile, {"filename":"project.log","level":7,"maxlines":0,"maxsize":0,"daily":true,"maxdays":10,"color":true}) if err != nil { panic(err) } logs.Info("hello beego") }

Using timed task

package main

import ( "context" "time"



func main() { // create a task tk1 := task.NewTask("tk1", "0/3 * * * * *", func(ctx context.Context) error { logs.Info("tk1"); return nil })

// check task
err := tk1.Run(context.Background())
if err != nil {

// add task to global todolist
task.AddTask("tk1", tk1)

// start tasks

// wait 12 second
time.Sleep(12 * time.Second)
defer task.StopTask()


Using cache module

package main

import ( "context" "time"


// don't forget this
_ ""



func main() { // create cache bm, err := cache.NewCache("redis", {"key":"default", "conn":":6379", "password":"123456", "dbNum":"0"}) if err != nil { logs.Error(err) }

// put
isPut := bm.Put(context.Background(), "astaxie", 1, time.Second*10)

isPut = bm.Put(context.Background(), "hello", "world", time.Second*10)

// get
result, _ := bm.Get(context.Background(),"astaxie")

multiResult, _ := bm.GetMulti(context.Background(), []string{"astaxie", "hello"})
for i := range multiResult {

// isExist
isExist, _ := bm.IsExist(context.Background(), "astaxie")

// delete
isDelete := bm.Delete(context.Background(), "astaxie")



  • RESTful support
  • MVC architecture
  • Modularity
  • Auto API documents
  • Annotation router
  • Namespace
  • Powerful development tools
  • Full stack for Web & API




beego source code is licensed under the Apache Licence, Version 2.0 (

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.