# lic-manage **Repository Path**: asmdas/lic-manage ## Basic Information - **Project Name**: lic-manage - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-29 - **Last Updated**: 2025-12-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 许可证管理系统 一个使用 Axum 后端、Angular 前端、SQLite 数据库和 SQLx migrate 的现代化许可证管理系统。 ## 技术栈 ### 后端 - **Rust** - 系统编程语言 - **Axum** - 现代异步 Web 框架 - **SQLx** - 异步 SQL 工具包 - **SQLite** - 轻量级数据库 - **JWT** - JSON Web Token 认证 - **bcrypt** - 密码哈希 ### 前端 - **Angular 20** - 现代前端框架 - **Angular Material** - Material Design 组件库 - **TypeScript** - 类型安全的 JavaScript - **SCSS** - CSS 预处理器 ## 功能特性 - ✅ 用户登录认证 - ✅ JWT 认证和授权 - ✅ 密码安全哈希 - ✅ 现代化 Material Design UI - ✅ 响应式设计 - ✅ 数据库迁移管理 - ✅ CORS 支持 ## 项目结构 ``` lic-manage/ ├── src/ # Rust 后端源码 │ ├── main.rs # 应用入口 │ ├── models/ # 数据模型 │ ├── services/ # 业务逻辑 │ ├── handlers/ # API 处理器 │ └── middleware/ # 中间件 ├── migrations/ # 数据库迁移文件 ├── frontend/ # Angular 前端 │ ├── src/ │ │ ├── app/ │ │ │ ├── components/ # 组件 │ │ │ ├── services/ # 服务 │ │ │ └── app.routes.ts # 路由配置 │ │ └── main.ts │ └── package.json ├── Cargo.toml # Rust 依赖配置 └── README.md ``` ## 快速开始 ### 环境要求 - Rust 1.90+ - Node.js 20+ - npm 或 yarn ### 后端启动 1. 安装 Rust 依赖: ```bash cargo build ``` 2. 运行数据库迁移: ```bash # 数据库会在首次运行时自动创建 cargo run ``` 后端服务将在 `http://localhost:3000` 启动。 ### 前端启动 1. 进入前端目录: ```bash cd frontend ``` 2. 安装依赖: ```bash npm install ``` 3. 启动开发服务器: ```bash npm start ``` 前端应用将在 `http://localhost:4200` 启动。 ## API 接口 ### 认证接口 #### 用户登录 ``` POST /api/auth/login Content-Type: application/json { "username": "testuser", "password": "password123" } ``` #### 获取用户信息 ``` GET /api/profile Authorization: Bearer ``` ### 健康检查 ``` GET /api/health ``` ## 数据库模式 ### users 表 - `id` - 用户唯一标识符 (UUID) - `username` - 用户名 (唯一) - `email` - 邮箱地址 (唯一) - `password_hash` - 密码哈希 - `created_at` - 创建时间 - `updated_at` - 更新时间 ## 开发说明 ### 添加新的 API 端点 1. 在 `src/handlers/` 中创建新的处理器 2. 在 `src/main.rs` 中添加路由 3. 更新前端服务以调用新接口 ### 数据库迁移 1. 在 `migrations/` 目录中创建新的 SQL 文件 2. 文件命名格式:`XXX_description.sql` 3. 运行 `cargo run` 自动执行迁移 ### 前端组件开发 1. 使用 Angular CLI 生成组件: ```bash ng generate component components/component-name ``` 2. 在组件中使用 Angular Material 组件 3. 遵循 Material Design 设计规范 ## 部署 ### 后端部署 1. 构建生产版本: ```bash cargo build --release ``` 2. 设置环境变量: ```bash export JWT_SECRET="your-secret-key" ``` 3. 运行应用: ```bash ./target/release/lic-manage ``` ### 前端部署 1. 构建生产版本: ```bash cd frontend npm run build ``` 2. 部署 `dist/` 目录到 Web 服务器 ## 安全注意事项 - 在生产环境中使用强 JWT 密钥 - 定期更新依赖包 - 使用 HTTPS 传输 - 实施适当的 CORS 策略 - 考虑添加速率限制 ## 许可证 MIT License