LakeQL
Introduction
  • Overview
  • Why LakeQL
  • Key Concepts
Getting Started
  • Prerequisites
  • Quickstart
  • Environment
  • First Run
Architecture
  • System Overview
  • Data Flow
  • Request Lifecycle
Configuration
  • Config File
  • Runtime Lifecycle
  • Environment Variables
create-app
  • Usage
  • Template Structure
  • Post-Creation
Guides
  • Custom Resolvers
  • Extending the Schema
  • Mutations
  • Set Up a Trino Mutation
  • Deploying
Endpoints
  • Definition Format
  • Field Types
  • Nested Fields
  • Mutations
  • Glossary
Contributing
  • Local Development
  • Contribution Guide
  • Architecture
GitHub
LakeQL
  1. LakeQL
  2. Getting Started
  3. First Run

On this page

  1. Generate an Endpoint
  2. Start the Server
  3. Run a Query

First Run

Generate an endpoint, start the server, and run a query.

Once the environment is configured, generate an endpoint and start the server.

Generate an Endpoint #

Introspect a table and generate its typed files with pull:

pnpm lakeql-cli pull --env .env
A scaffolded project installs @lakeql/cli as a dev dependency, so the command runs the local binary by default. Toggle Run without installing on any exec command to get the one-off form through pnpm dlx @lakeql/cli or npx @lakeql/cli, which fetches the package for a single run.

Run it interactively and it prompts for the source, schema, and table. You can also pass them as options. The generated files land under your configured source path. See Key Concepts for the layout.

Start the Server #

Start the generated dev script:

pnpm dev

This runs the scaffolded dev script (node --env-file=.env --import tsx ./src/index.ts). The script loads the generated schema and serves GraphQL at /graphql, with a health check at /live.

Check that the server started. A request to /live succeeds, and the query below runs against your generated type. Exact response bodies depend on your data, so they are not asserted here.

Run a Query #

Open the GraphQL endpoint and run a query against your generated type:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
query {
  orders(
    sorting: [{ field: id, direction: ASC }]
    paging: { page: 1, perPage: 10 }
  ) {
    nodes {
      id
      status
    }
    pageInfo {
      hasNext
      currentPage
    }
  }
}

sorting is required on every generated query. It gives the engine a deterministic ORDER BY. This keeps offset-based paging stable, so pages do not repeat or skip rows. See Sorting & Paging for why.

You're running
You now have a type-safe GraphQL API over your data source. From here, add more endpoints with pull, or explore the guides.

Previous page

Environment

Next page

Architecture