Skip to content

Technical Architecture

NiteMoon AI Platform adopts a modern microservices architecture design, supporting both monolith and microservices dual-mode deployment, providing a stable and scalable technical foundation for enterprise AI applications.

System Architecture Diagram

┌─────────────────────────────────────────────────────────────┐
│                      Client Layer                            │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │ Web UI   │  │ Mini App │  │ Mobile   │  │  API     │   │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘   │
└─────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────┐
│                    API Gateway                               │
│              Spring Cloud Gateway : 7770                    │
│                    Nacos Service Discovery                   │
└─────────────────────────────────────────────────────────────┘

      ┌───────────────────────┼───────────────────────┐
      │                       │                       │
      ▼                       ▼                       ▼
┌──────────┐           ┌──────────┐           ┌──────────┐
│   Auth   │           │   Biz    │           │ Monitor  │
│  Service │           │  Service │           │ Service  │
└──────────┘           └──────────┘           └──────────┘

      ┌───────────────────────┼───────────────────────┐
      │                       │                       │
      ▼                       ▼                       ▼
┌──────────┐           ┌──────────┐           ┌──────────┐
│   LLM    │           │Knowledge │           │ Digital  │
│  Service │           │  Graph   │           │  Human   │
└──────────┘           └──────────┘           └──────────┘
      │                       │                       │
      ▼                       ▼                       ▼
┌──────────┐           ┌──────────┐           ┌──────────┐
│ Training │           │   RAG    │           │   AI     │
│  Service │           │  Service │           │  Excel   │
└──────────┘           └──────────┘           └──────────┘


┌─────────────────────────────────────────────────────────────┐
│                      Data Layer                              │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │  MySQL   │  │  Redis   │  │  Neo4j   │  │  Milvus  │   │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘   │
└─────────────────────────────────────────────────────────────┘

Tech Stack Details

Core Framework

LayerTechnologyVersionDescription
LanguageJava17LTS version
FrameworkSpring Boot3.4.7Microservices framework
CloudSpring Cloud2024.0.0Cloud-native support
Cloud AlibabaSpring Cloud Alibaba2023.0.3.2Alibaba ecosystem
RPCApache Dubbo3.2.14High-performance RPC

AI / LLM

TechnologyVersionDescription
LangChain4j1.0.0-beta1LLM application framework
HanLPlatestChinese NLP
Apache Tika2.9.1Document parsing
ONNX RuntimelatestModel inference
OpenCVlatestImage processing

Data Storage

TechnologyVersionDescription
MySQL9.2.0Relational database
Neo4j5.27.0Graph database
Redis6.0+Cache and vector store
MilvuslatestVector database
MinIOlatestObject storage

Middleware

TechnologyVersionDescription
RocketMQ5.2.0Message queue
Sa-Token1.44.0Authentication & authorization
MyBatis-Plus3.5.12ORM framework
Redisson3.38.1Redis client
SentinellatestFlow control

Utility Libraries

TechnologyVersionDescription
Hutool5.8.33Java utility library
Fastjson22.0.57JSON processing
OkHttp4.12.0HTTP client
Knife4j4.6.0API documentation

Deployment Modes

Monolith Mode (boot profile)

Suitable for development, testing, and small-scale deployment scenarios.

Architecture Characteristics:

  • Single JVM deployment
  • Local method invocation
  • No infrastructure dependencies like Nacos
  • Simple and fast

Deployment Requirements:

  • Java 17+
  • MySQL 8.0+
  • Redis 6.0+
  • Memory: 4GB+

Startup Command:

bash
java -jar nitemoon-boot.jar --spring.profiles.active=boot

Microservices Mode (cloud profile)

Suitable for production environments and large-scale deployment scenarios.

Architecture Characteristics:

  • Multi-service independent deployment
  • Dubbo RPC communication
  • Nacos service discovery and configuration
  • Sentinel flow control
  • Seata distributed transactions

Deployment Requirements:

  • Java 17+
  • MySQL 8.0+
  • Redis 6.0+
  • Neo4j 5.0+
  • Nacos 2.0+
  • RocketMQ 5.0+
  • Memory: 8GB+ (per service)

Service List:

ServicePortDescription
gateway7770API Gateway
auth7771Authentication Service
llm-LLM Service
onnx-ONNX Inference Service
upms-User Permission Service

Module Dependencies

nitemoon-cloud (root)
├── nitemoon-gateway          # API Gateway
├── nitemoon-auth             # Authentication Service
├── nitemoon-common           # Common Modules
│   ├── common-core           # Core Utilities
│   ├── common-security       # Security Module
│   ├── common-mybatis        # ORM Module
│   ├── common-redis          # Cache Module
│   ├── common-sse            # SSE Module
│   ├── common-storage        # Storage Module
│   └── ...                   # Other Common Modules
├── nitemoon-api              # Service Interfaces
│   ├── nitemoon-llm-api      # LLM Interface
│   ├── nitemoon-kg-api       # Knowledge Graph Interface
│   ├── nitemoon-human-api    # Digital Human Interface
│   └── ...                   # Other Interfaces
├── nitemoon-biz              # Business Modules
│   ├── nitemoon-llm          # LLM Service
│   ├── nitemoon-kg           # Knowledge Graph Service
│   ├── nitemoon-human        # Digital Human Service
│   ├── nitemoon-training     # Training Service
│   ├── nitemoon-onnx         # Inference Service
│   ├── nitemoon-aiexcel      # AI Excel Service
│   ├── nitemoon-generator    # Code Generator
│   ├── nitemoon-monitor      # Monitor Service
│   └── nitemoon-upms         # User Permission Service
└── nitemoon-boot             # Monolith Startup Module

Design Patterns

Strategy Pattern

Used for abstraction of LLM providers, TTS providers, storage backends, and similar scenarios.

java
public interface ModelBuildHandler {
    ChatModel buildChatModel(LLMModelConfig config);
    EmbeddingModel buildEmbeddingModel(LLMModelConfig config);
}

Factory Pattern

Used for creating model instances, storage instances, and more.

java
@Component
public class ModelStoreFactory {
    public ChatModel createChatModel(String provider, String modelName) {
        ModelBuildHandler handler = getHandler(provider);
        return handler.buildChatModel(loadConfig(modelName));
    }
}

Observer Pattern

Used for event-driven cache refresh, configuration updates, and more.

java
@Component
public class ProviderRefreshListener implements ApplicationListener<ProviderRefreshEvent> {
    @Override
    public void onApplicationEvent(ProviderRefreshEvent event) {
        // Refresh provider cache
    }
}

Performance Optimization

Caching Strategy

  • Redis cache for hot data
  • Local cache for frequently accessed data
  • Multi-level cache architecture

Async Processing

  • RocketMQ asynchronous messaging
  • CompletableFuture async invocation
  • Thread pool isolation

Connection Pooling

  • HikariCP database connection pool
  • Redisson connection pool
  • OkHttp connection pool

Copyright © 2023-2026 nitemoon.cn All Rights Reserved