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
- 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
fswatch build for Ubuntu 15.x
wget https://github.com/emcrisostomo/fswatch/releases/download/1.7.0/fswatch-1.7.0.tar.gz tar -xzf fswatch-1.7.0.tar.gz cd fswatch-1.7.0 tar -gzf fswatch-1.7.0.tar.gz ./configure make make clean sudo ldconfig
Note that probably not works at windows.
Clone the repo:
$ git clone firstname.lastname@example.org:olebedev/go-starter-kit.git && cd go-starter-kit
$ npm i
Install Golang dependencies:
$ go get bitbucket.org/horisen/verifycenterweb/server $ go get github.com/jteeuwen/go-bindata/...
You will get this output after
go get app, at the first time:
server/app.go:64: undefined: Asset server/app.go:65: undefined: AssetDir server/react.go:191: undefined: Asset
don't worry about this, see this comment.
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.
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
- [x] migrate from react-hot-loader to react-transform-hmr
- [x] update react to 0.14.x
- [x] update react-router to 1.x
- [x] render final HTML markup at Golang side
- [x] migrate from Flummox to Redux
- [ ] migrate from Stylus to PostCSS
- [x] migrate from Gin to Echo
- [ ] improve README and write an article to describe the project