# imrlopezag/kello architecture

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

- Interactive diagram: https://gitdiagram.com/imrlopezag/kello
- Repository: https://github.com/imrlopezag/kello

## Overview

Kello is a contract-first TypeScript backend for PostgreSQL and Neon. A developer defines schema, contracts, and handlers; the CLI loads the project, generates typed application/client artifacts, and manages Neon provisioning and releases. At runtime, client and React integrations call server RPC procedures, which apply database, authentication, search, realtime, and job capabilities. Storage has a distinct control-plane flow for intents and signed object-store operations. The README documents several capabilities whose implementation paths are visible in the tree but were not sampled; those branches are included without asserting unsampled call chains.

Main entry points: [`apps/kello/src/core/server/rpc/database.ts`](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/rpc/database.ts) (Application RPC), [`apps/kello/src/core/client/rpc-transport.ts`](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/client/rpc-transport.ts) (Typed client), [`apps/kello-cli/src/tooling/project/load.ts`](https://github.com/imrlopezag/kello/blob/main/apps/kello-cli/src/tooling/project/load.ts) (Project loading), [`apps/kello/src/core/adapters/neon/storage-http.ts`](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/adapters/neon/storage-http.ts) (Storage endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and deployment"]
  node_project["Project loading<br/>[load.ts]"]
  node_config["Project config"]
  node_codegen["Artifact generation<br/>[application.ts]"]
  node_neon["Neon deployment"]
end

subgraph group_server["Server runtime"]
  node_runtime["Application RPC<br/>[database.ts]"]
  node_rpc["RPC transport<br/>[rpc-http.ts]"]
end

subgraph group_data["Data capabilities"]
  node_db["Database access<br/>[connection.ts]"]
  node_schema["Schema contracts<br/>[define-schema.ts]"]
  node_search["Typed search<br/>[executor.ts]"]
  node_realtime["Live queries<br/>[procedure.ts]"]
  node_jobs["Durable jobs<br/>[durable-worker.ts]"]
end

subgraph group_client["Clients and integrations"]
  node_client["Typed client<br/>[rpc-transport.ts]"]
  node_react["React integration<br/>[live-query.ts]"]
end

subgraph group_auth["Identity and storage"]
  node_auth["Authentication<br/>[verify.ts]"]
  node_storageclient["Storage client<br/>[storage.ts]"]
  node_storagehttp["Storage endpoint<br/>[storage-http.ts]"]
  node_intents[("Storage intents<br/>[intents.ts]")]
  node_objectstore["Private object storage<br/>[storage.ts]"]
end

node_developer(("Application developer"))
node_neonservice[("Neon platform")]
node_postgres[("PostgreSQL")]
node_s3[("S3-compatible storage")]

node_developer -->|"defines project"| node_project
node_project -->|"resolves config"| node_config
node_project -->|"supplies project"| node_codegen
node_developer -->|"deploys backend"| node_neon
node_neon -->|"provisions and releases"| node_neonservice
node_codegen -->|"generates client"| node_client
node_developer -->|"defines schema"| node_schema
node_developer -->|"implements handlers"| node_runtime
node_runtime -->|"uses database"| node_db
node_runtime -->|"validates search"| node_search
node_runtime -->|"recognizes live contracts"| node_realtime
node_runtime -.->|"supports background work"| node_jobs
node_db -->|"runs transactions"| node_postgres
node_client -.->|"sends RPC calls"| node_rpc
node_rpc -.->|"dispatches procedures"| node_runtime
node_react -->|"uses live client"| node_client
node_client -.->|"authenticates requests"| node_auth
node_storageclient -->|"sends storage requests"| node_storagehttp
node_storagehttp -->|"handles intents"| node_intents
node_storagehttp -->|"verifies session"| node_auth
node_intents -.->|"verifies objects"| node_objectstore
node_objectstore -->|"signs and transfers objects"| node_s3
node_storageclient -.->|"uploads via signed URL"| node_s3

click node_project "https://github.com/imrlopezag/kello/blob/main/apps/kello-cli/src/tooling/project/load.ts"
click node_config "https://github.com/imrlopezag/kello/tree/main/apps/kello-cli/src/tooling/config"
click node_codegen "https://github.com/imrlopezag/kello/blob/main/apps/kello-cli/src/tooling/codegen/application.ts"
click node_neon "https://github.com/imrlopezag/kello/tree/main/apps/kello-cli/src/tooling/deploy/neon"
click node_runtime "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/rpc/database.ts"
click node_db "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/database/connection.ts"
click node_schema "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/schema/define-schema.ts"
click node_search "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/search/executor.ts"
click node_realtime "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/realtime/procedure.ts"
click node_jobs "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/jobs/durable-worker.ts"
click node_rpc "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/adapters/neon/rpc-http.ts"
click node_client "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/client/rpc-transport.ts"
click node_react "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/react/live-query.ts"
click node_auth "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/auth/verify.ts"
click node_storageclient "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/client/storage.ts"
click node_storagehttp "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/adapters/neon/storage-http.ts"
click node_intents "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/storage/intents.ts"
click node_objectstore "https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/adapters/neon/storage.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_project,node_config,node_codegen,node_neon toneBlue
class node_runtime,node_rpc,node_neonservice,node_postgres,node_s3 toneAmber
class node_db,node_schema,node_search,node_realtime,node_jobs toneMint
class node_client,node_react toneRose
class node_auth,node_storageclient,node_storagehttp,node_intents,node_objectstore,node_developer toneIndigo
```

## Components

### CLI and deployment

- [Project loading](https://github.com/imrlopezag/kello/blob/main/apps/kello-cli/src/tooling/project/load.ts): `apps/kello-cli/src/tooling/project/load.ts`
- [Project config](https://github.com/imrlopezag/kello/tree/main/apps/kello-cli/src/tooling/config): `apps/kello-cli/src/tooling/config`
- [Artifact generation](https://github.com/imrlopezag/kello/blob/main/apps/kello-cli/src/tooling/codegen/application.ts): `apps/kello-cli/src/tooling/codegen/application.ts`
- [Neon deployment](https://github.com/imrlopezag/kello/tree/main/apps/kello-cli/src/tooling/deploy/neon): `apps/kello-cli/src/tooling/deploy/neon`

### Server runtime

- [Application RPC](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/rpc/database.ts): `apps/kello/src/core/server/rpc/database.ts`
- [RPC transport](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/adapters/neon/rpc-http.ts): `apps/kello/src/core/adapters/neon/rpc-http.ts`

### Data capabilities

- [Database access](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/database/connection.ts): `apps/kello/src/core/server/database/connection.ts`
- [Schema contracts](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/schema/define-schema.ts): `apps/kello/src/core/schema/define-schema.ts`
- [Typed search](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/search/executor.ts): `apps/kello/src/core/search/executor.ts`
- [Live queries](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/realtime/procedure.ts): `apps/kello/src/core/server/realtime/procedure.ts`
- [Durable jobs](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/jobs/durable-worker.ts): `apps/kello/src/core/server/jobs/durable-worker.ts`

### Clients and integrations

- [Typed client](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/client/rpc-transport.ts): `apps/kello/src/core/client/rpc-transport.ts`
- [React integration](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/react/live-query.ts): `apps/kello/src/core/react/live-query.ts`

### Identity and storage

- [Authentication](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/auth/verify.ts): `apps/kello/src/core/server/auth/verify.ts`
- [Storage client](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/client/storage.ts): `apps/kello/src/core/client/storage.ts`
- [Storage endpoint](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/adapters/neon/storage-http.ts): `apps/kello/src/core/adapters/neon/storage-http.ts`
- [Storage intents](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/server/storage/intents.ts): `apps/kello/src/core/server/storage/intents.ts`
- [Private object storage](https://github.com/imrlopezag/kello/blob/main/apps/kello/src/core/adapters/neon/storage.ts): `apps/kello/src/core/adapters/neon/storage.ts`

### Other components

- **Application developer**
- **Neon platform**
- **PostgreSQL**
- **S3-compatible storage**

## Connections

- Application developer → Project loading: defines project
- Project loading → Project config: resolves config (evidence: `apps/kello-cli/src/tooling/project/load.ts`)
- Project loading → Artifact generation: supplies project (evidence: `apps/kello-cli/src/tooling/codegen/application.ts`)
- Application developer → Neon deployment: deploys backend
- Neon deployment → Neon platform: provisions and releases
- Artifact generation → Typed client: generates client (evidence: `apps/kello-cli/src/tooling/codegen/application.ts`)
- Application developer → Schema contracts: defines schema
- Application developer → Application RPC: implements handlers
- Application RPC → Database access: uses database (evidence: `apps/kello/src/core/server/rpc/database.ts`)
- Application RPC → Typed search: validates search (evidence: `apps/kello/src/core/server/rpc/database.ts`)
- Application RPC → Live queries: recognizes live contracts (evidence: `apps/kello/src/core/server/rpc/database.ts`)
- Application RPC → Durable jobs: supports background work
- Database access → PostgreSQL: runs transactions
- Typed client → RPC transport: sends RPC calls
- RPC transport → Application RPC: dispatches procedures
- React integration → Typed client: uses live client (evidence: `apps/kello/src/core/react/live-query.ts`)
- Typed client → Authentication: authenticates requests
- Storage client → Storage endpoint: sends storage requests (evidence: `apps/kello/src/core/client/storage.ts`)
- Storage endpoint → Storage intents: handles intents (evidence: `apps/kello/src/core/adapters/neon/storage-http.ts`)
- Storage endpoint → Authentication: verifies session (evidence: `apps/kello/src/core/adapters/neon/storage-http.ts`)
- Storage intents → Private object storage: verifies objects
- Private object storage → S3-compatible storage: signs and transfers objects (evidence: `apps/kello/src/core/adapters/neon/storage.ts`)
- Storage client → S3-compatible storage: uploads via signed URL
