代码拉取完成,页面将自动刷新
# PowerShell 脚本编码设置
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# 创建目录的函数
function Create-Directories {
param (
[string]$baseDir,
[string[]]$paths
)
foreach ($path in $paths) {
$fullPath = Join-Path $baseDir $path
Write-Host "Creating directory: $fullPath"
New-Item -ItemType Directory -Path $fullPath -Force | Out-Null
}
}
# 创建文件的函数
function Create-Files {
param (
[string]$baseDir,
[hashtable]$files
)
foreach ($file in $files.GetEnumerator()) {
$fullPath = Join-Path $baseDir $file.Key
Write-Host "Creating file: $fullPath"
$file.Value | Set-Content -Path $fullPath -Force -Encoding UTF8
}
}
# 定义后端目录结构
$backendDirectories = @{
# JVM 平台
"spring-boot" = @(
# Java
"backend/jvm/spring-boot/java/maven/standard/src/main/java/controller",
"backend/jvm/spring-boot/java/maven/standard/src/main/java/service/impl",
"backend/jvm/spring-boot/java/maven/standard/src/main/java/repository/jpa",
"backend/jvm/spring-boot/java/maven/standard/src/main/java/domain/entity",
"backend/jvm/spring-boot/java/maven/standard/src/main/java/domain/vo",
"backend/jvm/spring-boot/java/maven/standard/src/main/java/config",
"backend/jvm/spring-boot/java/maven/standard/src/main/resources/db/migration",
"backend/jvm/spring-boot/java/maven/standard/src/test/java",
"backend/jvm/spring-boot/java/maven/reactive/src/main/java/handler",
"backend/jvm/spring-boot/java/maven/reactive/src/main/java/router",
"backend/jvm/spring-boot/java/maven/reactive/src/main/java/service/impl",
"backend/jvm/spring-boot/java/maven/reactive/src/main/java/repository/r2dbc",
"backend/jvm/spring-boot/java/maven/reactive/src/main/java/domain/entity",
"backend/jvm/spring-boot/java/maven/reactive/src/main/java/config",
"backend/jvm/spring-boot/java/maven/reactive/src/test/java",
# Kotlin
"backend/jvm/spring-boot/kotlin/gradle/standard/src/main/kotlin/controller",
"backend/jvm/spring-boot/kotlin/gradle/standard/src/main/kotlin/service/impl",
"backend/jvm/spring-boot/kotlin/gradle/standard/src/main/kotlin/repository/jpa",
"backend/jvm/spring-boot/kotlin/gradle/standard/src/main/kotlin/domain/entity",
"backend/jvm/spring-boot/kotlin/gradle/standard/src/test/kotlin",
"backend/jvm/spring-boot/kotlin/gradle/reactive/src/main/kotlin/handler",
"backend/jvm/spring-boot/kotlin/gradle/reactive/src/main/kotlin/service/impl",
"backend/jvm/spring-boot/kotlin/gradle/reactive/src/main/kotlin/repository/r2dbc",
"backend/jvm/spring-boot/kotlin/gradle/reactive/src/main/kotlin/domain/entity",
"backend/jvm/spring-boot/kotlin/gradle/reactive/src/test/kotlin"
)
"quarkus" = @(
# Java
"backend/jvm/quarkus/java/maven/standard/src/main/java/resource",
"backend/jvm/quarkus/java/maven/standard/src/main/java/service/impl",
"backend/jvm/quarkus/java/maven/standard/src/main/java/repository/panache",
"backend/jvm/quarkus/java/maven/standard/src/main/java/domain/entity",
"backend/jvm/quarkus/java/maven/standard/src/test/java",
"backend/jvm/quarkus/java/maven/reactive/src/main/java/resource",
"backend/jvm/quarkus/java/maven/reactive/src/main/java/service/impl",
"backend/jvm/quarkus/java/maven/reactive/src/main/java/repository/panache",
"backend/jvm/quarkus/java/maven/reactive/src/main/java/domain/entity",
"backend/jvm/quarkus/java/maven/reactive/src/test/java"
)
"micronaut" = @(
# Java
"backend/jvm/micronaut/java/maven/standard/src/main/java/controller",
"backend/jvm/micronaut/java/maven/standard/src/main/java/service/impl",
"backend/jvm/micronaut/java/maven/standard/src/main/java/repository/jpa",
"backend/jvm/micronaut/java/maven/standard/src/main/java/domain/entity",
"backend/jvm/micronaut/java/maven/standard/src/test/java",
"backend/jvm/micronaut/java/maven/reactive/src/main/java/controller",
"backend/jvm/micronaut/java/maven/reactive/src/main/java/service/impl",
"backend/jvm/micronaut/java/maven/reactive/src/main/java/repository/r2dbc",
"backend/jvm/micronaut/java/maven/reactive/src/main/java/domain/entity",
"backend/jvm/micronaut/java/maven/reactive/src/test/java"
)
}
# 定义前端目录结构
$frontendDirectories = @{
"react" = @(
"frontend/web/react/typescript/src/components/common",
"frontend/web/react/typescript/src/components/layout",
"frontend/web/react/typescript/src/pages",
"frontend/web/react/typescript/src/hooks",
"frontend/web/react/typescript/src/stores",
"frontend/web/react/typescript/src/services",
"frontend/web/react/typescript/src/utils",
"frontend/web/react/typescript/src/types",
"frontend/web/react/typescript/public"
)
"vue" = @(
"frontend/web/vue/typescript/src/components/common",
"frontend/web/vue/typescript/src/components/layout",
"frontend/web/vue/typescript/src/views",
"frontend/web/vue/typescript/src/composables",
"frontend/web/vue/typescript/src/stores",
"frontend/web/vue/typescript/src/services",
"frontend/web/vue/typescript/src/utils",
"frontend/web/vue/typescript/src/types",
"frontend/web/vue/typescript/public"
)
}
# 定义数据库目录结构
$databaseDirectories = @{
"sql" = @(
"database/sql/mysql/migrations",
"database/sql/mysql/schemas",
"database/sql/mysql/seeds",
"database/sql/postgresql/migrations",
"database/sql/postgresql/schemas",
"database/sql/postgresql/seeds"
)
"nosql" = @(
"database/nosql/mongodb/schemas",
"database/nosql/mongodb/indexes",
"database/nosql/redis/config",
"database/nosql/redis/scripts"
)
}
# 定义配置文件
$configFiles = @{
# Spring Boot Java Maven Standard
"backend/jvm/spring-boot/java/maven/standard/pom.xml" = @"
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>spring-boot-java-standard</artifactId>
<version>1.0.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.0</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
"@
# Spring Boot Java Maven Reactive
"backend/jvm/spring-boot/java/maven/reactive/pom.xml" = @"
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>spring-boot-java-reactive</artifactId>
<version>1.0.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.0</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
"@
# Spring Boot Kotlin Gradle Standard
"backend/jvm/spring-boot/kotlin/gradle/standard/build.gradle.kts" = @"
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "3.2.0"
id("io.spring.dependency-management") version "1.1.4"
kotlin("jvm") version "1.9.20"
kotlin("plugin.spring") version "1.9.20"
kotlin("plugin.jpa") version "1.9.20"
}
group = "com.example"
version = "1.0.0"
java.sourceCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.flywaydb:flyway-core")
runtimeOnly("org.postgresql:postgresql")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
jvmTarget = "17"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
"@
# Spring Boot Kotlin Gradle Reactive
"backend/jvm/spring-boot/kotlin/gradle/reactive/build.gradle.kts" = @"
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "3.2.0"
id("io.spring.dependency-management") version "1.1.4"
kotlin("jvm") version "1.9.20"
kotlin("plugin.spring") version "1.9.20"
}
group = "com.example"
version = "1.0.0"
java.sourceCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-data-r2dbc")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("org.flywaydb:flyway-core")
runtimeOnly("org.postgresql:r2dbc-postgresql")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.springframework.security:spring-security-test")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
jvmTarget = "17"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
"@
# React TypeScript
"frontend/web/react/typescript/package.json" = @"
{
"name": "react-typescript-app",
"version": "1.0.0",
"private": true,
"dependencies": {
"@tanstack/react-query": "^5.12.2",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@types/jest": "^29.5.10",
"@types/node": "^20.10.3",
"@types/react": "^18.2.41",
"@types/react-dom": "^18.2.17",
"axios": "^1.6.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.20.1",
"typescript": "^5.3.2",
"web-vitals": "^3.5.0",
"zustand": "^4.4.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
"@
# Vue TypeScript
"frontend/web/vue/typescript/package.json" = @"
{
"name": "vue-typescript-app",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
"test:unit": "vitest",
"test:e2e": "playwright test",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
"@tanstack/vue-query": "^5.12.2",
"axios": "^1.6.2",
"pinia": "^2.1.7",
"vue": "^3.3.9",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@playwright/test": "^1.40.1",
"@rushstack/eslint-patch": "^1.6.0",
"@tsconfig/node18": "^18.2.2",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.10.3",
"@vitejs/plugin-vue": "^4.5.1",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/test-utils": "^2.4.3",
"@vue/tsconfig": "^0.4.0",
"eslint": "^8.55.0",
"eslint-plugin-vue": "^9.19.2",
"jsdom": "^23.0.1",
"typescript": "^5.3.2",
"vite": "^5.0.5",
"vitest": "^1.0.1",
"vue-tsc": "^1.8.25"
}
}
"@
# 项目说明
"README.md" = @"
# 微服务系统设计
## 项目说明
多语言、多框架的微服务系统设计示例,包含标准版本和响应式版本。
## 技术栈
### 后端
- JVM
- Spring Boot (Java, Kotlin, Groovy, Scala)
- Quarkus (Java, Kotlin)
- Micronaut (Java, Kotlin)
- Ktor (Kotlin)
- Vertx (Java, Kotlin)
- Play Framework (Java, Scala)
- Grails (Groovy)
- Node.js
- Express (JavaScript, TypeScript)
- NestJS (TypeScript)
- Fastify (TypeScript)
- Koa (JavaScript, TypeScript)
- Hapi (TypeScript)
- AdonisJS (TypeScript)
- Python
- FastAPI
- Django
- Flask
- Tornado
- aiohttp
- Go
- Gin
- Echo
- Fiber
- Beego
- Chi
- Rust
- Actix-web
- Rocket
- Axum
### 前端
- Web
- React (JavaScript, TypeScript)
- Vue (JavaScript, TypeScript)
- Angular (TypeScript)
- Svelte (TypeScript)
- Solid (TypeScript)
- Qwik (TypeScript)
- 桌面
- Electron (React, Vue)
- Tauri (React, Vue, Svelte)
- Qt (C++, Python)
- 移动
- Flutter
- React Native
- Ionic (Angular, React, Vue)
- Kotlin Multiplatform
- Xamarin
### 数据库
- SQL
- MySQL
- PostgreSQL
- Oracle
- SQL Server
- SQLite
- NoSQL
- MongoDB
- Redis
- Elasticsearch
- Cassandra
- Neo4j
### 中间件
- 消息队列
- Kafka
- RabbitMQ
- Redis PubSub
- ActiveMQ
- ZeroMQ
- 服务网格
- Istio
- Linkerd
- Consul
- API网关
- Kong
- Traefik
- Nginx
### 监控和日志
- Prometheus + Grafana
- ELK Stack
- Jaeger
- Zipkin
### 配置中心
- Consul
- Nacos
- Apollo
- etcd
## 开发指南
请参考 docs/development 目录下的文档
"@
# 环境配置
".env.example" = @"
# 应用配置
APP_NAME=windsurf
APP_ENV=development
APP_DEBUG=true
APP_PORT=8080
APP_URL=http://localhost:8080
APP_SECRET=your-secret-key
# 数据库配置
DB_CONNECTION=postgresql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=windsurf
DB_USERNAME=postgres
DB_PASSWORD=postgres
# Redis配置
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=null
# JWT配置
JWT_SECRET=your-jwt-secret
JWT_TTL=86400
JWT_REFRESH_TTL=604800
# 邮件配置
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
# 缓存配置
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
# 监控配置
PROMETHEUS_ENABLED=true
JAEGER_ENABLED=true
JAEGER_AGENT_HOST=localhost
JAEGER_AGENT_PORT=6831
# 云服务配置
AWS_ACCESS_KEY_ID=your-key
AWS_SECRET_ACCESS_KEY=your-secret
AWS_DEFAULT_REGION=us-west-2
AWS_BUCKET=your-bucket
# CDN配置
CDN_ENABLED=false
CDN_URL=https://cdn.example.com
# API配置
API_STANDARDS_TREE=vnd
API_SUBTYPE=windsurf
API_PREFIX=api
API_VERSION=v1
API_DEBUG=true
"@
# Git忽略文件
".gitignore" = @"
# IDE
.idea/
.vscode/
*.iml
*.iws
*.ipr
.project
.classpath
.settings/
# 依赖
node_modules/
vendor/
target/
build/
dist/
.gradle/
__pycache__/
*.egg-info/
venv/
.env
.env.*
!.env.example
# 编译输出
*.class
*.jar
*.war
*.ear
*.dll
*.exe
*.o
*.so
*.dylib
*.pyc
*.pyo
*.pyd
# 日志
*.log
logs/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# 测试
coverage/
.nyc_output/
.pytest_cache/
htmlcov/
# 系统
.DS_Store
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
# 临时文件
*.swp
*.swo
*.tmp
*.bak
*.cache
.temp/
.tmp/
# 包管理
package-lock.json
yarn.lock
composer.lock
poetry.lock
# 其他
*.pid
*.seed
*.pid.lock
.env.*.local
"@
}
# 执行创建操作
$currentDir = Get-Location
Write-Host "Creating directory structure..."
foreach ($framework in $backendDirectories.Keys) {
Create-Directories -baseDir $currentDir -paths $backendDirectories[$framework]
}
foreach ($framework in $frontendDirectories.Keys) {
Create-Directories -baseDir $currentDir -paths $frontendDirectories[$framework]
}
foreach ($dbType in $databaseDirectories.Keys) {
Create-Directories -baseDir $currentDir -paths $databaseDirectories[$dbType]
}
Write-Host "`nCreating configuration files..."
Create-Files -baseDir $currentDir -files $configFiles
Write-Host "`nProject structure created successfully!"
Write-Host "Please check the README.md file for project information and setup instructions."
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。