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
| Layer | Technology | Version | Description |
|---|---|---|---|
| Language | Java | 17 | LTS version |
| Framework | Spring Boot | 3.4.7 | Microservices framework |
| Cloud | Spring Cloud | 2024.0.0 | Cloud-native support |
| Cloud Alibaba | Spring Cloud Alibaba | 2023.0.3.2 | Alibaba ecosystem |
| RPC | Apache Dubbo | 3.2.14 | High-performance RPC |
AI / LLM
| Technology | Version | Description |
|---|---|---|
| LangChain4j | 1.0.0-beta1 | LLM application framework |
| HanLP | latest | Chinese NLP |
| Apache Tika | 2.9.1 | Document parsing |
| ONNX Runtime | latest | Model inference |
| OpenCV | latest | Image processing |
Data Storage
| Technology | Version | Description |
|---|---|---|
| MySQL | 9.2.0 | Relational database |
| Neo4j | 5.27.0 | Graph database |
| Redis | 6.0+ | Cache and vector store |
| Milvus | latest | Vector database |
| MinIO | latest | Object storage |
Middleware
| Technology | Version | Description |
|---|---|---|
| RocketMQ | 5.2.0 | Message queue |
| Sa-Token | 1.44.0 | Authentication & authorization |
| MyBatis-Plus | 3.5.12 | ORM framework |
| Redisson | 3.38.1 | Redis client |
| Sentinel | latest | Flow control |
Utility Libraries
| Technology | Version | Description |
|---|---|---|
| Hutool | 5.8.33 | Java utility library |
| Fastjson2 | 2.0.57 | JSON processing |
| OkHttp | 4.12.0 | HTTP client |
| Knife4j | 4.6.0 | API 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=bootMicroservices 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:
| Service | Port | Description |
|---|---|---|
| gateway | 7770 | API Gateway |
| auth | 7771 | Authentication 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 ModuleDesign 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