Skip to content

dotfold/go-starter-kit

 
 

Repository files navigation

go-starter-kit

Join the chat at https://gitter.im/olebedev/go-starter-kit

This project contains a quick starter kit for Facebook React Single Page Apps with Golang server side render and also with a set of useful features for rapid development of efficient applications.

What it contains?

  • server side render via go-duktape
  • api requests between your react application and server side application directly via fetch polyfill for go-duktape at server side, and it is possible to process requests with user session as well
  • title, Open Graph and other domain-specific meta tags render for each page at the server and at the client
  • server side redirect
  • embedding static files into artefact via bindata
  • high performance echo framework
  • advanced cli via cli
  • Makefile based project
  • one(!) terminal window process for development
  • routing via react-router
  • ES6 & JSX via babel-loader with minimal runtime dependency footprint
  • redux as state container
  • redux-devtools
  • stylus css styles without global namespace via css-loader & css-modules
  • separate css file to avoid FOUC
  • hot reloading via react-transform & HMR
  • webpack bundle builder
  • eslint and golint rules for Makefile

Dependencies

Note that probably not works at windows.

Install

Clone the repo:

$ git clone git@github.com:olebedev/go-starter-kit.git && cd go-starter-kit

Install javascript dependencies:

$ npm i

Install Golang dependencies.

$ export GOPATH=`pwd` # the most important step, ensure that you do it
$ export GOBIN=$GOPATH/bin # optional, redefine, if it already was defined

There are two ways to do it:

  1. Traditional go get(not recommended).
$ go get ./...
$ go get github.com/jteeuwen/go-bindata/...
  1. Via revision locking tool - srlt.
    Make sure that you have srlt installed.
$ srlt r && srlt e go install {{.Name}}/...

Run development

Start dev server:

$ make serve

that's it. Open http://localhost:5001/(if you use default port) at your browser. Now you ready to start coding your awesome project.

Build

Install dependencies and just type NODE_ENV=production make build. This rule is producing webpack build and regular golang build after that. Result you can find at $GOPATH/bin.

TODO

  • migrate from react-hot-loader to react-transform-hmr
  • update react to 0.14.x
  • update react-router to 1.x
  • render final HTML markup at Golang side
  • migrate from Flummox to Redux
  • migrate from Stylus to PostCSS
  • migrate from Gin to Echo
  • improve README and write an article to describe the project

About

Golang Isomorphic React/Hot Reloadable/Redux/Css-Modules Starter Kit

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 45.7%
  • Go 38.6%
  • CSS 5.8%
  • HTML 5.2%
  • Makefile 4.7%