simlock
A control plane so parallel coding agents stop fighting over the same simulator.
NestJS CRUD for RESTful API 使用 NestJS + Mysql + Typeorm + Redis + JWT + Swagger 企业中后台管理系统项目RBAC权限管理(细粒度到按钮)、实现单点登录等...
Translation pending
Developer toolsTypeScript · PLpgSQLGitHub @buqiyuanSelf-installOwner unconfirmed
Paste into Claude or ChatGPT for installation instructions suited to your environment.
Have you tried it? One tap is enough. No sign-in needed.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Installable projects can be verified without a deployment domain. Use GitHub sign-in for a personal repository, or the repository verification file above for an organization repository.
Ask about other verification options
The maker's introduction consists of the line above. Read the repository README for more details. Repository README ↗
Loading the full README.
Read the full README ↗基于 NestJs + TypeScript + TypeORM + Redis + MySql + Vue3 + Ant Design Vue 编写的一款简单高效的前后端分离的权限管理系统。希望这个项目在全栈的路上能够帮助到你。
当前公开演示:
前端配合上面的接口使用。演示环境账号见下方表格。
.env.development 与 .env.production 已加入 .gitignore,不会再随仓库分发密钥。首次启动前复制模板并填写密钥:
cp .env.development.example .env.development
cp .env.production.example .env.production
openssl rand -base64 48 # JWT_SECRET
openssl rand -base64 48 # REFRESH_TOKEN_SECRET
JWT_SECRET 和 REFRESH_TOKEN_SECRET 必须各自设置为至少 32 位的随机字符串。缺失、为空、短于 32 位,或仍使用已知占位值时,进程会拒绝启动。已经部署过的环境在升级后必须轮换这两个密钥,并重新拉取或构建镜像;旧的登录令牌会因此失效。仓库历史里出现过的 SMTP 授权码也应在邮件服务商处作废。
接口权限使用数据库里的当前角色,不信任 JWT 中的 roles。未写入 user_access_tokens 的令牌会被拒绝。仍保存在该表中的已签发令牌,在过期、退出登录或密钥轮换之前继续有效。
nodejs 20+docker 20.x+ ,其中 docker compose版本需要 2.17.0+mysql 8.x+pnpm 包管理器安装项目依赖演示环境账号密码:
| 账号 | 密码 | 权限 |
|---|---|---|
| admin | a123456 | 超级管理员 |
所有新建的用户初始密码都为 a123456
本地部署账号密码:
| 账号 | 密码 | 权限 |
|---|---|---|
| admin | a123456 | 超级管理员 |
先按上一节复制 .env.production 并写入足够长的 JWT_SECRET / REFRESH_TOKEN_SECRET。未配置密钥时服务会启动失败。
启动成功后,通过 http://localhost:7001/api-docs/ 访问。
只构建后端镜像时,在仓库根目录执行。PROJECT_DIR 默认为 /nest-admin,不需要额外的 build-arg。要改安装路径时再加上 --build-arg PROJECT_DIR=/your-path。docker compose 构建时仍从 .env 读取 PROJECT_DIR。
docker build -t web-api .
镜像启动时会等待 DB_HOST(默认 mysql)的 ${DB_PORT:-3306},再执行迁移并交给 pm2-runtime。生产镜像不包含 devDependency cross-env,因此迁移直接调用 typeorm CLI,而不是 pnpm migration:run。JWT_SECRET 和 REFRESH_TOKEN_SECRET 需要在运行时注入,不要写进镜像。
pnpm docker:up
# or
docker compose --env-file .env --env-file .env.production up -d --no-build
停止并删除所有容器
pnpm docker:down
# or
docker compose --env-file .env --env-file .env.production down
删除镜像
pnpm docker:rmi
# or
docker rmi buqiyuan/nest-admin-server:stable
查看实时日志输出
pnpm docker:logs
# or
docker compose --env-file .env --env-file .env.production logs -f
git clone https://github.com/buqiyuan/nest-admin
mysql/redis,你可以使用 Docker 启动指定服务供本地开发时使用, 例如(需先复制并填写 .env.development):# 启动MySql服务
docker compose --env-file .env --env-file .env.development run -d --service-ports mysql
# 启动Redis服务
docker compose --env-file .env --env-file .env.development run -d --service-ports redis
cd nest-admin
pnpm install
pnpm dev
pnpm build
pnpm migration:run
pnpm migration:generate
pnpm migration:revert
更多细节,请移步至官方文档
[!TIP] 如果你的
实体类或数据库配置有更新,请执行npm run build后再进行数据库迁移相关操作。
如果项目有帮助到你可以点个 Star 支持下。有更好的实现欢迎 PR。