A boilerplate for fastly building web application based on React & Go using SSR(server side rendering).
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
client
config
scripts
server
.eslintrc
.gitignore
Dockerfile
Gopkg.lock
Gopkg.toml
README.md
jsconfig.json
main.go
package.json

README.md

React Go SSR Boilerplate

Go Report Card

Description

A boilerplate for fastly building web application based on React & Go using SSR(server side rendering).

Requirements

  1. Linux or Mac OS
  2. Node.js (10.0.0 or higher)
  3. Go (1.8.1 or higher)

Features

  • Frontend

  • Backend

    • Manage the Go dependencies by dep
    • Web framework powered by Gin
    • Hot reload powered by another Gin

Usage

For Development

  1. Clone the repo and install all dependencies:

     go get github.com/MrHuxu/react-go-ssr-boilerplate && cd $GOPATH/src/github.com/MrHuxu/react-go-ssr-boilerplate
    
     go get -u github.com/golang/dep/cmd/dep
     dep ensure -v
    
     npm install
    
  2. It's recommended to install the React DevTools and Redux DevTools for frontend debugging.

  3. Launch the server:

     # execute the command below, then you'll see the dashboard shown
     # go visit http://localhost:8283 in your browser
     # editing any file will let the server or frontend reload
    
     go get -u github.com/codegangsta/gin
     npm run dev
    

For Deployment

It is highly recommended to use Docker to deploy this project!!

Using Docker

  1. Clone the repo and build Docker image:

     go get github.com/MrHuxu/react-go-ssr-boilerplate && cd $GOPATH/src/github.com/MrHuxu/react-go-ssr-boilerplate
     docker build . -t react-go-ssr-boilerplate
     docker run -p 13109:13109 -d react-go-ssr-boilerplate
    
  2. Use docker logs command to monitor the logs of the server:

     docker logs -f [container_id]
    

Manually Build

  1. Clone the repo and install all dependencies(same as above).

  2. Launch the server:

     # go visit http://localhost:13109 in your browser after executing the command
    
     npm run prd