{"id":21418970,"url":"https://github.com/hal-wang/todo","last_synced_at":"2025-09-11T21:34:17.135Z","repository":{"id":126964417,"uuid":"358460768","full_name":"hal-wang/todo","owner":"hal-wang","description":"一个简易的 todo 项目，包含后端和前端，无需服务器，一键搭建","archived":false,"fork":false,"pushed_at":"2023-07-30T07:46:06.000Z","size":700,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T06:13:21.435Z","etag":null,"topics":["cloudbase","halsp","serverless"],"latest_commit_sha":null,"homepage":"https://env-caafniqh-1253337886.ap-shanghai.app.tcloudbase.com/todo","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/hal-wang.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":"2021-04-16T03:10:36.000Z","updated_at":"2023-07-07T19:31:05.000Z","dependencies_parsed_at":"2024-11-23T01:00:26.618Z","dependency_job_id":null,"html_url":"https://github.com/hal-wang/todo","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-wang%2Ftodo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-wang%2Ftodo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-wang%2Ftodo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-wang%2Ftodo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hal-wang","download_url":"https://codeload.github.com/hal-wang/todo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918878,"owners_count":20368786,"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":["cloudbase","halsp","serverless"],"created_at":"2024-11-22T19:31:23.893Z","updated_at":"2025-03-16T19:27:29.233Z","avatar_url":"https://github.com/hal-wang.png","language":"TypeScript","readme":"# todo\n\n一个简易的 todo 项目，包含后端和前端\n\n线上示例：\u003chttps://env-caafniqh-1253337886.ap-shanghai.app.tcloudbase.com/todo\u003e\n\n一键部署：\n[![](https://main.qcloudimg.com/raw/67f5a389f1ac6f3b4d04c7256438e44f.svg)](https://console.cloud.tencent.com/tcb/env/index?action=CreateAndDeployCloudBaseProject\u0026appUrl=https%3A%2F%2Fgithub.com%2Fhal-wang%2Ftodo\u0026branch=main)\n\n## 解决 CloudBase Framework Node.JS 版本过低问题\n\n截至目前， `CloudBase Framework` 最高仅支持 `Node.JS 12.16`，很多依赖已经无法正常使用了\n\n这将导致部署的云函数启动失败\n\n为了解决这个问题，你需要或先创建同名云函数再部署，创建云函数时选择 nodejs 版本为 `16.13` （目前最高的支持）\n\n或一键部署后删除 `todo` 云函数，然后再重建一个同名函数，然后再次部署。\n\n## 介绍\n\n使用了数据库两个文档：`todo-user`, `todo-todo`。\n\n测试账号：\n\n- email: `test@hal.wang`\n- password: `123456`\n\n前端：vue3 + pinia + ant-design\n\n后端：[halsp](https://halsp.org)\n\n全部使用 ts 开发\n\n### 权限认证\n\n使用 JWT 进行了基本的权限认证\n\n前端使用 localStorage 进行 Token 管理和验证\n\n后端写了以下几种权限\n\n- 管理员: 用 @Admin 装饰的 Action\n- 开放: 用 @Open 装饰的 Action\n- 普通用户：默认，需要登录状态\n\n## 二次开发\n\n如果现有功能不能满足，你可以进行二次开发\n\n### API\n\n在 `todo-api` 下创建文件 `.env.local`，内容如下\n\n```\nSCF_NAMESPACE=cloudbase环境id\nSECRET_KEY=腾讯云 secret key\nSECRET_ID=腾讯云 secret id\nJWT_SECRET=JWT 密钥\n```\n\n#### 运行 API\n\n先安装依赖，在 `todo-api` 下执行\n\n```bash\nyarn install\n```\n\n再使用 vscode 打开 `todo-api`，直接 F5 开始调试\n\n或在 `todo-api` 目录下执行\n\n```bash\nyarn dev\n```\n\n### Web\n\n先安装依赖，在 `todo-web` 下执行\n\n```bash\nyarn install\n```\n\n再执行下面命令运行\n\n```bash\nyarn dev\n```\n\n或使用已发布的接口，需要修改 `todo-web/.env.stage` 文件中的 `VUE_APP_BASE_API`\n\n然后运行\n\n```bash\nyarn dev:stage\n```\n\n### 发布\n\n可以本地使用 `@cloudbase/cli` 发布，也可以使用 GitHub Actions 持续集成\n\n#### cli 发布\n\n在项目根目录下创建 `.env.local` （注意是项目根目录，不是 API 或 Web 下）\n\n内容如下\n\n```\nENV_ID=cloudbase环境id\nJWT_SECRET=JWT 密钥\n```\n\n在项目根目录下运行以下命令发布\n\n```bash\nyarn deploy\n```\n\n#### GitHub Actions\n\n仓库增加 Secrets，在 `Settings -\u003e Secrets -\u003e Actions`，点击 `New repository secret` 按钮\n\n- TENCENT_SECRET_ID: 腾讯云 secret id\n- TENCENT_SECRET_KEY: 腾讯云 secret key\n- ENV: 与 `cli 发布` 的 `.env.local` 文件内容相同\n\n配置完成后，每次 main 分支提交代码就会自动发布到 CloudBase\n\n发布进度可在仓库 `Actions` 中看到\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhal-wang%2Ftodo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhal-wang%2Ftodo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhal-wang%2Ftodo/lists"}