go-starter-kit 0,2,7,1,3,0,7 eslint npm webpack

Golang isomorphic react/hot reloadable/redux/css-modules starter kit

go-starter-kit wercker status 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 via goja javascript engine, implemented in pure Golang and also with a set of useful features for rapid development of efficient applications.

What it contains?

  • server side render via goja
  • api requests between your react application and server side application directly via fetch polyfill
  • 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
  • css styles without global namespace via PostCSS, 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

Workflow dependencies

Note that probably not works at windows.

Project structure

The server's entry point
$ tree server
server
├── api.go
├── app.go
├── bindata.go <-- this file is gitignored, it will appear at compile time
├── conf.go
├── data
│   └── templates
│       └── react.html
├── main.go <-- main function declared here
├── react.go
└── utils.go

The ./server/ is flat golang package.

The client's entry point

It's simple React application

$ tree client
client
├── actions.js
├── components
│   ├── app
│   │   ├── favicon.ico
│   │   ├── index.js
│   │   └── styles.css
│   ├── homepage
│   │   ├── index.js
│   │   └── styles.css
│   ├── not-found
│   │   ├── index.js
│   │   └── styles.css
│   └── usage
│       ├── index.js
│       └── styles.css
├── css
│   ├── funcs.js
│   ├── global.css
│   ├── index.js
│   └── vars.js
├── index.js <-- main function declared here
├── reducers.js
├── router
│   ├── index.js
│   ├── routes.js
│   └── toString.js
└── store.js

The client app will be compiled into server/data/static/build/. Then it will be embedded into go package via go-bindata. After that the package will be compiled into binary.

Convention: javascript app should declare main function right in the global namespace. It will used to render the app at the server side.

Install

Clone the repo:

$ git clone [email protected]:olebedev/go-starter-kit.git $GOPATH/src/github.com/<username>/<project>
$ cd $GOPATH/src/github.com/<username>/<project>

Install dependencies:

$ make install

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 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. Note that the binary will be named as the current project directory.

License

MIT

Related Repositories

yii2-starter-kit

yii2-starter-kit

Yii2 Starter Kit ...

wordpress-gulp-starter-kit

wordpress-gulp-starter-kit

A starter kit for developing WordPress themes with Gulp. ...

go-react-example

go-react-example

[DEPRECATED] TAKE A LOOK THIS PROJECT https://github.com/olebedev/go-starter-ki ...

apollo-universal-starter-kit

apollo-universal-starter-kit

Apollo Universal Starter Kit — Universal web and mobile app boilerplate with Hot ...

laravel-enterprise-starter-kit

laravel-enterprise-starter-kit

Enterprise Web application starter kit or template using Laravel 5.1 ...


Top Contributors

olebedev franklinkim matsu911 rtuin ReadmeCritic smd686s gitter-badger javiercbk

Dependencies

package version
autoprefixer ^6.7.7
babel-core ^6.24.1
babel-eslint ^7.2.2
babel-loader ^6.4.1
babel-polyfill ^6.23.0
babel-preset-es2015 ^6.24.1
babel-preset-react ^6.24.1
babel-preset-react-hmre ^1.1.1
babel-preset-stage-0 ^6.24.1
css-loader ^0.28.0
eslint ^3.19.0
eslint-plugin-react ^6.10.3
expose-loader ^0.7.1
express ^4.15.2
extract-text-webpack-plugin ^1.0.1
file-loader ^0.11.1
normalize.css ^6.0.0
postcss-functions ^2.1.0
postcss-loader ^1.3.3
precss ^1.4.0
proxy-middleware ^0.15.0
react ^15.5.4
react-dom ^15.5.4
react-helmet ^5.0.3
react-redux ^4.4.8
react-router ^3.0.5
redux ^3.6.0
redux-logger ^3.0.1
style-loader ^0.16.1
svgo-loader ^1.2.1
url-loader ^0.5.8
webpack ^1.12.13
webpack-dev-middleware ^1.10.1
webpack-hot-middleware ^2.18.0
whatwg-fetch ^2.0.3
when ^3.7.8

Releases

-   v0.1.0 zip tar
-   v0.0.0 zip tar