# auto-serve **Repository Path**: knowingautumn/auto-serve ## Basic Information - **Project Name**: auto-serve - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-12-31 - **Last Updated**: 2025-03-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

Nest Logo

[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 [circleci-url]: https://circleci.com/gh/nestjs/nest

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Donate us Support us Follow us on Twitter

## Description [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. ## Project setup ```bash $ pnpm install ``` ## Compile and run the project ```bash # development $ pnpm run start # watch mode $ pnpm run start:dev # production mode $ pnpm run start:prod ``` ## Run tests ```bash # unit tests $ pnpm run test # e2e tests $ pnpm run test:e2e # test coverage $ pnpm run test:cov ``` ## Deployment When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information. If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps: ```bash $ pnpm install -g mau $ mau deploy ``` With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure. ## Resources Check out a few resources that may come in handy when working with NestJS: - Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework. - For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy). - To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/). - Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks. - Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com). - Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com). - To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs). - Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com). ## Support Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). ## Stay in touch - Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec) - Website - [https://nestjs.com](https://nestjs.com/) - Twitter - [@nestframework](https://twitter.com/nestframework) ## License Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE). # Auto-Serve 基于 NestJS 框架的自动化服务后端项目。 ## 项目描述 本项目是一个基于 NestJS 框架开发的后端服务,提供了以下功能: - HTTP RESTful API 接口 - WebSocket 实时通信 - 统一的错误处理机制 - 标准的响应格式 - 角色管理和权限控制 - 自动化脚本管理 ## 技术栈 - NestJS v11 - TypeScript - Socket.IO - PostgreSQL - TypeORM - Class Validator - Class Transformer ## 项目结构 ``` src/ ├── common/ # 公共模块 │ ├── constants/ # 常量定义 │ ├── filters/ # 异常过滤器 │ ├── interceptors/ # 拦截器 │ └── interfaces/ # 接口定义 ├── config/ # 配置文件 ├── decorators/ # 装饰器 ├── guards/ # 守卫 ├── middlewares/ # 中间件 ├── modules/ # 业务模块 │ └── roles/ # 角色模块 ├── pipes/ # 管道 ├── utils/ # 工具函数 ├── gateways/ # WebSocket 网关 ├── app.controller.ts ├── app.service.ts ├── app.module.ts └── main.ts ``` ## 开发规范 1. **命名规范** - 文件名:使用 kebab-case(如:user-profile.service.ts) - 类名:使用 PascalCase(如:UserProfileService) - 方法名:使用 camelCase(如:getUserProfile) - 变量名:使用 camelCase(如:userProfile) - 常量:使用 UPPER_SNAKE_CASE(如:MAX_RETRY_COUNT) 2. **代码风格** - 使用 ESLint 进行代码检查 - 使用 Prettier 进行代码格式化 - 遵循 TypeScript 最佳实践 3. **文档规范** - 所有的公共方法必须添加 JSDoc 注释 - 复杂的业务逻辑需要添加详细的注释 - 保持 README.md 文件的及时更新 4. **Git 规范** - feat: 新功能 - fix: 修复问题 - docs: 文档修改 - style: 代码格式修改 - refactor: 代码重构 - test: 测试用例修改 - chore: 其他修改 ## API 文档 ### HTTP 响应格式 所有的 HTTP 响应都会遵循以下格式: ```typescript { code: number; // 状态码,0 表示成功 message: string; // 状态信息 data?: any; // 响应数据(可选) } ``` ### WebSocket 消息格式 ```typescript // 发送消息格式 { type: string; // 消息类型 timestamp: number; // 时间戳 requestId?: string; // 请求ID event: string; // 事件名称 room?: string; // 房间ID(可选) payload?: any; // 消息数据 } // 响应消息格式 { type: string; // 消息类型 timestamp: number; // 时间戳 requestId?: string; // 请求ID status: 'success' | 'error'; // 状态 message?: string; // 消息 data?: any; // 响应数据 } ``` ### 角色管理 API #### 创建角色 ```http POST /roles Content-Type: application/json { "name": "角色名称", "script_url": "https://example.com/script.js", "rules": { "key": "value" }, "description": "角色描述" } ``` #### 获取脚本URL ```http GET /roles/:id/script-url ``` ## 环境配置 1. **开发环境** ```bash # 安装依赖 $ pnpm install # 启动开发服务器 $ pnpm run start:dev ``` 2. **生产环境** ```bash # 构建项目 $ pnpm run build # 启动生产服务器 $ pnpm run start:prod ``` ## 测试 ```bash # 单元测试 $ pnpm run test # e2e 测试 $ pnpm run test:e2e # 测试覆盖率 $ pnpm run test:cov ``` ## 部署 项目支持多种部署方式: 1. **直接部署** ```bash $ pnpm install $ pnpm run build $ pnpm run start:prod ``` 2. **Docker 部署**(待实现) ```bash # 构建镜像 $ docker build -t auto-serve . # 运行容器 $ docker run -p 3000:3000 auto-serve ``` ## 维护者 - [项目维护者信息] ## 许可证 [MIT licensed](LICENSE)