LakeQL
Introduction
  • Overview
  • Key Concepts
  • Package Map
Getting Started
  • Prerequisites
  • Quickstart
  • Environment Configuration
  • First Run
Architecture
  • System Overview
  • Data Flow
  • Request Lifecycle
Configuration
  • Environment Variables
  • Authentication
  • Trino Connection
create-app
  • Usage
  • Template Structure
  • Post Creation
Contributing
  • Local Development
  • Contribution Guide
Guides
  • Custom Resolvers
  • Extending Schema
  • Deploying
  • Mutations
  • Load Strategies
GitHub
LakeQL
  1. LakeQL
  2. Architecture
  3. System Overview

On this page

  1. Package Architecture
  2. Package Dependency Diagram
  3. CLI Flow — Introspection and Generation
  4. API Flow — Serving and Querying
  5. Design Principles

System Overview

Package dependency diagram and the two main operational flows in LakeQL.

Package Architecture #

LakeQL's packages are organized around two distinct operational flows: the CLI flow for introspection and code generation, and the API flow for serving GraphQL queries at runtime.

Package Dependency Diagram #

CLI Flow — Introspection and Generation #

The CLI flow runs at development time. Its job is to connect to Trino, discover table structures, and write TypeScript source files.

StepPackageAction
1@lakeql/cliParses CLI arguments, orchestrates the pipeline
2@lakeql/trino-clientExecutes SHOW COLUMNS against Trino
3@lakeql/column-parserParses raw type strings into structured definitions
4@lakeql/schema-generatorGenerates GraphQL models, JSON schemas, type definitions
5@lakeql/file-generatorWrites TypeScript files to disk

The output of this flow is committed to your repository and consumed by the API flow at runtime.

API Flow — Serving and Querying #

The API flow runs at production time. It serves a GraphQL endpoint and translates queries into Trino SQL.

StepPackageAction
1@lakeql/apiReceives HTTP requests, runs auth, loads Pothos schemas
2@lakeql/query-builderTranslates GraphQL resolve info into Kysely SQL
3@lakeql/trino-clientSubmits SQL to Trino and polls for results
4@lakeql/response-transformerConverts array responses to typed objects
5@lakeql/helpersCalculates pagination metadata

Design Principles #

  • Single responsibility — Each package does one thing well
  • Shared nothing — Packages communicate through well-defined interfaces, not shared state
  • Generated over hand-written — Prefer code generation over manual resolver authoring
  • Type safety everywhere — TypeScript types flow from Trino metadata through to GraphQL responses

Previous page

Architecture

Next page

Data Flow