# hcengineering/platform architecture

> Architecture diagram of the GitHub repository hcengineering/platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hcengineering/platform
- Repository: https://github.com/hcengineering/platform

## Overview

Huly is a platform framework for business applications, including Chat, project management, CRM, HRM, and ATS. Its documented programmatic entry point is a typed API client; the sampled code also shows a presentation middleware layer and a server pipeline assembled from middleware. Persistence has PostgreSQL and MongoDB adapters, while communication and Hulylake provide distinct messaging and blob-storage capabilities. The excerpts do not establish how these subsystems are wired end to end, so uncertain connections are omitted.

Main entry points: [`packages/presentation/src/pipeline.ts`](https://github.com/hcengineering/platform/blob/develop/packages/presentation/src/pipeline.ts) (Presentation pipeline), [`server/server-pipeline/src/pipeline.ts`](https://github.com/hcengineering/platform/blob/develop/server/server-pipeline/src/pipeline.ts) (Server pipeline), [`foundations/server/packages/postgres/src/storage.ts`](https://github.com/hcengineering/platform/blob/develop/foundations/server/packages/postgres/src/storage.ts) (PostgreSQL adapter), [`foundations/server/packages/mongo/src/storage.ts`](https://github.com/hcengineering/platform/blob/develop/foundations/server/packages/mongo/src/storage.ts) (MongoDB adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client access"]
  node_api["Typed API client<br/>[client.ts]"]
  node_clientcore["Client core<br/>[index.ts]"]
  node_presentation["Presentation pipeline<br/>[pipeline.ts]"]
end

subgraph group_runtime["Platform runtime"]
  node_serverpipeline["Server pipeline<br/>[pipeline.ts]"]
  node_servercore["Server core<br/>[server.ts]"]
  node_appdomains["Business applications"]
end

subgraph group_data["Persistence and blobs"]
  node_postgresadapter["PostgreSQL adapter<br/>[storage.ts]"]
  node_mongoadapter["MongoDB adapter<br/>[storage.ts]"]
  node_postgres[("PostgreSQL")]
  node_mongodb[("MongoDB")]
  node_hulylake["Hulylake server<br/>[main.rs]"]
end

subgraph group_messaging["Communication"]
  node_commserver["Communication server<br/>[index.ts]"]
  node_commstorage["Event storage middleware<br/>[storage.ts]"]
  node_commdb["Communication database<br/>[index.ts]"]
end

node_developer(("API consumer"))

node_developer -->|"uses"| node_api
node_presentation -->|"delegates queries"| node_clientcore
node_serverpipeline -->|"creates pipeline"| node_servercore
node_postgresadapter -->|"reads and writes"| node_postgres
node_mongoadapter -->|"reads and writes"| node_mongodb
node_commstorage -->|"stores events"| node_commdb

click node_api "https://github.com/hcengineering/platform/blob/develop/foundations/core/packages/api-client/src/client.ts"
click node_clientcore "https://github.com/hcengineering/platform/blob/develop/foundations/core/packages/client/src/index.ts"
click node_presentation "https://github.com/hcengineering/platform/blob/develop/packages/presentation/src/pipeline.ts"
click node_serverpipeline "https://github.com/hcengineering/platform/blob/develop/server/server-pipeline/src/pipeline.ts"
click node_servercore "https://github.com/hcengineering/platform/blob/develop/foundations/core/packages/core/src/server.ts"
click node_postgresadapter "https://github.com/hcengineering/platform/blob/develop/foundations/server/packages/postgres/src/storage.ts"
click node_mongoadapter "https://github.com/hcengineering/platform/blob/develop/foundations/server/packages/mongo/src/storage.ts"
click node_hulylake "https://github.com/hcengineering/platform/blob/develop/foundations/hulylake/server/src/main.rs"
click node_commserver "https://github.com/hcengineering/platform/blob/develop/foundations/communication/packages/server/src/index.ts"
click node_commstorage "https://github.com/hcengineering/platform/blob/develop/foundations/communication/packages/server/src/middleware/storage.ts"
click node_commdb "https://github.com/hcengineering/platform/blob/develop/foundations/communication/packages/cockroach/src/index.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_clientcore,node_presentation toneBlue
class node_serverpipeline,node_servercore,node_appdomains toneAmber
class node_postgresadapter,node_mongoadapter,node_postgres,node_mongodb,node_hulylake,node_developer toneMint
class node_commserver,node_commstorage,node_commdb toneRose
```

## Components

### Client access

- [Typed API client](https://github.com/hcengineering/platform/blob/develop/foundations/core/packages/api-client/src/client.ts): `foundations/core/packages/api-client/src/client.ts`
- [Client core](https://github.com/hcengineering/platform/blob/develop/foundations/core/packages/client/src/index.ts): `foundations/core/packages/client/src/index.ts`
- [Presentation pipeline](https://github.com/hcengineering/platform/blob/develop/packages/presentation/src/pipeline.ts): `packages/presentation/src/pipeline.ts`

### Platform runtime

- [Server pipeline](https://github.com/hcengineering/platform/blob/develop/server/server-pipeline/src/pipeline.ts): `server/server-pipeline/src/pipeline.ts`
- [Server core](https://github.com/hcengineering/platform/blob/develop/foundations/core/packages/core/src/server.ts): `foundations/core/packages/core/src/server.ts`
- **Business applications**

### Persistence and blobs

- [PostgreSQL adapter](https://github.com/hcengineering/platform/blob/develop/foundations/server/packages/postgres/src/storage.ts): `foundations/server/packages/postgres/src/storage.ts`
- [MongoDB adapter](https://github.com/hcengineering/platform/blob/develop/foundations/server/packages/mongo/src/storage.ts): `foundations/server/packages/mongo/src/storage.ts`
- **PostgreSQL**
- **MongoDB**
- [Hulylake server](https://github.com/hcengineering/platform/blob/develop/foundations/hulylake/server/src/main.rs): `foundations/hulylake/server/src/main.rs`

### Communication

- [Communication server](https://github.com/hcengineering/platform/blob/develop/foundations/communication/packages/server/src/index.ts): `foundations/communication/packages/server/src/index.ts`
- [Event storage middleware](https://github.com/hcengineering/platform/blob/develop/foundations/communication/packages/server/src/middleware/storage.ts): `foundations/communication/packages/server/src/middleware/storage.ts`
- [Communication database](https://github.com/hcengineering/platform/blob/develop/foundations/communication/packages/cockroach/src/index.ts): `foundations/communication/packages/cockroach/src/index.ts`

### Other components

- **API consumer**

## Connections

- API consumer → Typed API client: uses
- Presentation pipeline → Client core: delegates queries
- Server pipeline → Server core: creates pipeline
- PostgreSQL adapter → PostgreSQL: reads and writes
- MongoDB adapter → MongoDB: reads and writes
- Event storage middleware → Communication database: stores events
