Git Product home page Git Product logo

weave's Introduction

Weave

Simple but functional Go+Vue application starter, supported by gin, gorm, redis, postgres, vue, element-plus, websocket and much more.

Features

Server support features:

  • Restful api, write by gin
  • MVC structure
  • Postgres storage, via gorm
  • Swagger doc, support by swag
  • Structured log, support by logrus
  • Prometheus monitor
  • PProf debug
  • Graceful shutdown
  • Authentication, support jwt
  • Request rate limit, server level or user ip
  • Redis cache

Frontend support features:

  • Vue3 supported
  • UI with element-plus
  • Build with vite
  • Charts integration, support by echarts
  • WebShell supported
  • Windi CSS
  • OAuth Login

TODOs

  • Redis cache
  • Request rate limit
  • Authentication
  • WebSocket
  • Trace
  • UI
  • WebShell
  • Dark theme
  • Mobile UI

Run

Before starting, you should already install golang, docker and nodejs in your develop env.

Run server

Install dependencies, postgresql, redis, swag

make init

run locally

make run

See http://localhost:8080

Test api

Register user

curl -XPOST http://localhost:8080/api/auth/user -d '{"name": "zhang3", "email": "[email protected]","password": "123456"}'

Login, get jwt token

curl -XPOST http://localhost:8080/api/auth/token -d '{"name": "zhang3", "password": "123456"}'

Response as follows, set token in Authorization Header

{
  "code": 200,
  "msg": "success",
  "data": {
    "token": "xxx",
    "describe": "set token in Authorization Header, [Authorization: Bearer {token}]"
  }
}

Get users

token=xxx
curl -X 'GET' 'http://localhost:8080/api/v1/users' -H "Authorization: Bearer $token"

Container web shell

  1. login in swagger http://localhost:8080/swagger/index.html#/auth/post_login
  2. create container http://localhost:8080/swagger/index.html#/user/post_api_v1_users
{
  "cmd": [
    "top"
  ],
  "image": "alpine",
  "name": "myapp"
}
  1. open cloudshell http://localhost:8080/api/v1/containers/{:containerid}/terminal

Run UI

Assume you have installed Nodejs, if not, install it by nvm

cd web
npm i
npm run dev 

Default user admin, password: 123456

Explore in http://127.0.0.1:8081

Login page login

Dashboard page dashboard

App page app

Webshell page webshell

Others

Login with Github, see https://docs.github.com/cn/developers/apps/building-oauth-apps/authorizing-oauth-apps

  1. Open Github developer settings https://github.com/settings/developers, click OAuth Apps
  2. Create OAuth app, click New OAuth App button
  3. Register app, contents as follows
  name: Weave
  Homepage URL: http://127.0.0.1:8081
  Authorization callback URL: http://127.0.0.1:8081/oauth
  1. Get your clientId and clientSecret, set in config/app.yaml and web/src/config.js

weave's People

Contributors

qingwave avatar

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.