# PineconePanel **Repository Path**: tennine-project/pinecone-panel ## Basic Information - **Project Name**: PineconePanel - **Description**: 松塔应用面板,应用编译打包,部署等 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-17 - **Last Updated**: 2026-07-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PineconePanel — 应用管理系统 一站式应用全生命周期管理平台,覆盖从代码提交到生产部署的完整链路。 ## 项目结构 ``` pinecone-panel/ ├── backend/ # Go 后端服务 │ ├── cmd/auth-svc/ # 认证服务入口 │ ├── internal/auth/ # 认证模块(model/repo/service/handler) │ ├── pkg/ # 共享包(apierror/middleware/pagination) │ ├── deploy/sql/ # 数据库 Migration + 种子数据 │ ├── go.mod / go.sum # Go 依赖 │ ├── Makefile # 构建/迁移/运行脚本 │ └── .env.example # 环境变量模板 ├── frontend/ # React 前端 │ ├── src/ │ │ ├── api/ # API 服务层 │ │ ├── components/ # 公共组件(AuthGuard 等) │ │ ├── layouts/ # 布局组件(MainLayout) │ │ ├── pages/ # 页面,按模块分组 │ │ ├── router/ # 路由配置 │ │ ├── stores/ # Zustand 状态管理 │ │ └── types/ # TypeScript 类型定义 │ ├── vite.config.ts # Vite 配置(含 API 代理) │ └── package.json └── .gitignore ``` ## 技术栈 | 层级 | 技术 | 版本 | |------|------|------| | 后端语言 | Go | 1.25 | | Web 框架 | Gin | 1.12 | | ORM | GORM | 1.31 | | 数据库 | PostgreSQL | 15 | | 认证 | JWT (HS256) | — | | 前端框架 | React | 19 | | UI 组件库 | Ant Design | 6 | | 状态管理 | Zustand | 5 | | 构建工具 | Vite | 8 | | 类型系统 | TypeScript | 6 | ## 环境要求 | 工具 | 最低版本 | 说明 | |------|----------|------| | Go | 1.25 | 后端编译与运行 | | Node.js | 22 | 前端构建与开发 | | PostgreSQL | 15 | 业务数据存储 | | Redis | 7 | 缓存与会话(可选,当前未强依赖) | ## 快速开始 ### 1. 数据库准备 ```bash # 创建数据库 createdb pinecone_panel # 进入后端目录 cd backend ``` ### 2. 配置环境变量 ```bash cp .env.example .env # 编辑 .env,修改 DATABASE_URL 中的用户名和密码 ``` ### 3. 运行数据库迁移与种子数据 ```bash # 方式一:使用 Makefile(推荐) DATABASE_URL=postgres://postgres:postgres@localhost:5432/pinecone_panel?sslmode=disable make db-migrate DATABASE_URL=postgres://postgres:postgres@localhost:5432/pinecone_panel?sslmode=disable make db-seed # 方式二:手动执行 SQL psql pinecone_panel -f deploy/sql/000001_create_users_tables.up.sql psql pinecone_panel -f deploy/sql/000002_create_audit_tables.up.sql psql pinecone_panel -f deploy/sql/000003_create_project_app_tables.up.sql psql pinecone_panel -f deploy/sql/000004_create_deploy_tables.up.sql psql pinecone_panel -f deploy/sql/000015_seed_default_data.up.sql ``` 种子数据包含: - 管理员账号:`admin` / `admin123` - 5 个预置角色:超级管理员、管理员、开发工程师、运维工程师、访客 - 26 个权限码(覆盖用户/应用/部署/流水线/监控等模块) ### 4. 启动后端 ```bash cd backend make run-auth ``` 后端运行在 http://localhost:8001,默认监听端口 `8001`(由 `AUTH_SVC_PORT` 环境变量控制)。 API 前缀为 `/api/v1`,主要端点: | 端点 | 方法 | 说明 | |------|------|------| | `/api/v1/auth/login` | POST | 用户登录 | | `/api/v1/auth/refresh` | POST | 刷新 Token | | `/api/v1/auth/logout` | POST | 登出 | | `/api/v1/auth/me` | GET | 当前用户信息 | | `/api/v1/users` | GET / POST | 用户列表 / 创建 | | `/api/v1/users/:id` | GET / PUT | 用户详情 / 修改 | | `/api/v1/users/:id/roles` | PUT | 分配角色 | | `/api/v1/roles` | GET / POST | 角色列表 / 创建 | | `/api/v1/roles/:id` | GET / PUT / DELETE | 角色详情 / 修改 / 删除 | | `/api/v1/roles/:id/permissions` | PUT | 分配权限 | | `/api/v1/permissions` | GET | 权限列表 | | `/api/v1/audit-logs` | GET | 审计日志 | ### 5. 启动前端 ```bash cd frontend npm install # 首次运行需安装依赖 npm run dev ``` 前端运行在 http://localhost:5173,API 请求自动代理到后端 `localhost:8001`。 打开浏览器访问 http://localhost:5173,使用 `admin` / `admin123` 登录。 ## Makefile 命令参考 在 `backend/` 目录下执行: | 命令 | 说明 | |------|------| | `make help` | 查看所有可用命令 | | `make build` | 编译所有服务 | | `make build-auth` | 仅编译 auth-svc | | `make run-auth` | 运行 auth-svc(开发模式) | | `make tidy` | 整理 Go 依赖 | | `make lint` | 代码检查(需安装 golangci-lint) | | `make test` | 运行测试 | | `make db-migrate` | 运行数据库迁移 | | `make db-seed` | 写入种子数据 | | `make db-reset` | 清空并重建数据库 | | `make clean` | 清理编译产物 | ## 环境变量 | 变量 | 默认值 | 说明 | |------|--------|------| | `DATABASE_URL` | — | PostgreSQL 连接字符串 | | `JWT_SECRET` | change-me | JWT 签名密钥(生产环境务必修改) | | `ACCESS_TOKEN_TTL` | 2h | Access Token 有效期 | | `REFRESH_TOKEN_TTL` | 168h | Refresh Token 有效期 | | `AUTH_SVC_PORT` | 8001 | 认证服务端口 | | `LOG_LEVEL` | info | 日志级别(debug/info/warn/error) | 完整列表见 `backend/.env.example`。