{"id":26543775,"url":"https://github.com/chasefunny/svg-backend","last_synced_at":"2025-03-22T03:15:20.126Z","repository":{"id":283680738,"uuid":"947602560","full_name":"chaseFunny/svg-backend","owner":"chaseFunny","description":"基于当下最强大模型的在线 SVG 生成后端服务，使用 nest.js + fastify + PostgreSQL","archived":false,"fork":false,"pushed_at":"2025-03-21T13:53:56.000Z","size":135,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T15:02:15.024Z","etag":null,"topics":["ai","claude-ai","fastify","nestjs","postgresql"],"latest_commit_sha":null,"homepage":"https://svgshow.cn/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chaseFunny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-13T00:28:16.000Z","updated_at":"2025-03-21T14:42:39.000Z","dependencies_parsed_at":"2025-03-21T15:05:49.917Z","dependency_job_id":"0e30488f-e260-46bd-a613-ebc357ceb71b","html_url":"https://github.com/chaseFunny/svg-backend","commit_stats":null,"previous_names":["chasefunny/svg-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaseFunny%2Fsvg-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaseFunny%2Fsvg-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaseFunny%2Fsvg-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaseFunny%2Fsvg-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chaseFunny","download_url":"https://codeload.github.com/chaseFunny/svg-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244898458,"owners_count":20528341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","claude-ai","fastify","nestjs","postgresql"],"created_at":"2025-03-22T03:15:17.532Z","updated_at":"2025-03-22T03:15:20.120Z","avatar_url":"https://github.com/chaseFunny.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NestJS 10 API 项目模板\n\n使用此模板快速搭建您的下一个 [NestJS 10](https://nestjs.com/) API 项目\n\n- 专为 Docker 环境打造（支持 Dockerfile 和环境变量）\n- 支持 [Prisma](https://www.prisma.io/) 的 REST API\n- Swagger 文档、[Joi](https://github.com/hapijs/joi) 验证、Winston 日志记录等\n- 文件夹结构、代码示例和最佳实践\n- 使用 [Fastify](https://fastify.dev/) 的快速 HTTP 服务器\n\n## 1. 入门指南\n\n### 1.1 要求\n\n在开始之前，请确保您的工作站上至少安装了以下组件：\n\n- 最新版本的 [NodeJS](https://nodejs.org/)，例如 20.x 和 NPM\n- 数据库，例如 PostgreSQL。您可以使用提供的 `docker-compose.yml` 文件。\n\n[Docker](https://www.docker.com/) 对于高级测试和镜像构建也可能有用，尽管它不是开发所必需的。\n\n### 1.2 项目配置\n\n首先在您的工作站上克隆此项目，或在 Github 上点击 [\"使用此模板\"](https://github.com/new?template_name=nestjs-template\u0026template_owner=Saluki)。\n\n```sh\ngit clone https://github.com/saluki/nestjs-template my-project\n```\n\n接下来是安装项目的所有依赖项。\n\n```sh\ncd ./my-project\nnpm install\n```\n\n安装完依赖项后，您现在可以通过创建一个新的 `.env` 文件来配置您的项目，该文件包含用于开发的环境变量。\n\n```sh\ncp .env.example .env\nvi .env\n```\n\n对于标准的开发配置，您可以保留 `Api configuration` 部分下的 `API_PORT`、`API_PREFIX` 和 `API_CORS` 的默认值。`SWAGGER_ENABLE` 规则允许您控制 NestJS 的 Swagger 文档模块。在开始此示例时，请将其保留为 `1`。\n\n接下来是 Prisma 配置：根据您自己的数据库设置更改 `DATABASE_URL`。\n\n最后但同样重要的是，定义一个 `JWT_SECRET` 来签署 JWT 令牌，或在开发环境中保留默认值。将 `JWT_ISSUER` 更新为 JWT 中设置的正确值。\n\n### 1.3 启动和探索\n\n您现在可以使用以下命令启动 NestJS 应用程序。\n\n```sh\n# 仅在开发环境中使用，执行 Prisma 迁移\nnpx prisma migrate dev\n\n# 使用 TSNode 启动开发服务器\nnpm run dev\n```\n\n您现在可以访问 `http://localhost:3000/docs` 查看您的 API Swagger 文档。示例乘客 API 位于 `http://localhost:3000/api/v1/passengers` 端点。\n\n对于受限路由，您可以使用以下 JWT 进行测试\n\n```\neyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJERUZBVUxUX0lTU1VFUiIsImlhdCI6MTYzMTEwNDMzNCwicm9sZSI6InJlc3RyaWN0ZWQifQ.o2HcQBBpx-EJMcUFiqmAiD_jZ5J92gRDOyhybT9FakE\n```\n\n\u003e 上面的示例 JWT 没有过期时间，请记住在生产环境中使用有效的 JWT 并强制执行所需的声明\n\n## 2. 项目结构\n\n此模板采用明确定义的目录结构。\n\n```sh\nsrc/\n├── modules\n│   ├── app.module.ts\n│   ├── common/  # 公共模块包含在整个应用程序中使用的管道、守卫、服务和提供者\n│   ├── passenger/  # 管理“乘客”资源的模块示例\n│   │   ├── controller/\n│   │   │   └── passenger.controller.ts\n│   │   ├── flow/  # “flow”目录包含管道、拦截器以及可能更改请求或响应流的所有内容\n│   │   │   └── passenger.pipe.ts\n│   │   ├── model/\n│   │   │   ├── passenger.data.ts  # 将在响应中返回的模型\n│   │   │   └── passenger.input.ts  # 在请求中使用的模型\n│   │   ├── passenger.module.ts\n│   │   ├── service/\n│   │   │   └── passenger.service.ts\n│   │   └── spec/\n│   └── tokens.ts\n└── server.ts\n```\n\n## 3. 默认 NPM 命令\n\n以下 NPM 命令已包含在此模板中，可用于快速运行、构建和测试您的项目。\n\n```sh\n# 使用转译后的 NodeJS 启动应用程序\nnpm run start\n\n# 使用 \"ts-node\" 运行应用程序\nnpm run dev\n\n# 转译 TypeScript 文件\nnpm run build\n\n# 运行项目的功能测试\nnpm run test\n\n# 使用 TSLint 对项目文件进行 lint 检查\nnpm run lint\n```\n\n## 5. 健康检查支持\n\n健康检查 API 是一个 REST 端点，可用于验证服务及其依赖项的状态。健康检查 API 端点内部触发服务的整体健康检查。这可以包括数据库连接检查、系统属性、磁盘可用性和内存可用性。\n\n可以使用 `HEALTH_TOKEN` 环境变量中的令牌请求示例健康检查端点。\n\n```sh\ncurl -H 'Authorization: Bearer ThisMustBeChanged' http://localhost:3000/api/v1/health\n```\n\n## 6. 项目目标\n\n该项目的目标是提供一个干净且最新的“入门包”，用于使用 NestJS 构建的 REST API 项目。\n\n## 7. 贡献\n\n欢迎提出改进建议、报告错误或提出问题：[https://github.com/saluki/nestjs-template/issues](https://github.com/saluki/nestjs-template/issues)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchasefunny%2Fsvg-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchasefunny%2Fsvg-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchasefunny%2Fsvg-backend/lists"}