Skip to content

3. Architecture

qihai edited this page Jul 25, 2025 · 2 revisions

Coze loop adopts a microservices architecture, built based on the principles of Domain-Driven Design (DDD), and provides a one-stop platform for AI app development and operations. The overall architecture is as follows: Image The structure can be divided into three parts:

  • Platform: The platform provides a complete solution for AI apps, including services for various modules and foundational components deployment.
  • SDK: The currently provided SDK can seamlessly integrate with open-source platforms by modifying its initialization parameters.
  • LLM: Mainstream large models can be used through corresponding model calls after configuring the token.

Code structure

backend/
├── api/         # API interface definition and implementation
│   ├── handler/ # API handling
│   └── router/  # API routing
├── cmd/         # Application entry and service startup
├── modules/     # Core business modules
│   ├── data/         # Data set module
│   │    │── application/ # Application service layer
│   │    │── domain/      # Domain model layer
│   │    │── infra/       # Infrastructure layer
│   │    └── pkg/         # Public utility layer
│   ├── evaluation/   # Evaluation module
│   ├── foundation/   # Infrastructure module
│   ├── llm/          # LLM module
│   ├── observability/# Observability module
│   └── prompt/       # PE module
├── infra/      # Infrastructure layer
│   ├── db/     # Database
│   ├── mq/     # Message queue
│   ├── redis/  # Redis client
│   └── ck/     # ClickHouse client
└── pkg/        # General utility package and library

The current backend services consist of six business modules, with the responsibilities of each module as follows:

  • data: Dataset module: Responsible for the creation and management of datasets.
  • evaluation: Evaluation module: Responsible for conducting evaluation experiments on objects like prompts.
  • Observability: Observation module: Responsible for visualizing full-link request tracking
  • Prompt: Prompt module: Responsible for prompt development/debugging
  • LLM: LLM management module: Responsible for managing/calling large models
  • Foundation: Infrastructure module: Responsible for basic features like user/permission management

Each business module follows the hierarchical architecture below:

  • Application: Application service layer, coordinates domain objects to complete business processes
  • Domain: Domain model layer, defines core business entities and business logic
  • Infra: Infrastructure layer, provides technical implementations and external service integrations
  • Pkg: Module-specific common packages

Basic components

  • Backend framework:
    • Hertz (Cloudwego high-performance HTTP framework)
    • Kitex (Cloudwego high-performance RPC framework)
  • Data storage:
    • MySQL: Structured data storage
    • ClickHouse: High-performance analytical data storage
    • Redis: Cache and temporary data
    • MinIO: Object storage
    • RocketMQ: Message queue
  • Containerization: Docker and Docker Compose
Clone this wiki locally