Rocket launching a Go project

Handwritten on 28 May 2018

Rocket launching a Go project

Looking for a Golang rocket launch project? Check out these handpicked components. Each component is perfectly designed for its job.

  1. Router -
  2. Middleware - (alt:
  3. Logging -
  4. Database ORM -
  5. Sessions -
  6. Schema bindings -
  7. Configuration -

When you glue these components into one project you will get a rocket powered Go project. Oh boy, this project is already for deployment. And all your customers would be happy.

In your root folder create a main.go file that looks like the following:

package main

import (


func main() {
    // Instantiate new mux router
    r := mux.NewRouter()
    // Instantiate middleware provider
    n := negroni.Classic()
    // Register application routes
        r.HandleFunc("/", new(handlers.HomeHandler).Index)

    // Prepare server to spin up
    s := &http.Server{
        Addr: "",
        // link middleware with router
        Handler: n,
        // default time outs
        WriteTimeout: 15 * time.Second,
        ReadTimeout:  15 * time.Second,

    // Listen and serve baby

In the above file I assume you have a folder called handlers/http/. In this folder at least a HomeHandler is present with the following content:

package handlers

import (

// HomeHandler represents basic routes
type HomeHandler struct{}

// Index will show the homepage
func (h HomeHandler) Index(w http.ResponseWriter, r *http.Request) {
    fmt.Fprint(w, "Hi there, I am ready!")

This post will be updated shortly.



© 2023 Handcrafted in Nijmegen, The Netherlands