> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zgi.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture

> ZGI's five-layer architecture and technology stack

## Design concept

ZGI is not a simple stack of functions, but revolves around a core goal: **to make AI "usable, manageable, and retainable"** in the enterprise.

For this reason, we divided the entire product into four layers. Each layer corresponds to a type of real demands for enterprises to implement AI: from autonomous control of the underlying code, to unified access to models, to data governance, to upper-layer application and permission control. Each layer can be used independently or together to form a complete system.

<img src="https://mintcdn.com/zgi-b511bcb1/D78bJJDZjinheoHX/images/architecture/architecture-four-layer.png?fit=max&auto=format&n=D78bJJDZjinheoHX&q=85&s=2c1ec41f347432a3d9e318ef6fedb452" alt="ZGI Product Architecture · Four-Layer Design" width="1364" height="1153" data-path="images/architecture/architecture-four-layer.png" />

## Responsibilities of each layer

### 1. Application layer—delivering AI capabilities to front-line businesses

This level provides directly available AI applications to enterprise end users and business teams: agent orchestration, Web console, mobile APP, enterprise permission management, agent operation monitoring, Agent templates, etc.

Design focus: **Assets belong to the enterprise, authority is controllable and auditable, and department budgets are independently accounted**. These are not capabilities that are patched later, but are designed in from day one at the application layer.

### 2. Data layer - allowing enterprise knowledge to be truly "used by AI"

The data layer contains two core modules: **Knowledge Base** (processing unstructured data, such as documents, contracts, FAQs) and **Database** (processing structured data, supporting NL2SQL natural language queries).

Differentiation: Association modeling of fragmented knowledge through **Knowledge Graph** enables retrieval to no longer just focus on "text similarity", but to understand the "relationship between entities", solving the shortcomings of traditional RAG in cross-document association issues.

### 3. Model layer — a gateway that unifies all models

The model gateway unifies different model suppliers (OpenAI, Anthropic, Google, domestic model service providers, and enterprise-owned models) into the same governance system: supplier management, channel routing, connectivity testing, call billing, and API Key control.

Differentiation: **Official channels and private channels coexist**, which can not only use the platform's preset capabilities out of the box, but also access the company's own API Key, flexibly adapting to different cost and compliance requirements.

### 4. Code layer - autonomous and controllable high-performance base

The bottom layer uses **Go 1.24** + Gin framework + PostgreSQL 16, which is deeply optimized for enterprise-level high-concurrency scenarios. The front-end is based on Next.js 16 + React 19 and provides a responsive console.

Differentiation: **The core code is completely independent and copyrighted**, and is not based on secondary encapsulation of other open source projects, avoiding upstream protocol risks and underlying dependency lock-in.

## Typical deployment form

| Form                              | Suitable for scene                               | Features                                                                                                                          |
| --------------------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |
| **Cloud SaaS**                    | Quick verification, small and medium-sized teams | Sign up and use, pay according to usage, expand on demand                                                                         |
| **Docker Compose**                | Development environment, small-scale production  | One-click startup of the complete service stack, including database, cache, and vector library                                    |
| **Kubernetes**                    | Production high availability                     | Helm Chart deployment, supporting elastic scaling                                                                                 |
| **Privatized Enterprise Edition** | Finance, government affairs, medical compliance  | Data does not leave the intranet at all, supports local large models, and complies with SOC 2 / GDPR / Class III protection level |
