Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Web Application bootstrap for Go
Branch: master

Merge pull request #4 from valorbreak/master

Update dependency to
latest commit a9328665d3
@elcct authored

Default Project Build Status

Provides essentials that most web applications need - MVC pattern and user authorisation that can be easily extended.

It consists of 3 core components:


Default Project requires Go, MongoDB and few other tools installed.

Instructions below have been tested on Ubuntu 14.04.


If you don't have Go installed, follow installation instructions described here:

Then install remaining dependecies:

sudo apt-get install git mercurial subversion bzr


sudo apt-key adv --keyserver --recv 7F0CEB10
sudo echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-org

No go to your GOPATH location and run:

go get

And then:

go install

In your GOPATH directory you can create config.json file:

    "secret": "secret",
    "public_path": "./src/",
    "template_path": "./src/", 
    "database": {
        "hosts": "localhost",
        "database": "defaultproject"

Finally, you can run:


That should output something like:

2014/06/19 15:31:15.386961 Starting Goji on [::]:8000

And it means you can now direct your browser to localhost:8000

Project structure


All your controllers that serve defined routes.


Helper functions.


You database models.


It has all your static files mapped to /assets/* path except robots.txt and favicon.ico that map to /.


Core functions and structs.


Your views using standard Go template system.


This file starts your web application and also contains routes definition.

Make it your own

I assume you have followed installation instructions and you have defaultproject installed in your GOPATH location.

Let's say I want to create Amazing Website. I create new GitHub repository (of course replace that with your own repository).

Now I have to prepare defaultproject. First thing is that I have to delete its .git directory.

I issue:

rm -rf src/

Then I want to replace all references from to

grep -rl '' ./ | xargs sed -i 's/\/elcct\/defaultproject/\/elcct\/amazingwebsite/g'

Now I have to move all defaultproject files to the new location:

mv src/ src/

And push it to my new repository at GitHub:

cd src/
git init
git add --all .
git commit -m "Amazing Website First Commit"
git remote add origin
git push -u origin master

You can now go back to your GOPATH and check if everything is ok:

go install

And that's it.

Continuous Development

For Continuous Development I recommend using Fresh -

You can install Fresh by issuing:

go get

Then create a config file runner.conf in your GOPATH:

root:              ./src/
tmp_path:          ./tmp
build_name:        runner-build
build_log:         runner-build-errors.log
valid_ext:         .go, .tpl, .tmpl, .html
build_delay:       600
colors:            1
log_color_main:    cyan
log_color_build:   yellow
log_color_runner:  green
log_color_watcher: magenta

Note: Remember to replace ./src/ with your own location

Now if you run:

./bin/fresh -c runner.conf

Project should automatically rebuild itself when a change occurs.

Something went wrong with that request. Please try again.