How higress-group/himarket works
1. Repository shape
- This is a monorepo with a Java backend and two React/TypeScript frontends, plus a separate sandbox runtime and deployment automation.
- The backend is split into himarket-bootstrap (application entrypoint), himarket-server (HTTP/API and business logic), and himarket-dal (entities, repositories, converters, domain support types).
2. Primary runtime architecture
- himarket-bootstrap is the Spring Boot executable. It wires security, MVC, WebSocket, Swagger, async execution, Flyway migration, and request filtering.
- himarket-server contains the core service layer and controllers. himarket-dal owns persistence models and JPA repositories. This gives a clean boundary between transport/business logic and database access.
3. Backend domain boundary
- The backend is organized around productized AI capabilities: models, MCP servers, agents/skills, portals, consumers, developers, gateways, Nacos instances, sandbox instances, and chat/coding sessions.
- DTOs are separated from entities, and many configuration objects are stored as typed JSON/value objects with converters in himarket-dal.
4. API and request flow
- Both frontends call the backend over REST.
- The developer portal also uses WebSocket and SSE-style flows for chat/coding experiences, especially in HiCoding and live session screens.
- Response wrapping, exception handling, and auth are centralized in backend core/advice, core/security, and custom annotations like admin/developer/public access markers.
5. Admin portal
- himarket-web/himarket-admin is the operator-facing console.
- It manages products, categories, gateways, portals, MCP creation, sandbox deployment, observability, and platform settings.
- It is a Vite-built React app with typed API clients and UI components tailored to platform administration.
6. Developer portal
- himarket-web/himarket-frontend is the user-facing AI marketplace and experience center.
- It supports login/registration, browsing APIs/models/MCPs/skills, subscriptions, profile management, HiChat, and HiCoding.
- This frontend is multilingual and heavily stateful, with hooks/context for auth, coding sessions, portal config, WebSocket sessions, and UI state.
7. HiChat subsystem
- The backend service/hichat area manages model selection, tool invocation, chat formatting, and LLM adapters.
- It includes model-specific services for OpenAI and DashScope, plus tool and chatbot managers.
- The frontend chat UI consumes this to present conversation history, attachments, MCP tool calls, and multi-model comparison.
8. HiCoding and sandbox subsystem
- HiCoding is a distinct subsystem spanning backend services, WebSocket handlers, runtime/session orchestration, and a separate sandbox process.
- The backend coordinates sandbox acquisition, initialization, skill download, filesystem readiness, terminal access, and remote runtime adapters.
- The sandbox/sidecar-server is a Node.js service exposing exec, file, session, and terminal WebSocket endpoints; it is the isolated execution boundary for code editing and command execution.
9. Gateway / MCP / product orchestration
- The backend contains dedicated operators and clients for different gateway types: Higress, APIG, Apsara, and related AI gateway variants.
- MCP support is first-class: server metadata, endpoints, tool config parsing, transport resolution, sandbox deploy/undeploy orchestration, and config sync helpers are all explicit backend services.
- Products are the abstraction layer that packages these capabilities for publication, subscription, and versioned release.
10. Infrastructure integration
- MySQL is the main persistent store, with Flyway migrations defining schema evolution.
- Nacos is used for configuration/distribution and appears in both deployment scripts and backend services.
- Higress / AI Gateway is a foundational external dependency for exposing AI resources.
- The platform also integrates with observability and log services, including SLS-related controllers/services.
- External LLM providers such as OpenAI and DashScope are accessed through backend adapters rather than directly from the UI.
11. Deployment model
- The repo supports local execution, Docker Compose, Helm/Kubernetes, Podman, and Alibaba Cloud ComputeNest packaging.
- Deployment templates include the backend, both frontends, MySQL, sandbox components, and support services.
- Post-start hooks initialize admin accounts, AI model settings, portal developer accounts, and Nacos synchronization, which suggests the platform expects bootstrapping after infrastructure comes up.
12. How to draw the architecture
- Put the backend service in the center, with arrows to MySQL, Nacos, Higress/AI Gateway, SLS/observability, LLM providers, and the sandbox runtime.
- Put the admin portal and developer portal as separate clients hitting the backend.
- Show the sandbox as an isolated execution environment connected back to the backend through HTTP/WebSocket and session orchestration.
- Model products as the packaging layer that sits above models, MCP servers, skills, and agents, because that is the core business abstraction of the platform.
Main entry points: alibaba/himarket Server · ProductService.java Products · alibaba/himarket DAL · server.js Sandbox Sidecar
Components 17
Backend
Spring Boot entrypoint, API/service layer, and persistence boundary
- Bootstrap · Application wiring for security, MVC, WebSocket, Flyway, and filters
himarket-bootstrap/src/main/java/com/alibaba/himarket/HiMarketApplication.java - Server · Controllers, service layer, auth, advice, and domain orchestration
himarket-server/src/main/java/com/alibaba/himarket - DAL · Entities, repositories, converters, and typed value objects
himarket-dal/src/main/java/com/alibaba/himarket - Products · Product publication, subscriptions, refs, and category composition
himarket-server/src/main/java/com/alibaba/himarket/service/ProductService.java - MCP Orchestration · Server metadata, transport resolution, config sync, and sandbox deploy orchestration
himarket-server/src/main/java/com/alibaba/himarket/service/mcp - Gateway Ops · Operators and clients for Higress, APIG, Apsara, and AI gateway variants
himarket-server/src/main/java/com/alibaba/himarket/service/gateway - HiChat · Model selection, tool invocation, chat formatting, and LLM adapters
himarket-server/src/main/java/com/alibaba/himarket/service/hichat - HiCoding · Session orchestration, WebSocket routing, remote workspace, terminal, and sandbox control
himarket-server/src/main/java/com/alibaba/himarket/service/hicoding - Portal Identity · Portal settings, OIDC/OAuth2, login, developer/admin identity flows
himarket-server/src/main/java/com/alibaba/himarket/service/PortalService.java
Web Frontends
Operator and developer React clients
- Admin Portal · Operator-facing UI for products, gateways, portals, MCP, sandbox, and observability
himarket-web/himarket-admin/src/App.tsx - Developer Portal · Marketplace, profile, chat, coding, subscriptions, and multilingual user flows
himarket-web/himarket-frontend/src/App.tsx
Execution Runtime
Isolated sandbox process used for coding and tool execution
- Sandbox Sidecar · Isolated exec, files, sessions, and terminal WebSocket boundary
sandbox/sidecar-server/server.js
Infrastructure
External services and deployment targets
- MySQL · Persistent store with Flyway-managed schema evolution
- Nacos · Configuration and service metadata sync target
- Higress / AI Gateway · Traffic exposure layer for models, APIs, and MCP-related routes
- Observability · Log, metrics, and scenario query integration
- LLM Providers · External model backends accessed through server adapters
Connections 22
- Admin Portal → Server: REST · Admin UI calls platform APIs
- Developer Portal → Server: REST · Developer UI calls marketplace and session APIs
- Developer Portal → Server: WebSocket/SSE · Live chat and coding streams
- Bootstrap → Server: wires · Bootstraps application modules and request pipeline
- Bootstrap → DAL: starts with · Loads persistence layer and migrations
- Server → DAL: reads/writes · Domain services persist through repositories
- DAL → MySQL: JPA · Repositories store entities in MySQL
- Server → Nacos: syncs · Configuration and market metadata integration
- Server → Higress / AI Gateway: exposes · Publishes model, API, and MCP endpoints through gateways
- Server → Observability: observes · Log and telemetry queries
- Server → LLM Providers: adapts · Chat services invoke external LLM providers
- Server → Sandbox Sidecar: orchestrates · Acquires, initializes, and monitors sandbox sessions
- Server → Products: packages · Products unify models, skills, MCP, and other offerings
- Products → MCP Orchestration: includes · Products can bundle MCP servers and configs
- Products → Gateway Ops: includes · Products reference gateway-backed resources
- Products → Portal Identity: targets · Portal settings and identity flows shape publication and access
- MCP Orchestration → Sandbox Sidecar: deploys to · MCP sandbox deployment and transport setup
- Gateway Ops → Higress / AI Gateway: drives · Gateway operators configure external exposure layers
- HiChat → LLM Providers: invokes · Chat runtime calls model adapters
- HiCoding → Sandbox Sidecar: executes in · Coding sessions rely on the isolated runtime boundary
- HiCoding → Server: sessions · WebSocket handlers and session orchestration live behind backend APIs
- Portal Identity → Server: auth · Login, OAuth2, OIDC, and portal settings are served by backend APIs