Skip to content
This repository has been archived by the owner on Aug 12, 2021. It is now read-only.
/ go-vue-starter Public archive

go-vue-starter demonstrates the usage of Go and Vue.js

License

Notifications You must be signed in to change notification settings

ricoberger/go-vue-starter

Repository files navigation

Go ♥ Vue Starter

This project contains a quick starter kit for a Go project using Vue as single page app. The Go server uses MongoDB to store data, supports JWT authentication and embedding the Vue build. The Vue single page app supports routing via Vue Router, state management via Vuex and implements Googles Material Design using Vuetify.

Landing Page

Features

  • Go API using Gorilla mux
  • Go server to serve the Vue app
  • MongoDB integration
  • JWT authentication
  • Embedding Vue build into Go binary using esc
  • Go server configuration via .yml file
  • Using Go Modules for dependency management
  • Makefile based project
  • Routing via vue-router
  • State management via vuex
  • Material Design using vuetify
  • TypeScript support
  • Class-Style Vue Components

Dashboard

Building and running

The Go ♥ Vue Starter contains a Go server which serves the single page Vue app and an API whiche handles all request from the Vue frontend. To run the Go server and Vue app as separated process run the following commands:

git clone github.com/ricoberger/go-vue-starter
go get -u github.com/mjibson/esc

# Run the Vue app on localhost:8080
cd go-vue-starter/web/vue.js

yarn install
yarn serve

# Run the Go server on localhost:8081
cd go-vue-starter

make build
./bin/starter

If you want to serve the Vue frontend app within the Go server run:

git clone github.com/ricoberger/go-vue-starter
go get -u github.com/mjibson/esc

# Build the Vue app
cd go-vue-starter/web/vue.js

yarn install
yarn build

# Run the Go server and the Vue app on localhost:8080
cd go-vue-starter

make build
./bin/starter

Usage and configuration

You can build and run the Go ♥ Vue Starter by your own or you can use the prebuild binaries. Befor you start the Go ♥ Vue Starter edit the config.yml file:

# Port where the go-vue-starter should listen on
listen_address: :8080

api:
  # Domain is for the frontend
  domain: http://localhost:8080
  # Signing secret for the jwt authentication
  signing_secret: "your-super-secret"

app:

database:
  # Connection URL for MongoDB and the name of the MongoDB database
  mongodb:
    connection_uri: mongodb://localhost:27017
    database_name: go-vue-starter

# Email credentials to send the verification, reset password, etc. email
mail:
  identity:
  username:
  password:
  host:
  addr:
  from:

  # Use html or plaintext emails, must be true or false
  html:

  # Email subjects
  subjects:
    welcome: "Welcome to the Go + Vue Starter"
    reset-password: "Reset password request"
    email-verification: "Verify your email address"
    email-changed: "Your email address has been changed"

After you adjust the configuration file you can use the Go ♥ Vue Starter as follows:

Usage of starter:
  -config.file string
      Path to the configuration file. (default "config.yml")
  -debug
      Show debug information.
  -version
      Show version information.

Dependencies

Go ♥ Vue Starter is build up on some dependencies for Go and Vue. The Go dependencies are:

The dependencies for the Vue app are: