Giter Club home page Giter Club logo

go-vue-template's Introduction

Go Vue template

Go-Vue-template is a project that serves as a template for future web applications involving a Go backend (API server) and Vue frontend (SPA client). It has the following features:

  • Vue for a Single Page Application frontend structure
  • OAuth2 authentication using social logins
  • Semantic-UI for interface design
  • Webpack to bundle files

This package will be updated as I go. Incomplete todo list:

  • Use TLS for everything
  • Automatic logout using Vuex and timeout
  • Logout blacklists user at the server
  • Automatic OAuth token refresh
  • Able to add more scopes to OAuth providers
  • 401 Unauthorized vs 403 Forbidden in server responses; which is more appropriate? 401 if we want the user to retry logging in
  • Move client authorization code into a plugin
  • Use github.com/markbates/goth for OAuth providers

Install

Make sure you have the Go compiler and NPM installed.

# Download and install this package
go get github.com/tdewolff/go-vue-template

# Download and install client NPM packages
cd client
npm install

Run

Development mode

Server in dev mode will enable CORS headers from localhost:8080. Running the Vue client will automatically open the browser at http://localhost:8080/

# Start API server at :3000
go-vue-template --dev

# Start Vue client with hot-reloading at :8080
cd client
npm run dev

Production mode

# Build the client files to client/dist/
npm run build

# Start the webserver at :3000
go-vue-template

Now navigate to http://localhost:3000/. You can change the port in the config.json file.

# Analyze filesizes
npm run build --report

For detailed explanation on how things work at the client, checkout the guide and docs for vue-loader.

Ready-up for your application

  • Set name and host in config.json
  • Set title in client/index.html
  • Set JWT secret in main.go
  • Add social login client IDs and secrets to config.json
  • Create your database scheme in scheme.sql
  • Develop your API server and client interface

License

Released under the MIT license.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.