{"id":25345766,"url":"https://github.com/linmoqc/memory-turbo-api","last_synced_at":"2025-04-08T16:26:54.305Z","repository":{"id":277509649,"uuid":"932640899","full_name":"LinMoQC/memory-turbo-api","owner":"LinMoQC","description":"memory-turbo-web","archived":false,"fork":false,"pushed_at":"2025-02-14T09:24:04.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T10:23:31.667Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LinMoQC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-02-14T08:53:27.000Z","updated_at":"2025-02-14T09:24:07.000Z","dependencies_parsed_at":"2025-02-14T10:34:22.411Z","dependency_job_id":null,"html_url":"https://github.com/LinMoQC/memory-turbo-api","commit_stats":null,"previous_names":["linmoqc/memory-turbo-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinMoQC%2Fmemory-turbo-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinMoQC%2Fmemory-turbo-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinMoQC%2Fmemory-turbo-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinMoQC%2Fmemory-turbo-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinMoQC","download_url":"https://codeload.github.com/LinMoQC/memory-turbo-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247880443,"owners_count":21011658,"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":[],"created_at":"2025-02-14T12:51:52.663Z","updated_at":"2025-04-08T16:26:54.299Z","avatar_url":"https://github.com/LinMoQC.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📡 Memory API  \n\nMemory 项目的后端服务，基于 [NestJS](https://nestjs.com/) 框架，并使用 [Prisma](https://www.prisma.io/) 作为 ORM。  \n\n## 🚀 技术栈\n\n- [NestJS](https://nestjs.com/) - 基于 TypeScript 的渐进式 Node.js 框架  \n- [Prisma](https://www.prisma.io/) - 现代化的数据库 ORM  \n- [PostgreSQL](https://www.postgresql.org/) / [MySQL](https://www.mysql.com/) - 可选的数据库支持  \n- [Swagger](https://swagger.io/) - API 文档  \n- [Redis](https://redis.io/) - 缓存和 WebSocket 支持  \n- [JWT](https://jwt.io/) - 认证和授权  \n- [Socket.IO](https://socket.io/) - 实时通信库\n\n## 📌 安装 \u0026 运行  \n\n### 1️⃣ 安装依赖  \n```sh\npnpm install\n```\n### 2️⃣ 配置环境变量\n```sh\ncp .env.example .env\n```\n```sh\n# Environment variables declared in this file are automatically made available to Prisma.\n# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema\n\n# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.\n# See the documentation for all the connection string options: https://pris.ly/d/connection-strings\n\n# 数据库地址\nDATABASE_URL=\"\"\n\n# accessToken密钥\nACCESS_TOKEN_SECRET = ''\n# refreshToken密钥\nREFRESH_TOKEN_SECRET = ''\n\n# 后端启动端口\nPORT=5666\n\n# 前端后台首页\nFRONTEND_HOME_URL = 'http://localhost:3000/proxy/dashboard'\n\n# Github登录配置\nGITHUB_CLIENT_ID= ''\nGITHUB_CLIENT_SECRET= ''\nGITHUB_CALL_BACKURL= 'http://localhost:5666/api/auth/github/callback'\n\n# Redis配置\nREDIS_HOST = ''\nREDIS_PORT = ''\nREDIS_PASSWORD = ''\n```\n\n### 3️⃣ 运行数据库迁移\n```sh\npnpm prisma migrate dev --name init\n# 如果仅需同步数据库但不生成迁移文件\npnpm prisma db push\n```\n\n### 4️⃣ 启动开发环境\n```sh\npnpm run start:dev\n```\n\n## 🛠 API 文档\n```sh\nhttp://localhost:5666/api/docs\n```\n\n## 🛜 WebSocket\n``` ts\n// WebSocket 通过 Socket.io 实现，默认监听 /ws 端点\nconst socket = io(\"http://localhost:5666\");\nsocket.on(\"connect\", () =\u003e {\n    console.log(\"Connected!\");\n});\n```\n## 📧 邮件服务\n``` ts\n// 使用 Nodemailer 进行邮件发送，需在 .env 中配置 SMTP 信息\nimport * as nodemailer from 'nodemailer';\nconst transporter = nodemailer.createTransport({\n    host: process.env.MAIL_HOST,\n    auth: {\n        user: process.env.MAIL_USER,\n        pass: process.env.MAIL_PASS,\n    },\n});\n\nawait transporter.sendMail({\n    from: '\"Memory\" \u003cno-reply@memory.com\u003e',\n    to: 'user@example.com',\n    subject: '测试邮件',\n    text: 'Hello, 这是一封测试邮件！',\n});\n```\n\n## 🛠 其他常用命令\n```sh\npnpm lint                # 代码检查\npnpm test                # 运行测试\npnpm prisma studio       # Prisma 可视化数据库管理\npnpm prisma generate     # 生成 Prisma 客户端\npnpm prisma migrate dev  # 创建数据库迁移\npnpm prisma migrate deploy # 部署迁移到生产环境\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinmoqc%2Fmemory-turbo-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinmoqc%2Fmemory-turbo-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinmoqc%2Fmemory-turbo-api/lists"}