You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Go to file
veypi 46f01afc9f feat(auth): Improve OAuth callback and add memory cache fallback
- Add random avatar generation for new users in register
    - Fix OAuth state parsing with type assertions and error handling
    - Add TempToken field to CallbackResponse for bind flow
    - Implement dynamic redirect URI resolution with X-Forwarded headers support
    - Add memory cache fallback when Redis is unavailable
    - Change default port from 4001 to 4000 in Makefile
3 weeks ago
api feat(auth): Improve OAuth callback and add memory cache fallback 3 weeks ago
auth refactor(auth): Use vigo/contrib/auth.Auth interface instead of local definition 3 weeks ago
cfg refactor: Migrate auth to Vigo auth interface and simplify initialization 4 weeks ago
cli refactor: Migrate auth to Vigo auth interface and simplify initialization 4 weeks ago
docs docs: Format auth.md with consistent table spacing 3 weeks ago
libs feat(auth): Improve OAuth callback and add memory cache fallback 3 weeks ago
models refactor: Remove multi-tenant org system and simplify auth 4 weeks ago
scripts docs: Update documentation to reflect scoped RBAC and remove org system 3 weeks ago
tests test: Update tests for scoped RBAC and remove org tests 3 weeks ago
ui feat(ui): Add system settings and OAuth providers management pages 3 weeks ago
.gitignore chore(gitignore): Update ignore rules 1 month ago
CLAUDE.md docs: Update documentation to reflect scoped RBAC and remove org system 3 weeks ago
LICENSE Initial commit 5 years ago
Makefile feat(auth): Improve OAuth callback and add memory cache fallback 3 weeks ago
README.md docs: Update documentation to reflect scoped RBAC and remove org system 3 weeks ago
agents.md refactor(cfg): Restructure database configuration and initialization flow 1 month ago
dev.yml rename to vbase 1 month ago
go.mod refactor(auth): Use vigo/contrib/auth.Auth interface instead of local definition 3 weeks ago
go.sum refactor(auth): Use vigo/contrib/auth.Auth interface instead of local definition 3 weeks ago
init.go refactor(api): Update permission codes and remove org-related code 3 weeks ago

README.md

VBase

Go Version License Framework

基于 Golang 的高性能身份认证与权限管理基础框架

快速开始核心特性集成指南API 文档架构设计


简介

VBase 是一个基于 Vigo 框架开发的高性能后端基础框架提供一套标准化的用户管理、作用域权限控制Scoped RBAC和 OAuth2 认证服务。可作为独立服务部署,也可作为基础库集成到你的 Go 项目中。

核心特性

  • 🔐 完整认证体系 - JWT Token 认证Access + Refresh、多因素认证短信验证码
  • 🛡️ Scoped RBAC 权限控制 - 基于作用域Scope的角色访问控制支持资源级权限和通配符权限
  • <EFBFBD> 层级权限管理 - 支持资源类型(奇数层)和实例(偶数层)的精细化权限控制
  • 🔑 OAuth2 Provider - 完整的 OAuth2 服务端实现,支持第三方应用接入
  • 🗄️ 多数据库支持 - MySQL、PostgreSQL、SQLite 自动适配
  • 📱 内置管理界面 - 基于 vhtml 的嵌入式管理后台
  • 🚀 高性能 - 基于洋葱模型中间件架构,低延迟高并发
  • 🧪 完整测试 - 集成测试脚本覆盖核心业务流程

快速开始

安装

go get github.com/veypi/vbase

作为独立服务运行

# 克隆项目
git clone https://github.com/veypi/vbase.git
cd vbase

# 配置数据库(编辑 dev.yaml 或使用环境变量)
export DSN="root:password@tcp(127.0.0.1:3306)/vbase?charset=utf8&parseTime=True"
export DB="mysql"

# 启动服务
go run ./cli/main.go

# 或使用 Makefile默认端口 4001
make run

服务默认在 http://localhost:4000 启动,管理界面访问 /vb/ 路径。

作为库集成

package main

import (
    "github.com/veypi/vbase"
    "github.com/veypi/vigo"
)

var Router = vigo.NewRouter()

func init() {
    // 挂载 VBase 路由到 /vb 前缀
    Router.Extend("/vb", vbase.Router)
}

更多集成方式请参考 集成指南

项目结构

vbase/
├── api/           # REST API 接口层
│   ├── auth/      # 认证接口登录、注册、Token 刷新)
│   ├── oauth/     # OAuth2 Provider 接口
│   ├── role/      # 角色管理
│   └── user/      # 用户管理
├── auth/          # 核心权限控制模块Scoped RBAC 实现)
├── cfg/           # 配置管理
├── cli/           # 命令行入口
├── models/        # 数据模型GORM
├── ui/            # 前端管理界面vhtml
└── docs/          # 文档