feat: initialize Gradle multi-module backend and Vite frontend
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
*/node_modules/
|
||||
*/.idea/
|
||||
|
||||
# Frontend build / runtime output
|
||||
frontend/dist/
|
||||
frontend/dist-ssr/
|
||||
|
||||
# Tauri native artifacts (app)
|
||||
frontend/packages/app/src-tauri/target/
|
||||
|
||||
# Local env files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
Generated
+1
@@ -0,0 +1 @@
|
||||
im-system-backend
|
||||
Generated
+20
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ClaudeCodeTabState">
|
||||
<option name="tabSessions">
|
||||
<map>
|
||||
<entry key="0">
|
||||
<value>
|
||||
<TabSessionState>
|
||||
<option name="provider" value="claude" />
|
||||
<option name="sessionId" value="af370657-b741-43c2-989d-2b6d24979a01" />
|
||||
<option name="cwd" value="C:\Users\msksbr\IdeaProjects\im-system" />
|
||||
<option name="model" value="claude-sonnet-5[1m]" />
|
||||
<option name="permissionMode" value="default" />
|
||||
</TabSessionState>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+19
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="21" />
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="im-system-backend.gateway" options="-parameters" />
|
||||
<module name="im-system-backend.gateway.main" options="-parameters" />
|
||||
<module name="im-system-backend.gateway.test" options="-parameters" />
|
||||
<module name="im-system-backend.im-service" options="-parameters" />
|
||||
<module name="im-system-backend.im-service.main" options="-parameters" />
|
||||
<module name="im-system-backend.im-service.test" options="-parameters" />
|
||||
<module name="im-system-backend.log-service" options="-parameters" />
|
||||
<module name="im-system-backend.log-service.main" options="-parameters" />
|
||||
<module name="im-system-backend.log-service.test" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+20
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/backend" />
|
||||
<option name="gradleJvm" value="#JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/backend" />
|
||||
<option value="$PROJECT_DIR$/backend/gateway" />
|
||||
<option value="$PROJECT_DIR$/backend/im-service" />
|
||||
<option value="$PROJECT_DIR$/backend/log-service" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="externalSystemId" value="Gradle" />
|
||||
<option name="version" value="2.4.10" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$/backend" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="liberica-full-21" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+184
@@ -0,0 +1,184 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e6d31489-464a-4590-aa96-6d15ebe73076" name="更改" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/.name" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/claudeCodeTabState.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/gradle.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/kotlinc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/CONTRIBUTING.md" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/DEVELOPMENT.md" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/.gitignore" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/build.gradle.kts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/gateway/build.gradle.kts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/gateway/src/main/kotlin/com/im/gateway/GatewayApplication.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/gateway/src/main/resources/application.yml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/gradle/libs.versions.toml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/gradle/wrapper/gradle-wrapper.jar" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/gradle/wrapper/gradle-wrapper.properties" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/gradlew" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/gradlew.bat" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/im-service/build.gradle.kts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/im-service/src/main/kotlin/com/im/imservice/ImServiceApplication.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/im-service/src/main/resources/application.yml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/log-service/build.gradle.kts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/log-service/src/main/kotlin/com/im/logservice/LogServiceApplication.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/log-service/src/main/resources/application.yml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/backend/settings.gradle.kts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/.gitignore" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/package.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/admin/index.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/admin/package.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/admin/src/App.vue" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/admin/src/main.ts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/admin/src/vite-env.d.ts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/admin/tsconfig.app.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/admin/tsconfig.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/admin/tsconfig.node.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/admin/vite.config.ts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/app/index.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/app/package.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/app/src/App.vue" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/app/src/main.ts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/app/src/vite-env.d.ts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/app/tsconfig.app.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/app/tsconfig.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/app/tsconfig.node.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/packages/app/vite.config.ts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/pnpm-lock.yaml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/frontend/pnpm-workspace.yaml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ExternalProjectsData">
|
||||
<projectState path="$PROJECT_DIR$/backend">
|
||||
<ProjectState />
|
||||
</projectState>
|
||||
</component>
|
||||
<component name="ExternalProjectsManager">
|
||||
<system id="GRADLE">
|
||||
<state>
|
||||
<task path="$PROJECT_DIR$/backend">
|
||||
<activation />
|
||||
</task>
|
||||
<projects_view>
|
||||
<tree_state>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
|
||||
<item name="im-system-backend" type="f1a62948:ProjectNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
|
||||
<item name="im-system-backend" type="f1a62948:ProjectNode" />
|
||||
<item name="gateway" type="2d1252cf:ModuleNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
|
||||
<item name="im-system-backend" type="f1a62948:ProjectNode" />
|
||||
<item name="gateway" type="2d1252cf:ModuleNode" />
|
||||
<item name="Tasks" type="e4a08cd1:TasksNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
|
||||
<item name="im-system-backend" type="f1a62948:ProjectNode" />
|
||||
<item name="gateway" type="2d1252cf:ModuleNode" />
|
||||
<item name="Tasks" type="e4a08cd1:TasksNode" />
|
||||
<item name="application" type="c8890929:TasksNode$1" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</tree_state>
|
||||
</projects_view>
|
||||
</state>
|
||||
</system>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Kotlin Script" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 6,
|
||||
"fromUser": false
|
||||
}</component>
|
||||
<component name="ProjectId" id="3HUP9gfpf25hhJj8AmooeNmmmPK" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Gradle.backend [:gateway:bootRun].executor": "Run",
|
||||
"Gradle.backend [:gateway:build].executor": "Run",
|
||||
"Gradle.backend [bootJar].executor": "Run",
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
||||
"codeWithMe.voiceChat.enabledByDefault": "false",
|
||||
"git-widget-placeholder": "main",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.jshint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.jshint": "",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"project.structure.last.edited": "项目",
|
||||
"project.structure.proportion": "0.15",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"run.configurations.included.in.services": "true",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunDashboard">
|
||||
<option name="configurationTypes">
|
||||
<set>
|
||||
<option value="KtorApplicationConfigurationType" />
|
||||
<option value="MicronautRunConfigurationType" />
|
||||
<option value="QuarkusRunConfigurationType" />
|
||||
<option value="SpringBootApplicationConfigurationType" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
<option value="bundled-jdk-30f59d01ecdd-63390994e64e-intellij.indexing.shared.core-IU-262.8665.337" />
|
||||
<option value="bundled-js-predefined-d6986cc7102b-4abd2a77f808-JavaScript-IU-262.8665.337" />
|
||||
</set>
|
||||
</attachedChunks>
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="默认任务">
|
||||
<changelist id="e6d31489-464a-4590-aa96-6d15ebe73076" name="更改" comment="" />
|
||||
<created>1766457182447</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1766457182447</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,50 @@
|
||||
# 贡献指南
|
||||
|
||||
欢迎为 im-system 贡献代码。请遵循以下约定,让协作更顺畅。
|
||||
|
||||
## 分支命名
|
||||
|
||||
- `main`:稳定分支,只接受已 review 的合并。
|
||||
- 功能分支:`feat/描述`、`fix/描述`、`refactor/描述`(例:`feat/login-flow`、`fix/kafka-reconnect`)。
|
||||
|
||||
## 提交信息
|
||||
|
||||
使用 [Conventional Commits](https://www.conventionalcommits.org/zh-hans/):
|
||||
|
||||
```
|
||||
<type>(<scope>): <subject>
|
||||
```
|
||||
|
||||
- `type`:`feat` / `fix` / `docs` / `style` / `refactor` / `perf` / `test` / `build` / `chore`
|
||||
- `scope`(可选):`backend`、`gateway`、`im-service`、`log-service`、`frontend`、`admin`、`app`
|
||||
|
||||
示例:
|
||||
|
||||
```
|
||||
feat(im-service): 发送心跳日志到 Kafka
|
||||
|
||||
fix(gateway): 修正 /api/im 路由谓词
|
||||
```
|
||||
|
||||
## 代码风格
|
||||
|
||||
- **后端(Kotlin)**:遵循 [Kotlin 官方风格](https://kotlinlang.org/docs/coding-conventions.html);类名大驼峰、函数/变量小驼峰;Spring Bean 用构造注入;公开 API 写简短 KDoc。
|
||||
- **前端(Vue 3 + TS)**:`<script setup lang="ts">`;组件/文件用 PascalCase 命名,目录 kebab-case;类型尽量显式,禁用 `any`;样式用 scoped。
|
||||
- 提交前保证 `pnpm type-check` 与 `./gradlew build` 通过。
|
||||
|
||||
## 测试
|
||||
|
||||
- 后端:`./gradlew test`
|
||||
- 前端:`pnpm -r test`(当前骨架未含测试框架,补充后生效)
|
||||
|
||||
## 提交流程
|
||||
|
||||
1. 从 `main` 拉取最新并切功能分支。
|
||||
2. 小步提交,信息符合规范。
|
||||
3. 本地跑通构建与相关测试。
|
||||
4. 发起 Pull Request 到 `main`,描述改动动机与验证方式。
|
||||
5. Review 通过后由维护者合入。
|
||||
|
||||
## 环境准备
|
||||
|
||||
见 [DEVELOPMENT.md](DEVELOPMENT.md)。
|
||||
@@ -0,0 +1,79 @@
|
||||
# 开发指南
|
||||
|
||||
本文档说明如何在本地搭建并运行 im-system。
|
||||
|
||||
## 环境要求
|
||||
|
||||
- **JDK 21**(后端 toolchain 锁定;需本机安装,或由 Gradle 自动下载)
|
||||
- **Gradle 9.6+**(仅首次生成 wrapper 需要)
|
||||
- **Node.js 20.19+**
|
||||
- **pnpm 11+**
|
||||
- **Kafka**(可选,见下文)
|
||||
|
||||
## 后端
|
||||
|
||||
### 首次初始化
|
||||
|
||||
仓库不含 Gradle wrapper,首次需用本机 Gradle 生成(生成后应 commit 进仓库):
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
gradle wrapper --gradle-version 9.6.1
|
||||
```
|
||||
|
||||
之后一律使用 `./gradlew`,不再依赖本机 Gradle。
|
||||
|
||||
### 启动三个服务
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
./gradlew :gateway:bootRun # 网关,http://localhost:8080
|
||||
./gradlew :im-service:bootRun # 主服务,http://localhost:8081
|
||||
./gradlew :log-service:bootRun # 日志服务,http://localhost:8082
|
||||
```
|
||||
|
||||
- 三个服务需分终端启动(或加 `&` 后台运行)。
|
||||
- 依赖 Kafka 的功能(im-service 发日志 → log-service 消费)需先启动 Kafka;只跑网关转发可暂不起 Kafka。
|
||||
|
||||
## 前端
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
pnpm install
|
||||
```
|
||||
|
||||
### 启动
|
||||
|
||||
```bash
|
||||
pnpm --filter @im-system/admin dev # 管理后台,http://localhost:5173
|
||||
pnpm --filter @im-system/app dev # 聊天 App,http://localhost:1420
|
||||
```
|
||||
|
||||
### 构建与检查
|
||||
|
||||
```bash
|
||||
pnpm -r build # 全量构建
|
||||
pnpm type-check # 全量类型检查
|
||||
```
|
||||
|
||||
## 服务通信
|
||||
|
||||
- **Gateway** 统一入口与路由:`/api/im/**` → im-service,`/api/log/**` → log-service。
|
||||
- **im-service** 通过 Kafka 向 topic `im-logs` 发送日志消息。
|
||||
- **log-service** 监听同一 topic(consumer group `log-service`)消费并落库。
|
||||
- 前端 dev 阶段:admin 的 `/api` 代理到 `localhost:8080`(gateway);app 直连后端地址。
|
||||
|
||||
## 配置项
|
||||
|
||||
| 项目 | 位置 | 默认值 |
|
||||
| --- | --- | --- |
|
||||
| Kafka 地址 | 各服务 `application.yml` 的 `KAFKA_BOOTSTRAP_SERVERS` | `localhost:9092` |
|
||||
| 后端端口 | 各 `application.yml` 的 `server.port` | 8080 / 8081 / 8082 |
|
||||
| 前端端口 | 各 `vite.config.ts` 的 `server.port` | 5173 / 1420 |
|
||||
| gateway 路由 | `gateway/src/main/resources/application.yml` 的 `spring.cloud.gateway.routes` | `/api/im/**`、`/api/log/**` |
|
||||
|
||||
## 常见问题
|
||||
|
||||
- **Gradle `Unresolved reference`**:每个子项目脚本需独立声明 `plugins {}`,根脚本只集中钉版本(`apply false`)。避免在根 `subprojects {}` 里用 `apply(plugin=...)` + 静态访问器(`implementation`、`kotlin` 等),否则脚本编译期无法解析。
|
||||
- **Kafka 连接失败**:确认 Kafka 已启动,`bootstrap-servers` 正确(默认 `localhost:9092`)。
|
||||
- **端口占用**:8080/8081/8082、5173、1420。改端口见上表。
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 msksbr
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,63 @@
|
||||
# im-system
|
||||
|
||||
即时通讯(IM)系统,monorepo 结构,前后端分离。
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
im-system/
|
||||
├── backend/ # 后端(Kotlin + Spring Boot,Gradle 多模块)
|
||||
│ ├── gateway/ # 网关(Spring Cloud Gateway,端口 8080)
|
||||
│ ├── im-service/ # 主服务(IM 业务,端口 8081,Kafka 生产者)
|
||||
│ └── log-service/ # 日志服务(端口 8082,Kafka 消费者)
|
||||
└── frontend/ # 前端(Vue 3 + TypeScript + Vite,pnpm workspace)
|
||||
└── packages/
|
||||
├── admin/ # 管理后台(Element Plus,端口 5173)
|
||||
└── app/ # 聊天 App(端口 1420,预留 Tauri 迁移)
|
||||
```
|
||||
|
||||
## 技术栈
|
||||
|
||||
| 层 | 技术 | 版本 |
|
||||
| --- | --- | --- |
|
||||
| 后端语言 | Kotlin | 2.4.10 |
|
||||
| 后端框架 | Spring Boot | 4.1.0 |
|
||||
| 网关 | Spring Cloud Gateway | 2025.1.2(Oakwood) |
|
||||
| 消息队列 | Kafka | 由 `KAFKA_BOOTSTRAP_SERVERS` 指定 |
|
||||
| 构建 | Gradle | 9.6.1 |
|
||||
| 前端框架 | Vue 3 + TypeScript | 3.5 / 7.0 |
|
||||
| 前端构建 | Vite | 8.2.0 |
|
||||
| 包管理 | pnpm | 11.20.0 |
|
||||
|
||||
## 服务通信
|
||||
|
||||
```
|
||||
浏览器 ── /api/* ──> gateway(8080) ── /api/im/** → im-service(8081)
|
||||
└────── /api/log/** → log-service(8082)
|
||||
|
||||
im-service ──Kafka topic `im-logs`──> log-service
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
|
||||
```bash
|
||||
# 后端
|
||||
cd backend
|
||||
gradle wrapper --gradle-version 9.6.1 # 仅首次需要
|
||||
./gradlew :gateway:bootRun # 三个服务分终端启动
|
||||
|
||||
# 前端
|
||||
cd frontend
|
||||
pnpm install
|
||||
pnpm --filter @im-system/admin dev # http://localhost:5173
|
||||
pnpm --filter @im-system/app dev # http://localhost:1420
|
||||
```
|
||||
|
||||
## 文档
|
||||
|
||||
- [DEVELOPMENT.md](DEVELOPMENT.md) — 开发指南(环境、启动、配置、常见问题)
|
||||
- [CONTRIBUTING.md](CONTRIBUTING.md) — 贡献指南(分支、提交、PR 规范)
|
||||
|
||||
## 许可
|
||||
|
||||
[MIT](LICENSE) © 2026 msksbr
|
||||
@@ -0,0 +1,16 @@
|
||||
# Gradle
|
||||
.gradle/
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
*.iml
|
||||
.vscode/
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
@@ -0,0 +1,11 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.4.10" apply false
|
||||
kotlin("plugin.spring") version "2.4.10" apply false
|
||||
id("org.springframework.boot") version "4.1.0" apply false
|
||||
id("io.spring.dependency-management") version "1.1.7" apply false
|
||||
}
|
||||
|
||||
subprojects {
|
||||
group = "com.msksbr.imSystem"
|
||||
version = "0.1.0-SNAPSHOT"
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.4.10"
|
||||
kotlin("plugin.spring") version "2.4.10"
|
||||
id("org.springframework.boot") version "4.1.0"
|
||||
id("io.spring.dependency-management") version "1.1.7"
|
||||
}
|
||||
|
||||
group = "com.msksbr.imSystem"
|
||||
version = "0.1.0-SNAPSHOT"
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform("org.springframework.cloud:spring-cloud-dependencies:2025.1.2"))
|
||||
implementation("org.springframework.cloud:spring-cloud-starter-gateway-server-webflux")
|
||||
|
||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.addAll("-Xjsr305=strict", "-Xannotation-default-target=param-property")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.im.gateway
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.runApplication
|
||||
|
||||
@SpringBootApplication
|
||||
class GatewayApplication
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
runApplication<GatewayApplication>(*args)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: gateway
|
||||
|
||||
cloud:
|
||||
gateway:
|
||||
routes:
|
||||
- id: im-service
|
||||
uri: lb://im-service
|
||||
predicates:
|
||||
- Path=/api/im/**
|
||||
- id: log-service
|
||||
uri: lb://log-service
|
||||
predicates:
|
||||
- Path=/api/log/**
|
||||
@@ -0,0 +1,17 @@
|
||||
[versions]
|
||||
kotlin = "2.4.10"
|
||||
springBoot = "4.1.0"
|
||||
springCloud = "2025.1.2"
|
||||
|
||||
[libraries]
|
||||
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web" }
|
||||
spring-boot-starter-cloud-gateway = { module = "org.springframework.cloud:spring-cloud-starter-gateway-server-webflux" }
|
||||
spring-boot-starter-webflux = { module = "org.springframework.boot:spring-boot-starter-webflux" }
|
||||
spring-boot-starter-data-jpa = { module = "org.springframework.boot:spring-boot-starter-data-jpa" }
|
||||
spring-boot-starter-kafka = { module = "org.springframework.boot:spring-boot-starter-kafka" }
|
||||
|
||||
[plugins]
|
||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
|
||||
spring-boot = { id = "org.springframework.boot", version.ref = "springBoot" }
|
||||
dependency-management = { id = "io.spring.dependency-management", version = "1.1.7" }
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
Vendored
+248
@@ -0,0 +1,248 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh gradlew
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+82
@@ -0,0 +1,82 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem gradlew startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
@@ -0,0 +1,40 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.4.10"
|
||||
kotlin("plugin.spring") version "2.4.10"
|
||||
id("org.springframework.boot") version "4.1.0"
|
||||
id("io.spring.dependency-management") version "1.1.7"
|
||||
}
|
||||
|
||||
group = "com.msksbr.imSystem"
|
||||
version = "0.1.0-SNAPSHOT"
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||
implementation("org.springframework.boot:spring-boot-starter-kafka")
|
||||
|
||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.addAll("-Xjsr305=strict", "-Xannotation-default-target=param-property")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.im.imservice
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.runApplication
|
||||
|
||||
@SpringBootApplication
|
||||
class ImServiceApplication
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
runApplication<ImServiceApplication>(*args)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
server:
|
||||
port: 8081
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: im-service
|
||||
|
||||
kafka:
|
||||
bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS:localhost:9092}
|
||||
producer:
|
||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
value-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
|
||||
im:
|
||||
kafka:
|
||||
log-topic: im-logs
|
||||
@@ -0,0 +1,40 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.4.10"
|
||||
kotlin("plugin.spring") version "2.4.10"
|
||||
id("org.springframework.boot") version "4.1.0"
|
||||
id("io.spring.dependency-management") version "1.1.7"
|
||||
}
|
||||
|
||||
group = "com.msksbr.imSystem"
|
||||
version = "0.1.0-SNAPSHOT"
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||
implementation("org.springframework.boot:spring-boot-starter-kafka")
|
||||
|
||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.addAll("-Xjsr305=strict", "-Xannotation-default-target=param-property")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.im.logservice
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.runApplication
|
||||
|
||||
@SpringBootApplication
|
||||
class LogServiceApplication
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
runApplication<LogServiceApplication>(*args)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
server:
|
||||
port: 8082
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: log-service
|
||||
|
||||
kafka:
|
||||
bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS:localhost:9092}
|
||||
consumer:
|
||||
group-id: log-service
|
||||
auto-offset-reset: earliest
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
|
||||
im:
|
||||
kafka:
|
||||
log-topic: im-logs
|
||||
@@ -0,0 +1,16 @@
|
||||
rootProject.name = "im-system-backend"
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
include("gateway", "im-service", "log-service")
|
||||
@@ -0,0 +1,27 @@
|
||||
# Dependencies
|
||||
node_modules/
|
||||
.pnpm-store/
|
||||
|
||||
# Build output
|
||||
dist/
|
||||
dist-ssr/
|
||||
|
||||
# Tauri (app)
|
||||
src-tauri/target/
|
||||
|
||||
# Local env files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# Logs
|
||||
logs/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
pnpm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor / OS
|
||||
.DS_Store
|
||||
*.local
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "im-system-frontend",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"packageManager": "pnpm@11.20.0",
|
||||
"engines": {
|
||||
"node": ">=20.19.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "pnpm -r --filter './packages/*' build",
|
||||
"type-check": "pnpm -r --filter './packages/*' type-check"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>IM 管理后台</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "@im-system/admin",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc -b && vite build",
|
||||
"preview": "vite preview",
|
||||
"type-check": "vue-tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vitejs/plugin-vue": "^6.0.8",
|
||||
"element-plus": "^2.14.3",
|
||||
"pinia": "^4.0.2",
|
||||
"vue": "^3.5.41",
|
||||
"vue-router": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^7.0.2",
|
||||
"vite": "^8.2.0",
|
||||
"vue-tsc": "^3.3.9"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
const now = new Date().toLocaleString()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-container class="layout">
|
||||
<el-header class="header">
|
||||
<span>IM 管理后台</span>
|
||||
</el-header>
|
||||
<el-main class="main">
|
||||
<el-card>
|
||||
<template #header>当前时间</template>
|
||||
<p>{{ now }}</p>
|
||||
</el-card>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.layout {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid var(--el-border-color);
|
||||
}
|
||||
|
||||
.main {
|
||||
background: var(--el-fill-color-lighter);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,11 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import App from './App.vue'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(createPinia())
|
||||
app.use(ElementPlus)
|
||||
app.mount('#app')
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<Record<string, never>, Record<string, never>, unknown>
|
||||
export default component
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "preserve",
|
||||
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true,
|
||||
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080',
|
||||
changeOrigin: true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>IM 聊天</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "@im-system/app",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc -b && vite build",
|
||||
"preview": "vite preview",
|
||||
"type-check": "vue-tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vitejs/plugin-vue": "^6.0.8",
|
||||
"pinia": "^4.0.2",
|
||||
"vue": "^3.5.41",
|
||||
"vue-router": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^7.0.2",
|
||||
"vite": "^8.2.0",
|
||||
"vue-tsc": "^3.3.9"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<script setup lang="ts">
|
||||
const online = ref(true)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="shell">
|
||||
<header class="topbar">
|
||||
<span class="status-dot" :class="{ offline: !online }" />
|
||||
<h1>IM 聊天</h1>
|
||||
</header>
|
||||
<section class="content">
|
||||
<p>前端骨架就绪(Vue 3 + TypeScript + Vite),可无缝迁移至 Tauri。</p>
|
||||
</section>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.shell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: #22c55e;
|
||||
}
|
||||
|
||||
.status-dot.offline {
|
||||
background: #9ca3af;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 16px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,8 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import App from './App.vue'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(createPinia())
|
||||
app.mount('#app')
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<Record<string, never>, Record<string, never>, unknown>
|
||||
export default component
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "preserve",
|
||||
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true,
|
||||
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// 同时用于浏览器与 Tauri(Tauri 会在 dev/build 时注入 TAURI_ENV_* 环境变量)
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
// Tauri 期望静态资源走相对路径,且必须设置固定端口供其内嵌 WebView 使用
|
||||
clearScreen: false,
|
||||
server: {
|
||||
port: 1420,
|
||||
strictPort: true,
|
||||
watch: {
|
||||
ignored: ['**/src-tauri/**']
|
||||
}
|
||||
},
|
||||
envPrefix: ['VITE_', 'TAURI_ENV_']
|
||||
})
|
||||
Generated
+1494
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
packages:
|
||||
- packages/*
|
||||
Reference in New Issue
Block a user