{"id":13498618,"url":"https://github.com/serverless-plus/serverless-admin-system","last_synced_at":"2025-03-29T01:32:13.215Z","repository":{"id":66317511,"uuid":"292024548","full_name":"serverless-plus/serverless-admin-system","owner":"serverless-plus","description":"Serverless Admin System","archived":false,"fork":false,"pushed_at":"2021-01-02T03:20:04.000Z","size":221,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-31T16:37:34.352Z","etag":null,"topics":["admin-system","eggjs","postgresql","redis","serverless","serverless-components","serverless-framework","vuejs"],"latest_commit_sha":null,"homepage":"https://sls-admin.yugasun.com/","language":"JavaScript","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/serverless-plus.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}},"created_at":"2020-09-01T14:44:13.000Z","updated_at":"2022-05-27T07:12:08.000Z","dependencies_parsed_at":"2024-01-18T23:05:00.106Z","dependency_job_id":"552f303a-d489-40b1-ad62-71b4ec63f799","html_url":"https://github.com/serverless-plus/serverless-admin-system","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-plus%2Fserverless-admin-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-plus%2Fserverless-admin-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-plus%2Fserverless-admin-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-plus%2Fserverless-admin-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serverless-plus","download_url":"https://codeload.github.com/serverless-plus/serverless-admin-system/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246125982,"owners_count":20727504,"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":["admin-system","eggjs","postgresql","redis","serverless","serverless-components","serverless-framework","vuejs"],"created_at":"2024-07-31T21:00:38.238Z","updated_at":"2025-03-29T01:32:12.895Z","avatar_url":"https://github.com/serverless-plus.png","language":"JavaScript","readme":"# Serverless Admin System\n\n[在线体验](https://sls-admin.yugasun.com/)\n\n使用 [Serverless Components](https://github.com/serverless/components) 开发的后台管理系统\n\n1. [安装 CLI](#安装-CLI)\n2. [初始化项目](#初始化项目)\n3. [配置](#配置)\n4. [部署](#部署)\n5. [开发](#开发)\n\n### 安装 CLI\n\n在开始之前需要先安装 [Serverless CLI](https://github.com/serverless/serverless) 工具\n\n```bash\n$ npm i serverless -g\n```\n\n### 初始化项目\n\nServerless 命令行工具非常方便，可以直接初始化项目模板：\n\n```bash\n$ serverless init admin-system\n```\n\n安装项目依赖：\n\n```bash\n$ npm run bootstrap\n```\n\n### 项目目录介绍\n\n```\n├── backend         后端服务，Egg.js + PostgreSQL + Redis\n├── db              Serverless PG，使用 tencent-postgresql 组件部署创建\n├── frontend        前端页面，Vue.js + vue-admin-template，项目模板：https://github.com/PanJiaChen/vue-admin-template\n├── package.json\n├── scripts         项目脚本，主要含有 bootstrap.js 用来自动安装前后端项目依赖\n└── vpc             Serverless VPC，使用 tencent-vpc 组件部署，用来创建腾讯云私有网络\n```\n\n### 配置\n\n复制项目根目录的 `.env.example` 文件为 `.env`，内容如下：\n\n```dotenv\n# .env\nTENCENT_SECRET_ID=xxx\nTENCENT_SECRET_KEY=xxx\n\nREGION=ap-guangzhou\nZONE=ap-guangzhou-2\n```\n\n\u003e 注意：`TENCENT_SECRET_ID` 和 `TENCENT_SECRET_KEY` 可以到 [腾讯云 CAM 控制台](https://bash.cloud.tencent.com/cam/capi) 获取。\n\n由于后端服务使用 `redis` 来存储接口鉴权 Token，所以我们还需要给后端项目配置 redis 建连参数，复制 `backend` 目录的 `.env.example` 为 `.env`，然后配置自己的 redis 服务参数：\n\n```dotenv\nREDIS_HOST=xxx\nREDIS_PORT=xxx\nREDIS_PASSWORD=xxx\n```\n\n此项目也支持 [Authing](https://authing.cn/) 第三方登录，如果你不需要可以直接忽略，如果需要，可以到 [Authing 控制台](https://console.authing.cn/login) 获取配置，然后添加到 `backend/.env` 中：\n\n```dotenv\nREDIS_HOST=xxx\nREDIS_PORT=xxx\nREDIS_PASSWORD=xxx\n\n# authing 应用配置\nAUTHING_APPID=xxx\nAUTHING_APPSECRET=xxx\n```\n\n### 本地开发\n\n后端服务使用的的数据库均使用本地 [Docker](https://www.docker.com/) 来启动，所以本地开发时，需要先启动 docker 服务：\n\n```bash\n$ npm run docker:up\n```\n\n#### 启动后端服务\n\n```bash\n$ npm run dev:be\n```\n\n#### 启动前端开发\n\n```bash\n$ npm run dev:fe\n```\n\n### 部署\n\n在部署业务代码之前，我们需要先将后端的 `node_modules` 文件夹部署为层：\n\n```bash\n$ npm run deploy:be:layer\n```\n\n\u003e 注意：在层部署成功后，如果后端项目的 `node_modules` 没有修改，可以不用再次执行层部署。\n\n部署项目代码：\n\n```bash\n$ npm run deploy\n```\n\n### 初始化数据库\n\n部署成功后，我们就可以获得数据库相关参数，其中 postgresql 输出的 `public` 对象中的参数是用来公网访问的。\n\n在访问服务前，我们还需要同步数据库表结构，修改 `database/config.js` 中的 `production` 对象的配置为 postgresql 输出的 `public` 对象中的参数值，\n\n相关参数对应关系：\n\n| `postgresql.public` 输出 | `database/config.js` 中 `production` 参数 |\n| :----------------------: | :---------------------------------------: |\n|           host           |                   host                    |\n|           port           |                   post                    |\n|           user           |                 username                  |\n|         password         |                 password                  |\n|          dbname          |                 database                  |\n\n然后我们执行：\n\n```bash\n$ npm run db:migrate\n```\n\n就可以自动帮助初始化数据库，包括表结构和测试数据。\n\n### License\n\nMIT License\n\nCopyright (c) 2020 Serverless Plus\n","funding_links":[],"categories":["开发模板"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless-plus%2Fserverless-admin-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserverless-plus%2Fserverless-admin-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless-plus%2Fserverless-admin-system/lists"}